195
196 return false;
197 }
198
199 Node* G1BarrierSetC2::load_at_resolved(C2Access& access, const Type* val_type) const {
200 DecoratorSet decorators = access.decorators();
201 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
202 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
203 bool no_keepalive = (decorators & AS_NO_KEEPALIVE) != 0;
204 // If we are reading the value of the referent field of a Reference object, we
205 // need to record the referent in an SATB log buffer using the pre-barrier
206 // mechanism. Also we need to add a memory barrier to prevent commoning reads
207 // from this field across safepoints, since GC can change its value.
208 bool need_read_barrier = ((on_weak || on_phantom) && !no_keepalive);
209 if (access.is_oop() && need_read_barrier) {
210 access.set_barrier_data(G1C2BarrierPre);
211 }
212 return CardTableBarrierSetC2::load_at_resolved(access, val_type);
213 }
214
215 void G1BarrierSetC2::eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const {
216 eliminate_gc_barrier_data(node);
217 }
218
219 void G1BarrierSetC2::eliminate_gc_barrier_data(Node* node) const {
220 if (node->is_LoadStore()) {
221 LoadStoreNode* loadstore = node->as_LoadStore();
222 loadstore->set_barrier_data(0);
223 } else if (node->is_Mem()) {
224 MemNode* mem = node->as_Mem();
225 mem->set_barrier_data(0);
226 }
227 }
228
229 static void refine_barrier_by_new_val_type(const Node* n) {
230 if (n->Opcode() != Op_StoreP &&
231 n->Opcode() != Op_StoreN) {
232 return;
233 }
234 MemNode* store = n->as_Mem();
235 const Node* newval = n->in(MemNode::ValueIn);
236 assert(newval != nullptr, "");
237 const Type* newval_bottom = newval->bottom_type();
238 TypePtr::PTR newval_type = newval_bottom->make_ptr()->ptr();
|
195
196 return false;
197 }
198
199 Node* G1BarrierSetC2::load_at_resolved(C2Access& access, const Type* val_type) const {
200 DecoratorSet decorators = access.decorators();
201 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
202 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
203 bool no_keepalive = (decorators & AS_NO_KEEPALIVE) != 0;
204 // If we are reading the value of the referent field of a Reference object, we
205 // need to record the referent in an SATB log buffer using the pre-barrier
206 // mechanism. Also we need to add a memory barrier to prevent commoning reads
207 // from this field across safepoints, since GC can change its value.
208 bool need_read_barrier = ((on_weak || on_phantom) && !no_keepalive);
209 if (access.is_oop() && need_read_barrier) {
210 access.set_barrier_data(G1C2BarrierPre);
211 }
212 return CardTableBarrierSetC2::load_at_resolved(access, val_type);
213 }
214
215 void G1BarrierSetC2::eliminate_gc_barrier(PhaseIterGVN* igvn, Node* node) const {
216 eliminate_gc_barrier_data(node);
217 }
218 void G1BarrierSetC2::eliminate_gc_barrier_data(Node* node) const {
219 if (node->is_LoadStore()) {
220 LoadStoreNode* loadstore = node->as_LoadStore();
221 loadstore->set_barrier_data(0);
222 } else if (node->is_Mem()) {
223 MemNode* mem = node->as_Mem();
224 mem->set_barrier_data(0);
225 }
226 }
227
228 static void refine_barrier_by_new_val_type(const Node* n) {
229 if (n->Opcode() != Op_StoreP &&
230 n->Opcode() != Op_StoreN) {
231 return;
232 }
233 MemNode* store = n->as_Mem();
234 const Node* newval = n->in(MemNode::ValueIn);
235 assert(newval != nullptr, "");
236 const Type* newval_bottom = newval->bottom_type();
237 TypePtr::PTR newval_type = newval_bottom->make_ptr()->ptr();
|