694 return atomic_xchg_at_resolved(access, new_val, value_type);
695 }
696
697 Node* BarrierSetC2::atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const {
698 C2AccessFence fence(access);
699 resolve_address(access);
700 return atomic_add_at_resolved(access, new_val, value_type);
701 }
702
703 int BarrierSetC2::arraycopy_payload_base_offset(bool is_array) {
704 // Exclude the header but include array length to copy by 8 bytes words.
705 // Can't use base_offset_in_bytes(bt) since basic type is unknown.
706 int base_off = is_array ? arrayOopDesc::length_offset_in_bytes() :
707 instanceOopDesc::base_offset_in_bytes();
708 // base_off:
709 // 8 - 32-bit VM
710 // 12 - 64-bit VM, compressed klass
711 // 16 - 64-bit VM, normal klass
712 if (base_off % BytesPerLong != 0) {
713 assert(UseCompressedClassPointers, "");
714 if (is_array) {
715 // Exclude length to copy by 8 bytes words.
716 base_off += sizeof(int);
717 } else {
718 // Include klass to copy by 8 bytes words.
719 base_off = instanceOopDesc::klass_offset_in_bytes();
720 }
721 assert(base_off % BytesPerLong == 0, "expect 8 bytes alignment");
722 }
723 return base_off;
724 }
725
726 void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* size, bool is_array) const {
727 int base_off = arraycopy_payload_base_offset(is_array);
728 Node* payload_size = size;
729 Node* offset = kit->MakeConX(base_off);
730 payload_size = kit->gvn().transform(new SubXNode(payload_size, offset));
731 if (is_array) {
732 // Ensure the array payload size is rounded up to the next BytesPerLong
733 // multiple when converting to double-words. This is necessary because array
|
694 return atomic_xchg_at_resolved(access, new_val, value_type);
695 }
696
697 Node* BarrierSetC2::atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const {
698 C2AccessFence fence(access);
699 resolve_address(access);
700 return atomic_add_at_resolved(access, new_val, value_type);
701 }
702
703 int BarrierSetC2::arraycopy_payload_base_offset(bool is_array) {
704 // Exclude the header but include array length to copy by 8 bytes words.
705 // Can't use base_offset_in_bytes(bt) since basic type is unknown.
706 int base_off = is_array ? arrayOopDesc::length_offset_in_bytes() :
707 instanceOopDesc::base_offset_in_bytes();
708 // base_off:
709 // 8 - 32-bit VM
710 // 12 - 64-bit VM, compressed klass
711 // 16 - 64-bit VM, normal klass
712 if (base_off % BytesPerLong != 0) {
713 assert(UseCompressedClassPointers, "");
714 assert(!UseCompactObjectHeaders, "");
715 if (is_array) {
716 // Exclude length to copy by 8 bytes words.
717 base_off += sizeof(int);
718 } else {
719 // Include klass to copy by 8 bytes words.
720 base_off = instanceOopDesc::klass_offset_in_bytes();
721 }
722 assert(base_off % BytesPerLong == 0, "expect 8 bytes alignment");
723 }
724 return base_off;
725 }
726
727 void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* size, bool is_array) const {
728 int base_off = arraycopy_payload_base_offset(is_array);
729 Node* payload_size = size;
730 Node* offset = kit->MakeConX(base_off);
731 payload_size = kit->gvn().transform(new SubXNode(payload_size, offset));
732 if (is_array) {
733 // Ensure the array payload size is rounded up to the next BytesPerLong
734 // multiple when converting to double-words. This is necessary because array
|