< prev index next >

src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp

Print this page

281  * G1 similar to any GC with a Young Generation requires a way to keep track of
282  * references from Old Generation to Young Generation to make sure all live
283  * objects are found. G1 also requires to keep track of object references
284  * between different regions to enable evacuation of old regions, which is done
285  * as part of mixed collections. References are tracked in remembered sets and
286  * is continuously updated as reference are written to with the help of the
287  * post-barrier.
288  *
289  * To reduce the number of updates to the remembered set the post-barrier
290  * filters updates to fields in objects located in the Young Generation,
291  * the same region as the reference, when the NULL is being written or
292  * if the card is already marked as dirty by an earlier write.
293  *
294  * Under certain circumstances it is possible to avoid generating the
295  * post-barrier completely if it is possible during compile time to prove
296  * the object is newly allocated and that no safepoint exists between the
297  * allocation and the store.
298  *
299  * In the case of slow allocation the allocation code must handle the barrier
300  * as part of the allocation in the case the allocated object is not located
301  * in the nursery, this would happen for humongous objects. This is similar to
302  * how CMS was required to handle this case, see the comments for the method
303  * CollectedHeap::new_deferred_store_barrier and OptoRuntime::new_deferred_store_barrier.
304  * A deferred card mark is required for these objects and handled in the above
305  * mentioned methods.
306  *
307  * Returns true if the post barrier can be removed
308  */
309 bool G1BarrierSetC2::g1_can_remove_post_barrier(GraphKit* kit,
310                                                 PhaseTransform* phase, Node* store,
311                                                 Node* adr) const {
312   intptr_t      offset = 0;
313   Node*         base   = AddPNode::Ideal_base_and_offset(adr, phase, offset);
314   AllocateNode* alloc  = AllocateNode::Ideal_allocation(base, phase);
315 
316   if (offset == Type::OffsetBot) {
317     return false; // cannot unalias unless there are precise offsets
318   }
319 
320   if (alloc == NULL) {
321      return false; // No allocation found
322   }
323 
324   // Start search from Store node
325   Node* mem = store->in(MemNode::Control);

281  * G1 similar to any GC with a Young Generation requires a way to keep track of
282  * references from Old Generation to Young Generation to make sure all live
283  * objects are found. G1 also requires to keep track of object references
284  * between different regions to enable evacuation of old regions, which is done
285  * as part of mixed collections. References are tracked in remembered sets and
286  * is continuously updated as reference are written to with the help of the
287  * post-barrier.
288  *
289  * To reduce the number of updates to the remembered set the post-barrier
290  * filters updates to fields in objects located in the Young Generation,
291  * the same region as the reference, when the NULL is being written or
292  * if the card is already marked as dirty by an earlier write.
293  *
294  * Under certain circumstances it is possible to avoid generating the
295  * post-barrier completely if it is possible during compile time to prove
296  * the object is newly allocated and that no safepoint exists between the
297  * allocation and the store.
298  *
299  * In the case of slow allocation the allocation code must handle the barrier
300  * as part of the allocation in the case the allocated object is not located
301  * in the nursery, this would happen for humongous objects.




302  *
303  * Returns true if the post barrier can be removed
304  */
305 bool G1BarrierSetC2::g1_can_remove_post_barrier(GraphKit* kit,
306                                                 PhaseTransform* phase, Node* store,
307                                                 Node* adr) const {
308   intptr_t      offset = 0;
309   Node*         base   = AddPNode::Ideal_base_and_offset(adr, phase, offset);
310   AllocateNode* alloc  = AllocateNode::Ideal_allocation(base, phase);
311 
312   if (offset == Type::OffsetBot) {
313     return false; // cannot unalias unless there are precise offsets
314   }
315 
316   if (alloc == NULL) {
317      return false; // No allocation found
318   }
319 
320   // Start search from Store node
321   Node* mem = store->in(MemNode::Control);
< prev index next >