src/hotspot/share/gc/serial/markSweep.cpp
changeset 57777 90ead0febf56
parent 54786 ebf733a324d4
child 58015 dd84de796f2c
equal deleted inserted replaced
57774:21dccfac0ec5 57777:90ead0febf56
    47 
    47 
    48 Stack<oop, mtGC>              MarkSweep::_marking_stack;
    48 Stack<oop, mtGC>              MarkSweep::_marking_stack;
    49 Stack<ObjArrayTask, mtGC>     MarkSweep::_objarray_stack;
    49 Stack<ObjArrayTask, mtGC>     MarkSweep::_objarray_stack;
    50 
    50 
    51 Stack<oop, mtGC>              MarkSweep::_preserved_oop_stack;
    51 Stack<oop, mtGC>              MarkSweep::_preserved_oop_stack;
    52 Stack<markOop, mtGC>          MarkSweep::_preserved_mark_stack;
    52 Stack<markWord, mtGC>         MarkSweep::_preserved_mark_stack;
    53 size_t                  MarkSweep::_preserved_count = 0;
    53 size_t                  MarkSweep::_preserved_count = 0;
    54 size_t                  MarkSweep::_preserved_count_max = 0;
    54 size_t                  MarkSweep::_preserved_count_max = 0;
    55 PreservedMark*          MarkSweep::_preserved_marks = NULL;
    55 PreservedMark*          MarkSweep::_preserved_marks = NULL;
    56 ReferenceProcessor*     MarkSweep::_ref_processor   = NULL;
    56 ReferenceProcessor*     MarkSweep::_ref_processor   = NULL;
    57 STWGCTimer*             MarkSweep::_gc_timer        = NULL;
    57 STWGCTimer*             MarkSweep::_gc_timer        = NULL;
   130   assert(!Universe::heap()->is_in_reserved(p),
   130   assert(!Universe::heap()->is_in_reserved(p),
   131          "roots shouldn't be things within the heap");
   131          "roots shouldn't be things within the heap");
   132   T heap_oop = RawAccess<>::oop_load(p);
   132   T heap_oop = RawAccess<>::oop_load(p);
   133   if (!CompressedOops::is_null(heap_oop)) {
   133   if (!CompressedOops::is_null(heap_oop)) {
   134     oop obj = CompressedOops::decode_not_null(heap_oop);
   134     oop obj = CompressedOops::decode_not_null(heap_oop);
   135     if (!obj->mark_raw()->is_marked()) {
   135     if (!obj->mark_raw().is_marked()) {
   136       mark_object(obj);
   136       mark_object(obj);
   137       follow_object(obj);
   137       follow_object(obj);
   138     }
   138     }
   139   }
   139   }
   140   follow_stack();
   140   follow_stack();
   150 void PreservedMark::restore() {
   150 void PreservedMark::restore() {
   151   _obj->set_mark_raw(_mark);
   151   _obj->set_mark_raw(_mark);
   152 }
   152 }
   153 
   153 
   154 // We preserve the mark which should be replaced at the end and the location
   154 // We preserve the mark which should be replaced at the end and the location
   155 // that it will go.  Note that the object that this markOop belongs to isn't
   155 // that it will go.  Note that the object that this markWord belongs to isn't
   156 // currently at that address but it will be after phase4
   156 // currently at that address but it will be after phase4
   157 void MarkSweep::preserve_mark(oop obj, markOop mark) {
   157 void MarkSweep::preserve_mark(oop obj, markWord mark) {
   158   // We try to store preserved marks in the to space of the new generation since
   158   // We try to store preserved marks in the to space of the new generation since
   159   // this is storage which should be available.  Most of the time this should be
   159   // this is storage which should be available.  Most of the time this should be
   160   // sufficient space for the marks we need to preserve but if it isn't we fall
   160   // sufficient space for the marks we need to preserve but if it isn't we fall
   161   // back to using Stacks to keep track of the overflow.
   161   // back to using Stacks to keep track of the overflow.
   162   if (_preserved_count < _preserved_count_max) {
   162   if (_preserved_count < _preserved_count_max) {
   202   }
   202   }
   203 
   203 
   204   // deal with the overflow
   204   // deal with the overflow
   205   while (!_preserved_oop_stack.is_empty()) {
   205   while (!_preserved_oop_stack.is_empty()) {
   206     oop obj       = _preserved_oop_stack.pop();
   206     oop obj       = _preserved_oop_stack.pop();
   207     markOop mark  = _preserved_mark_stack.pop();
   207     markWord mark = _preserved_mark_stack.pop();
   208     obj->set_mark_raw(mark);
   208     obj->set_mark_raw(mark);
   209   }
   209   }
   210 }
   210 }
   211 
   211 
   212 MarkSweep::IsAliveClosure   MarkSweep::is_alive;
   212 MarkSweep::IsAliveClosure   MarkSweep::is_alive;