src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp
changeset 47678 c84eeb55c55e
parent 47647 64dba69fc528
child 49333 489f1dd40582
equal deleted inserted replaced
47674:1587ffa1496a 47678:c84eeb55c55e
    49   // Some callers may have stale objects to mark above nTAMS after humongous reclaim.
    49   // Some callers may have stale objects to mark above nTAMS after humongous reclaim.
    50   // Can't assert that this is a valid object at this point, since it might be in the process of being copied by another thread.
    50   // Can't assert that this is a valid object at this point, since it might be in the process of being copied by another thread.
    51   assert(!hr->is_continues_humongous(), "Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above nTAMS " PTR_FORMAT, p2i(obj), hr->hrm_index(), p2i(hr->next_top_at_mark_start()));
    51   assert(!hr->is_continues_humongous(), "Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above nTAMS " PTR_FORMAT, p2i(obj), hr->hrm_index(), p2i(hr->next_top_at_mark_start()));
    52 
    52 
    53   HeapWord* const obj_addr = (HeapWord*)obj;
    53   HeapWord* const obj_addr = (HeapWord*)obj;
    54   // Dirty read to avoid CAS.
    54 
    55   if (_nextMarkBitMap->is_marked(obj_addr)) {
    55   return _next_mark_bitmap->par_mark(obj_addr);
    56     return false;
       
    57   }
       
    58 
       
    59   return _nextMarkBitMap->par_mark(obj_addr);
       
    60 }
    56 }
    61 
    57 
    62 #ifndef PRODUCT
    58 #ifndef PRODUCT
    63 template<typename Fn>
    59 template<typename Fn>
    64 inline void G1CMMarkStack::iterate(Fn fn) const {
    60 inline void G1CMMarkStack::iterate(Fn fn) const {
    88 inline void G1CMTask::push(G1TaskQueueEntry task_entry) {
    84 inline void G1CMTask::push(G1TaskQueueEntry task_entry) {
    89   assert(task_entry.is_array_slice() || _g1h->is_in_g1_reserved(task_entry.obj()), "invariant");
    85   assert(task_entry.is_array_slice() || _g1h->is_in_g1_reserved(task_entry.obj()), "invariant");
    90   assert(task_entry.is_array_slice() || !_g1h->is_on_master_free_list(
    86   assert(task_entry.is_array_slice() || !_g1h->is_on_master_free_list(
    91               _g1h->heap_region_containing(task_entry.obj())), "invariant");
    87               _g1h->heap_region_containing(task_entry.obj())), "invariant");
    92   assert(task_entry.is_array_slice() || !_g1h->is_obj_ill(task_entry.obj()), "invariant");  // FIXME!!!
    88   assert(task_entry.is_array_slice() || !_g1h->is_obj_ill(task_entry.obj()), "invariant");  // FIXME!!!
    93   assert(task_entry.is_array_slice() || _nextMarkBitMap->is_marked((HeapWord*)task_entry.obj()), "invariant");
    89   assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked((HeapWord*)task_entry.obj()), "invariant");
    94 
    90 
    95   if (!_task_queue->push(task_entry)) {
    91   if (!_task_queue->push(task_entry)) {
    96     // The local task queue looks full. We need to push some entries
    92     // The local task queue looks full. We need to push some entries
    97     // to the global stack.
    93     // to the global stack.
    98     move_entries_to_global_stack();
    94     move_entries_to_global_stack();
   136 }
   132 }
   137 
   133 
   138 template<bool scan>
   134 template<bool scan>
   139 inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry) {
   135 inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry) {
   140   assert(scan || (task_entry.is_oop() && task_entry.obj()->is_typeArray()), "Skipping scan of grey non-typeArray");
   136   assert(scan || (task_entry.is_oop() && task_entry.obj()->is_typeArray()), "Skipping scan of grey non-typeArray");
   141   assert(task_entry.is_array_slice() || _nextMarkBitMap->is_marked((HeapWord*)task_entry.obj()),
   137   assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked((HeapWord*)task_entry.obj()),
   142          "Any stolen object should be a slice or marked");
   138          "Any stolen object should be a slice or marked");
   143 
   139 
   144   if (scan) {
   140   if (scan) {
   145     if (task_entry.is_array_slice()) {
   141     if (task_entry.is_array_slice()) {
   146       _words_scanned += _objArray_processor.process_slice(task_entry.slice());
   142       _words_scanned += _objArray_processor.process_slice(task_entry.slice());
   209     return;
   205     return;
   210   }
   206   }
   211   make_reference_grey(obj);
   207   make_reference_grey(obj);
   212 }
   208 }
   213 
   209 
   214 inline void G1ConcurrentMark::markPrev(oop p) {
   210 inline void G1ConcurrentMark::mark_in_prev_bitmap(oop p) {
   215   assert(!_prevMarkBitMap->is_marked((HeapWord*) p), "sanity");
   211   assert(!_prev_mark_bitmap->is_marked((HeapWord*) p), "sanity");
   216  _prevMarkBitMap->mark((HeapWord*) p);
   212  _prev_mark_bitmap->mark((HeapWord*) p);
   217 }
   213 }
   218 
   214 
   219 bool G1ConcurrentMark::isPrevMarked(oop p) const {
   215 bool G1ConcurrentMark::is_marked_in_prev_bitmap(oop p) const {
   220   assert(p != NULL && oopDesc::is_oop(p), "expected an oop");
   216   assert(p != NULL && oopDesc::is_oop(p), "expected an oop");
   221   return _prevMarkBitMap->is_marked((HeapWord*)p);
   217   return _prev_mark_bitmap->is_marked((HeapWord*)p);
   222 }
   218 }
   223 
   219 
   224 inline bool G1ConcurrentMark::do_yield_check() {
   220 inline bool G1ConcurrentMark::do_yield_check() {
   225   if (SuspendibleThreadSet::should_yield()) {
   221   if (SuspendibleThreadSet::should_yield()) {
   226     SuspendibleThreadSet::yield();
   222     SuspendibleThreadSet::yield();