< prev index next >

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

Print this page

 21  * questions.
 22  *
 23  */
 24 
 25 #include "opto/arraycopynode.hpp"
 26 #include "opto/graphKit.hpp"
 27 #include "opto/idealKit.hpp"
 28 #include "gc/shared/c2/modRefBarrierSetC2.hpp"
 29 
 30 Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const {
 31   DecoratorSet decorators = access.decorators();
 32 
 33   Node* adr = access.addr().node();
 34 
 35   bool is_array = (decorators & IS_ARRAY) != 0;
 36   bool anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
 37   bool in_heap = (decorators & IN_HEAP) != 0;
 38   bool use_precise = is_array || anonymous;
 39   bool tightly_coupled_alloc = (decorators & C2_TIGHTLY_COUPLED_ALLOC) != 0;
 40 
 41   if (!access.is_oop() || tightly_coupled_alloc || (!in_heap && !anonymous)) {





 42     return BarrierSetC2::store_at_resolved(access, val);
 43   }
 44 
 45   assert(access.is_parse_access(), "entry not supported at optimization time");
 46   C2ParseAccess& parse_access = static_cast<C2ParseAccess&>(access);
 47 
 48   Node* store = BarrierSetC2::store_at_resolved(access, val);
 49   post_barrier(parse_access.kit(), access.base(), adr, val.node(), use_precise);


















 50 
 51   return store;
 52 }
 53 
 54 Node* ModRefBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access, Node* expected_val,
 55                                                          Node* new_val, const Type* value_type) const {
 56   if (!access.is_oop()) {
 57     return BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
 58   }
 59 
 60   Node* result = BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
 61 
 62   post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true);
 63 
 64   return result;
 65 }
 66 
 67 Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& access, Node* expected_val,
 68                                                           Node* new_val, const Type* value_type) const {
 69   GraphKit* kit = access.kit();

 21  * questions.
 22  *
 23  */
 24 
 25 #include "opto/arraycopynode.hpp"
 26 #include "opto/graphKit.hpp"
 27 #include "opto/idealKit.hpp"
 28 #include "gc/shared/c2/modRefBarrierSetC2.hpp"
 29 
 30 Node* ModRefBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue& val) const {
 31   DecoratorSet decorators = access.decorators();
 32 
 33   Node* adr = access.addr().node();
 34 
 35   bool is_array = (decorators & IS_ARRAY) != 0;
 36   bool anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
 37   bool in_heap = (decorators & IN_HEAP) != 0;
 38   bool use_precise = is_array || anonymous;
 39   bool tightly_coupled_alloc = (decorators & C2_TIGHTLY_COUPLED_ALLOC) != 0;
 40 
 41   const InlineTypeNode* vt = nullptr;
 42   if (access.is_parse_access() && static_cast<C2ParseAccess&>(access).vt() != nullptr) {
 43     vt = static_cast<C2ParseAccess&>(access).vt();
 44   }
 45 
 46   if (vt == nullptr && (!access.is_oop() || tightly_coupled_alloc || (!in_heap && !anonymous))) {
 47     return BarrierSetC2::store_at_resolved(access, val);
 48   }
 49 
 50   assert(access.is_parse_access(), "entry not supported at optimization time");
 51   C2ParseAccess& parse_access = static_cast<C2ParseAccess&>(access);
 52 
 53   Node* store = BarrierSetC2::store_at_resolved(access, val);
 54 
 55   // TODO 8350865
 56   // - We actually only need the post barrier once for non-arrays (same for C1, right)?
 57   // - Value is only needed to determine if we are storing null. Maybe we can go with a simple boolean?
 58   GraphKit* kit = parse_access.kit();
 59   if (vt != nullptr) {
 60     for (uint i = 0; i < vt->field_count(); ++i) {
 61       ciType* type = vt->field_type(i);
 62       if (!type->is_primitive_type()) {
 63         ciInlineKlass* vk = vt->bottom_type()->inline_klass();
 64         int field_offset = vt->field_offset(i) - vk->payload_offset();
 65         Node* value = vt->field_value(i);
 66         Node* field_adr = kit->basic_plus_adr(access.base(), adr, field_offset);
 67         post_barrier(kit, access.base(), field_adr, value, use_precise);
 68       }
 69     }
 70   } else {
 71     post_barrier(kit, access.base(), adr, val.node(), use_precise);
 72   }
 73 
 74   return store;
 75 }
 76 
 77 Node* ModRefBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess& access, Node* expected_val,
 78                                                          Node* new_val, const Type* value_type) const {
 79   if (!access.is_oop()) {
 80     return BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
 81   }
 82 
 83   Node* result = BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
 84 
 85   post_barrier(access.kit(), access.base(), access.addr().node(), new_val, true);
 86 
 87   return result;
 88 }
 89 
 90 Node* ModRefBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAccess& access, Node* expected_val,
 91                                                           Node* new_val, const Type* value_type) const {
 92   GraphKit* kit = access.kit();
< prev index next >