< prev index next >

src/hotspot/share/gc/shared/c2/barrierSetC2.cpp

Print this page




 545 
 546 Node* BarrierSetC2::atomic_cmpxchg_bool_at(C2AtomicAccess& access, Node* expected_val,
 547                                            Node* new_val, const Type* value_type) const {
 548   C2AccessFence fence(access);
 549   resolve_address(access);
 550   return atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type);
 551 }
 552 
 553 Node* BarrierSetC2::atomic_xchg_at(C2AtomicAccess& access, Node* new_val, const Type* value_type) const {
 554   C2AccessFence fence(access);
 555   resolve_address(access);
 556   return atomic_xchg_at_resolved(access, new_val, value_type);
 557 }
 558 
 559 Node* BarrierSetC2::atomic_add_at(C2AtomicAccess& access, Node* new_val, const Type* value_type) const {
 560   C2AccessFence fence(access);
 561   resolve_address(access);
 562   return atomic_add_at_resolved(access, new_val, value_type);
 563 }
 564 
 565 void BarrierSetC2::clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const {
 566   // Exclude the header but include array length to copy by 8 bytes words.
 567   // Can't use base_offset_in_bytes(bt) since basic type is unknown.
 568   int base_off = is_array ? arrayOopDesc::length_offset_in_bytes() :
 569                             instanceOopDesc::base_offset_in_bytes();
 570   // base_off:
 571   // 8  - 32-bit VM
 572   // 12 - 64-bit VM, compressed klass
 573   // 16 - 64-bit VM, normal klass
 574   if (base_off % BytesPerLong != 0) {
 575     assert(UseCompressedClassPointers, "");
 576     if (is_array) {
 577       // Exclude length to copy by 8 bytes words.
 578       base_off += sizeof(int);
 579     } else {
 580       // Include klass to copy by 8 bytes words.
 581       base_off = instanceOopDesc::klass_offset_in_bytes();
 582     }
 583     assert(base_off % BytesPerLong == 0, "expect 8 bytes alignment");
 584   }
 585   Node* src_base  = kit->basic_plus_adr(src,  base_off);
 586   Node* dst_base = kit->basic_plus_adr(dst, base_off);
 587 
 588   // Compute the length also, if needed:
 589   Node* countx = size;
 590   countx = kit->gvn().transform(new SubXNode(countx, kit->MakeConX(base_off)));
 591   countx = kit->gvn().transform(new URShiftXNode(countx, kit->intcon(LogBytesPerLong) ));
 592 
 593   const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
 594 
 595   ArrayCopyNode* ac = ArrayCopyNode::make(kit, false, src_base, NULL, dst_base, NULL, countx, false, false);
 596   ac->set_clonebasic();
 597   Node* n = kit->gvn().transform(ac);
 598   if (n == ac) {
 599     kit->set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type);
 600   } else {
 601     kit->set_all_memory(n);
 602   }
 603 }


 545 
 546 Node* BarrierSetC2::atomic_cmpxchg_bool_at(C2AtomicAccess& access, Node* expected_val,
 547                                            Node* new_val, const Type* value_type) const {
 548   C2AccessFence fence(access);
 549   resolve_address(access);
 550   return atomic_cmpxchg_bool_at_resolved(access, expected_val, new_val, value_type);
 551 }
 552 
 553 Node* BarrierSetC2::atomic_xchg_at(C2AtomicAccess& access, Node* new_val, const Type* value_type) const {
 554   C2AccessFence fence(access);
 555   resolve_address(access);
 556   return atomic_xchg_at_resolved(access, new_val, value_type);
 557 }
 558 
 559 Node* BarrierSetC2::atomic_add_at(C2AtomicAccess& access, Node* new_val, const Type* value_type) const {
 560   C2AccessFence fence(access);
 561   resolve_address(access);
 562   return atomic_add_at_resolved(access, new_val, value_type);
 563 }
 564 
 565 void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* countx, bool is_array) const {
 566 #ifdef ASSERT
 567   intptr_t src_offset;
 568   Node* src = AddPNode::Ideal_base_and_offset(src_base, &kit->gvn(), src_offset);
 569   intptr_t dst_offset;
 570   Node* dst = AddPNode::Ideal_base_and_offset(dst_base, &kit->gvn(), dst_offset);
 571   assert(src == NULL || (src_offset % BytesPerLong == 0), "expect 8 bytes alignment");
 572   assert(dst == NULL || (dst_offset % BytesPerLong == 0), "expect 8 bytes alignment");
 573 #endif


















 574 
 575   const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
 576 
 577   ArrayCopyNode* ac = ArrayCopyNode::make(kit, false, src_base, NULL, dst_base, NULL, countx, false, false);
 578   ac->set_clonebasic();
 579   Node* n = kit->gvn().transform(ac);
 580   if (n == ac) {
 581     kit->set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type);
 582   } else {
 583     kit->set_all_memory(n);
 584   }
 585 }
< prev index next >