641 return atomic_xchg_at_resolved(access, new_val, value_type);
642 }
643
644 Node* BarrierSetC2::atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const {
645 C2AccessFence fence(access);
646 resolve_address(access);
647 return atomic_add_at_resolved(access, new_val, value_type);
648 }
649
650 int BarrierSetC2::arraycopy_payload_base_offset(bool is_array) {
651 // Exclude the header but include array length to copy by 8 bytes words.
652 // Can't use base_offset_in_bytes(bt) since basic type is unknown.
653 int base_off = is_array ? arrayOopDesc::length_offset_in_bytes() :
654 instanceOopDesc::base_offset_in_bytes();
655 // base_off:
656 // 8 - 32-bit VM
657 // 12 - 64-bit VM, compressed klass
658 // 16 - 64-bit VM, normal klass
659 if (base_off % BytesPerLong != 0) {
660 assert(UseCompressedClassPointers, "");
661 if (is_array) {
662 // Exclude length to copy by 8 bytes words.
663 base_off += sizeof(int);
664 } else {
665 // Include klass to copy by 8 bytes words.
666 base_off = instanceOopDesc::klass_offset_in_bytes();
667 }
668 assert(base_off % BytesPerLong == 0, "expect 8 bytes alignment");
669 }
670 return base_off;
671 }
672
673 void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* size, bool is_array) const {
674 int base_off = arraycopy_payload_base_offset(is_array);
675 Node* payload_size = size;
676 Node* offset = kit->MakeConX(base_off);
677 payload_size = kit->gvn().transform(new SubXNode(payload_size, offset));
678 if (is_array) {
679 // Ensure the array payload size is rounded up to the next BytesPerLong
680 // multiple when converting to double-words. This is necessary because array
|
641 return atomic_xchg_at_resolved(access, new_val, value_type);
642 }
643
644 Node* BarrierSetC2::atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const {
645 C2AccessFence fence(access);
646 resolve_address(access);
647 return atomic_add_at_resolved(access, new_val, value_type);
648 }
649
650 int BarrierSetC2::arraycopy_payload_base_offset(bool is_array) {
651 // Exclude the header but include array length to copy by 8 bytes words.
652 // Can't use base_offset_in_bytes(bt) since basic type is unknown.
653 int base_off = is_array ? arrayOopDesc::length_offset_in_bytes() :
654 instanceOopDesc::base_offset_in_bytes();
655 // base_off:
656 // 8 - 32-bit VM
657 // 12 - 64-bit VM, compressed klass
658 // 16 - 64-bit VM, normal klass
659 if (base_off % BytesPerLong != 0) {
660 assert(UseCompressedClassPointers, "");
661 assert(!UseCompactObjectHeaders, "");
662 if (is_array) {
663 // Exclude length to copy by 8 bytes words.
664 base_off += sizeof(int);
665 } else {
666 // Include klass to copy by 8 bytes words.
667 base_off = instanceOopDesc::klass_offset_in_bytes();
668 }
669 assert(base_off % BytesPerLong == 0, "expect 8 bytes alignment");
670 }
671 return base_off;
672 }
673
674 void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* size, bool is_array) const {
675 int base_off = arraycopy_payload_base_offset(is_array);
676 Node* payload_size = size;
677 Node* offset = kit->MakeConX(base_off);
678 payload_size = kit->gvn().transform(new SubXNode(payload_size, offset));
679 if (is_array) {
680 // Ensure the array payload size is rounded up to the next BytesPerLong
681 // multiple when converting to double-words. This is necessary because array
|