hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp
changeset 11584 e1df4d08a1f4
parent 11455 a6ab3d8b9a4c
child 12508 d76458352d62
equal deleted inserted replaced
11583:83a7383de44c 11584:e1df4d08a1f4
    70          (size_t) pointer_delta(prev_top_at_mark_start(), bottom()) *
    70          (size_t) pointer_delta(prev_top_at_mark_start(), bottom()) *
    71          HeapWordSize, "invariant");
    71          HeapWordSize, "invariant");
    72 }
    72 }
    73 
    73 
    74 inline void HeapRegion::note_start_of_copying(bool during_initial_mark) {
    74 inline void HeapRegion::note_start_of_copying(bool during_initial_mark) {
    75   if (during_initial_mark) {
    75   if (is_survivor()) {
    76     if (is_survivor()) {
    76     // This is how we always allocate survivors.
    77       assert(false, "should not allocate survivors during IM");
    77     assert(_next_top_at_mark_start == bottom(), "invariant");
    78     } else {
    78   } else {
       
    79     if (during_initial_mark) {
    79       // During initial-mark we'll explicitly mark any objects on old
    80       // During initial-mark we'll explicitly mark any objects on old
    80       // regions that are pointed to by roots. Given that explicit
    81       // regions that are pointed to by roots. Given that explicit
    81       // marks only make sense under NTAMS it'd be nice if we could
    82       // marks only make sense under NTAMS it'd be nice if we could
    82       // check that condition if we wanted to. Given that we don't
    83       // check that condition if we wanted to. Given that we don't
    83       // know where the top of this region will end up, we simply set
    84       // know where the top of this region will end up, we simply set
    84       // NTAMS to the end of the region so all marks will be below
    85       // NTAMS to the end of the region so all marks will be below
    85       // NTAMS. We'll set it to the actual top when we retire this region.
    86       // NTAMS. We'll set it to the actual top when we retire this region.
    86       _next_top_at_mark_start = end();
    87       _next_top_at_mark_start = end();
    87     }
       
    88   } else {
       
    89     if (is_survivor()) {
       
    90       // This is how we always allocate survivors.
       
    91       assert(_next_top_at_mark_start == bottom(), "invariant");
       
    92     } else {
    88     } else {
    93       // We could have re-used this old region as to-space over a
    89       // We could have re-used this old region as to-space over a
    94       // couple of GCs since the start of the concurrent marking
    90       // couple of GCs since the start of the concurrent marking
    95       // cycle. This means that [bottom,NTAMS) will contain objects
    91       // cycle. This means that [bottom,NTAMS) will contain objects
    96       // copied up to and including initial-mark and [NTAMS, top)
    92       // copied up to and including initial-mark and [NTAMS, top)
    99     }
    95     }
   100   }
    96   }
   101 }
    97 }
   102 
    98 
   103 inline void HeapRegion::note_end_of_copying(bool during_initial_mark) {
    99 inline void HeapRegion::note_end_of_copying(bool during_initial_mark) {
   104   if (during_initial_mark) {
   100   if (is_survivor()) {
   105     if (is_survivor()) {
   101     // This is how we always allocate survivors.
   106       assert(false, "should not allocate survivors during IM");
   102     assert(_next_top_at_mark_start == bottom(), "invariant");
   107     } else {
   103   } else {
       
   104     if (during_initial_mark) {
   108       // See the comment for note_start_of_copying() for the details
   105       // See the comment for note_start_of_copying() for the details
   109       // on this.
   106       // on this.
   110       assert(_next_top_at_mark_start == end(), "pre-condition");
   107       assert(_next_top_at_mark_start == end(), "pre-condition");
   111       _next_top_at_mark_start = top();
   108       _next_top_at_mark_start = top();
   112     }
       
   113   } else {
       
   114     if (is_survivor()) {
       
   115       // This is how we always allocate survivors.
       
   116       assert(_next_top_at_mark_start == bottom(), "invariant");
       
   117     } else {
   109     } else {
   118       // See the comment for note_start_of_copying() for the details
   110       // See the comment for note_start_of_copying() for the details
   119       // on this.
   111       // on this.
   120       assert(top() >= _next_top_at_mark_start, "invariant");
   112       assert(top() >= _next_top_at_mark_start, "invariant");
   121     }
   113     }