1 /*
   2  * Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
  26 
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
  29 #include "gc/shared/suspendibleThreadSet.hpp"
  30 #include "gc/shenandoah/markBitMap.inline.hpp"
  31 #include "gc/shenandoah/shenandoahAsserts.hpp"
  32 #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
  33 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
  34 #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp"
  35 #include "gc/shenandoah/shenandoahForwarding.inline.hpp"
  36 #include "gc/shenandoah/shenandoahWorkGroup.hpp"
  37 #include "gc/shenandoah/shenandoahHeap.hpp"
  38 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp"
  39 #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
  40 #include "gc/shenandoah/shenandoahControlThread.hpp"
  41 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
  42 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  43 #include "oops/oop.inline.hpp"
  44 #include "runtime/atomic.hpp"
  45 #include "runtime/interfaceSupport.inline.hpp"
  46 #include "runtime/prefetch.hpp"
  47 #include "runtime/prefetch.inline.hpp"
  48 #include "runtime/thread.hpp"
  49 #include "utilities/copy.hpp"
  50 #include "utilities/globalDefinitions.hpp"
  51 
  52 inline ShenandoahHeap* ShenandoahHeap::heap() {
  53   assert(_heap != NULL, "Heap is not initialized yet");
  54   return _heap;
  55 }
  56 
  57 inline ShenandoahHeapRegion* ShenandoahRegionIterator::next() {
  58   size_t new_index = Atomic::add((size_t) 1, &_index);
  59   // get_region() provides the bounds-check and returns NULL on OOB.
  60   return _heap->get_region(new_index - 1);
  61 }
  62 
  63 inline bool ShenandoahHeap::has_forwarded_objects() const {
  64   return _gc_state.is_set(HAS_FORWARDED);
  65 }
  66 
  67 inline WorkGang* ShenandoahHeap::workers() const {
  68   return _workers;
  69 }
  70 
  71 inline WorkGang* ShenandoahHeap::get_safepoint_workers() {
  72   return _safepoint_workers;
  73 }
  74 
  75 inline size_t ShenandoahHeap::heap_region_index_containing(const void* addr) const {
  76   uintptr_t region_start = ((uintptr_t) addr);
  77   uintptr_t index = (region_start - (uintptr_t) base()) >> ShenandoahHeapRegion::region_size_bytes_shift();
  78   assert(index < num_regions(), "Region index is in bounds: " PTR_FORMAT, p2i(addr));
  79   return index;
  80 }
  81 
  82 inline ShenandoahHeapRegion* const ShenandoahHeap::heap_region_containing(const void* addr) const {
  83   size_t index = heap_region_index_containing(addr);
  84   ShenandoahHeapRegion* const result = get_region(index);
  85   assert(addr >= result->bottom() && addr < result->end(), "Heap region contains the address: " PTR_FORMAT, p2i(addr));
  86   return result;
  87 }
  88 
  89 template <class T>
  90 inline oop ShenandoahHeap::update_with_forwarded_not_null(T* p, oop obj) {
  91   if (in_collection_set(obj)) {
  92     shenandoah_assert_forwarded_except(p, obj, is_full_gc_in_progress() || cancelled_gc() || is_degenerated_gc_in_progress());
  93     obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  94     RawAccess<IS_NOT_NULL>::oop_store(p, obj);
  95   }
  96 #ifdef ASSERT
  97   else {
  98     shenandoah_assert_not_forwarded(p, obj);
  99   }
 100 #endif
 101   return obj;
 102 }
 103 
 104 template <class T>
 105 inline oop ShenandoahHeap::maybe_update_with_forwarded(T* p) {
 106   T o = RawAccess<>::oop_load(p);
 107   if (!CompressedOops::is_null(o)) {
 108     oop obj = CompressedOops::decode_not_null(o);
 109     return maybe_update_with_forwarded_not_null(p, obj);
 110   } else {
 111     return NULL;
 112   }
 113 }
 114 
 115 template <class T>
 116 inline oop ShenandoahHeap::evac_update_with_forwarded(T* p) {
 117   T o = RawAccess<>::oop_load(p);
 118   if (!CompressedOops::is_null(o)) {
 119     oop heap_oop = CompressedOops::decode_not_null(o);
 120     if (in_collection_set(heap_oop)) {
 121       oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop);
 122       if (forwarded_oop == heap_oop) {
 123         forwarded_oop = evacuate_object(heap_oop, Thread::current());
 124       }
 125       oop prev = cas_oop(forwarded_oop, p, heap_oop);
 126       if (prev == heap_oop) {
 127         return forwarded_oop;
 128       } else {
 129         return NULL;
 130       }
 131     }
 132     return heap_oop;
 133   } else {
 134     return NULL;
 135   }
 136 }
 137 
 138 inline oop ShenandoahHeap::cas_oop(oop n, oop* addr, oop c) {
 139   assert(is_aligned(addr, HeapWordSize), "Address should be aligned: " PTR_FORMAT, p2i(addr));
 140   return (oop) Atomic::cmpxchg(n, addr, c);
 141 }
 142 
 143 inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, narrowOop c) {
 144   narrowOop val = CompressedOops::encode(n);
 145   return CompressedOops::decode((narrowOop) Atomic::cmpxchg(val, addr, c));
 146 }
 147 
 148 inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, oop c) {
 149   assert(is_aligned(addr, sizeof(narrowOop)), "Address should be aligned: " PTR_FORMAT, p2i(addr));
 150   narrowOop cmp = CompressedOops::encode(c);
 151   narrowOop val = CompressedOops::encode(n);
 152   return CompressedOops::decode((narrowOop) Atomic::cmpxchg(val, addr, cmp));
 153 }
 154 
 155 template <class T>
 156 inline oop ShenandoahHeap::maybe_update_with_forwarded_not_null(T* p, oop heap_oop) {
 157   shenandoah_assert_not_in_cset_loc_except(p, !is_in(p) || is_full_gc_in_progress() || is_degenerated_gc_in_progress());
 158   shenandoah_assert_correct(p, heap_oop);
 159 
 160   if (in_collection_set(heap_oop)) {
 161     oop forwarded_oop = ShenandoahBarrierSet::resolve_forwarded_not_null(heap_oop);
 162     if (forwarded_oop == heap_oop) {
 163       // E.g. during evacuation.
 164       return forwarded_oop;
 165     }
 166 
 167     shenandoah_assert_forwarded_except(p, heap_oop, is_full_gc_in_progress() || is_degenerated_gc_in_progress());
 168     shenandoah_assert_not_forwarded(p, forwarded_oop);
 169     shenandoah_assert_not_in_cset_except(p, forwarded_oop, cancelled_gc());
 170 
 171     // If this fails, another thread wrote to p before us, it will be logged in SATB and the
 172     // reference be updated later.
 173     oop witness = cas_oop(forwarded_oop, p, heap_oop);
 174 
 175     if (witness != heap_oop) {
 176       // CAS failed, someone had beat us to it. Normally, we would return the failure witness,
 177       // because that would be the proper write of to-space object, enforced by strong barriers.
 178       // However, there is a corner case with arraycopy. It can happen that a Java thread
 179       // beats us with an arraycopy, which first copies the array, which potentially contains
 180       // from-space refs, and only afterwards updates all from-space refs to to-space refs,
 181       // which leaves a short window where the new array elements can be from-space.
 182       // In this case, we can just resolve the result again. As we resolve, we need to consider
 183       // the contended write might have been NULL.
 184       oop result = ShenandoahBarrierSet::resolve_forwarded(witness);
 185       shenandoah_assert_not_forwarded_except(p, result, (result == NULL));
 186       shenandoah_assert_not_in_cset_except(p, result, (result == NULL) || cancelled_gc());
 187       return result;
 188     } else {
 189       // Success! We have updated with known to-space copy. We have already asserted it is sane.
 190       return forwarded_oop;
 191     }
 192   } else {
 193     shenandoah_assert_not_forwarded(p, heap_oop);
 194     return heap_oop;
 195   }
 196 }
 197 
 198 inline bool ShenandoahHeap::cancelled_gc() const {
 199   return _cancelled_gc.get() == CANCELLED;
 200 }
 201 
 202 inline bool ShenandoahHeap::check_cancelled_gc_and_yield(bool sts_active) {
 203   if (! (sts_active && ShenandoahSuspendibleWorkers)) {
 204     return cancelled_gc();
 205   }
 206 
 207   jbyte prev = _cancelled_gc.cmpxchg(NOT_CANCELLED, CANCELLABLE);
 208   if (prev == CANCELLABLE || prev == NOT_CANCELLED) {
 209     if (SuspendibleThreadSet::should_yield()) {
 210       SuspendibleThreadSet::yield();
 211     }
 212 
 213     // Back to CANCELLABLE. The thread that poked NOT_CANCELLED first gets
 214     // to restore to CANCELLABLE.
 215     if (prev == CANCELLABLE) {
 216       _cancelled_gc.set(CANCELLABLE);
 217     }
 218     return false;
 219   } else {
 220     return true;
 221   }
 222 }
 223 
 224 inline bool ShenandoahHeap::try_cancel_gc() {
 225   while (true) {
 226     jbyte prev = _cancelled_gc.cmpxchg(CANCELLED, CANCELLABLE);
 227     if (prev == CANCELLABLE) return true;
 228     else if (prev == CANCELLED) return false;
 229     assert(ShenandoahSuspendibleWorkers, "should not get here when not using suspendible workers");
 230     assert(prev == NOT_CANCELLED, "must be NOT_CANCELLED");
 231     if (Thread::current()->is_Java_thread()) {
 232       // We need to provide a safepoint here, otherwise we might
 233       // spin forever if a SP is pending.
 234       ThreadBlockInVM sp(JavaThread::current());
 235       SpinPause();
 236     }
 237   }
 238 }
 239 
 240 inline void ShenandoahHeap::clear_cancelled_gc() {
 241   _cancelled_gc.set(CANCELLABLE);
 242   _oom_evac_handler.clear();
 243 }
 244 
 245 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {
 246   assert(UseTLAB, "TLABs should be enabled");
 247 
 248   PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
 249   if (gclab == NULL) {
 250     assert(!thread->is_Java_thread() && !thread->is_Worker_thread(),
 251            "Performance: thread should have GCLAB: %s", thread->name());
 252     // No GCLABs in this thread, fallback to shared allocation
 253     return NULL;
 254   }
 255   HeapWord* obj = gclab->allocate(size);
 256   if (obj != NULL) {
 257     return obj;
 258   }
 259   // Otherwise...
 260   return allocate_from_gclab_slow(thread, size);
 261 }
 262 
 263 inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
 264   if (ShenandoahThreadLocalData::is_oom_during_evac(Thread::current())) {
 265     // This thread went through the OOM during evac protocol and it is safe to return
 266     // the forward pointer. It must not attempt to evacuate any more.
 267     return ShenandoahBarrierSet::resolve_forwarded(p);
 268   }
 269 
 270   assert(ShenandoahThreadLocalData::is_evac_allowed(thread), "must be enclosed in oom-evac scope");
 271 
 272   size_t size = p->size();
 273 
 274   assert(!heap_region_containing(p)->is_humongous(), "never evacuate humongous objects");
 275 
 276   bool alloc_from_gclab = true;
 277   HeapWord* copy = NULL;
 278 
 279 #ifdef ASSERT
 280   if (ShenandoahOOMDuringEvacALot &&
 281       (os::random() & 1) == 0) { // Simulate OOM every ~2nd slow-path call
 282         copy = NULL;
 283   } else {
 284 #endif
 285     if (UseTLAB) {
 286       copy = allocate_from_gclab(thread, size);
 287     }
 288     if (copy == NULL) {
 289       ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(size);
 290       copy = allocate_memory(req);
 291       alloc_from_gclab = false;
 292     }
 293 #ifdef ASSERT
 294   }
 295 #endif
 296 
 297   if (copy == NULL) {
 298     control_thread()->handle_alloc_failure_evac(size);
 299 
 300     _oom_evac_handler.handle_out_of_memory_during_evacuation();
 301 
 302     return ShenandoahBarrierSet::resolve_forwarded(p);
 303   }
 304 
 305   // Copy the object:
 306   Copy::aligned_disjoint_words((HeapWord*) p, copy, size);
 307 
 308   // Try to install the new forwarding pointer.
 309   oop copy_val = oop(copy);
 310   oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val);
 311   if (result == copy_val) {
 312     // Successfully evacuated. Our copy is now the public one!
 313     shenandoah_assert_correct(NULL, copy_val);
 314     return copy_val;
 315   }  else {
 316     // Failed to evacuate. We need to deal with the object that is left behind. Since this
 317     // new allocation is certainly after TAMS, it will be considered live in the next cycle.
 318     // But if it happens to contain references to evacuated regions, those references would
 319     // not get updated for this stale copy during this cycle, and we will crash while scanning
 320     // it the next cycle.
 321     //
 322     // For GCLAB allocations, it is enough to rollback the allocation ptr. Either the next
 323     // object will overwrite this stale copy, or the filler object on LAB retirement will
 324     // do this. For non-GCLAB allocations, we have no way to retract the allocation, and
 325     // have to explicitly overwrite the copy with the filler object. With that overwrite,
 326     // we have to keep the fwdptr initialized and pointing to our (stale) copy.
 327     if (alloc_from_gclab) {
 328       ShenandoahThreadLocalData::gclab(thread)->undo_allocation(copy, size);
 329     } else {
 330       fill_with_object(copy, size);
 331       shenandoah_assert_correct(NULL, copy_val);
 332     }
 333     shenandoah_assert_correct(NULL, result);
 334     return result;
 335   }
 336 }
 337 
 338 inline bool ShenandoahHeap::requires_marking(const void* entry) const {
 339   return !_marking_context->is_marked(oop(entry));
 340 }
 341 
 342 inline bool ShenandoahHeap::in_collection_set(oop p) const {
 343   assert(collection_set() != NULL, "Sanity");
 344   return collection_set()->is_in(p);
 345 }
 346 
 347 inline bool ShenandoahHeap::in_collection_set_loc(void* p) const {
 348   assert(collection_set() != NULL, "Sanity");
 349   return collection_set()->is_in_loc(p);
 350 }
 351 
 352 inline bool ShenandoahHeap::is_stable() const {
 353   return _gc_state.is_clear();
 354 }
 355 
 356 inline bool ShenandoahHeap::is_idle() const {
 357   return _gc_state.is_unset(MARKING | EVACUATION | UPDATEREFS);
 358 }
 359 
 360 inline bool ShenandoahHeap::is_concurrent_mark_in_progress() const {
 361   return _gc_state.is_set(MARKING);
 362 }
 363 
 364 inline bool ShenandoahHeap::is_evacuation_in_progress() const {
 365   return _gc_state.is_set(EVACUATION);
 366 }
 367 
 368 inline bool ShenandoahHeap::is_gc_in_progress_mask(uint mask) const {
 369   return _gc_state.is_set(mask);
 370 }
 371 
 372 inline bool ShenandoahHeap::is_degenerated_gc_in_progress() const {
 373   return _degenerated_gc_in_progress.is_set();
 374 }
 375 
 376 inline bool ShenandoahHeap::is_full_gc_in_progress() const {
 377   return _full_gc_in_progress.is_set();
 378 }
 379 
 380 inline bool ShenandoahHeap::is_full_gc_move_in_progress() const {
 381   return _full_gc_move_in_progress.is_set();
 382 }
 383 
 384 inline bool ShenandoahHeap::is_update_refs_in_progress() const {
 385   return _gc_state.is_set(UPDATEREFS);
 386 }
 387 
 388 template<class T>
 389 inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl) {
 390   marked_object_iterate(region, cl, region->top());
 391 }
 392 
 393 template<class T>
 394 inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit) {
 395   assert(! region->is_humongous_continuation(), "no humongous continuation regions here");
 396 
 397   ShenandoahMarkingContext* const ctx = complete_marking_context();
 398   assert(ctx->is_complete(), "sanity");
 399 
 400   MarkBitMap* mark_bit_map = ctx->mark_bit_map();
 401   HeapWord* tams = ctx->top_at_mark_start(region);
 402 
 403   size_t skip_bitmap_delta = 1;
 404   HeapWord* start = region->bottom();
 405   HeapWord* end = MIN2(tams, region->end());
 406 
 407   // Step 1. Scan below the TAMS based on bitmap data.
 408   HeapWord* limit_bitmap = MIN2(limit, tams);
 409 
 410   // Try to scan the initial candidate. If the candidate is above the TAMS, it would
 411   // fail the subsequent "< limit_bitmap" checks, and fall through to Step 2.
 412   HeapWord* cb = mark_bit_map->getNextMarkedWordAddress(start, end);
 413 
 414   intx dist = ShenandoahMarkScanPrefetch;
 415   if (dist > 0) {
 416     // Batched scan that prefetches the oop data, anticipating the access to
 417     // either header, oop field, or forwarding pointer. Not that we cannot
 418     // touch anything in oop, while it still being prefetched to get enough
 419     // time for prefetch to work. This is why we try to scan the bitmap linearly,
 420     // disregarding the object size. However, since we know forwarding pointer
 421     // preceeds the object, we can skip over it. Once we cannot trust the bitmap,
 422     // there is no point for prefetching the oop contents, as oop->size() will
 423     // touch it prematurely.
 424 
 425     // No variable-length arrays in standard C++, have enough slots to fit
 426     // the prefetch distance.
 427     static const int SLOT_COUNT = 256;
 428     guarantee(dist <= SLOT_COUNT, "adjust slot count");
 429     HeapWord* slots[SLOT_COUNT];
 430 
 431     int avail;
 432     do {
 433       avail = 0;
 434       for (int c = 0; (c < dist) && (cb < limit_bitmap); c++) {
 435         Prefetch::read(cb, oopDesc::mark_offset_in_bytes());
 436         slots[avail++] = cb;
 437         cb += skip_bitmap_delta;
 438         if (cb < limit_bitmap) {
 439           cb = mark_bit_map->getNextMarkedWordAddress(cb, limit_bitmap);
 440         }
 441       }
 442 
 443       for (int c = 0; c < avail; c++) {
 444         assert (slots[c] < tams,  "only objects below TAMS here: "  PTR_FORMAT " (" PTR_FORMAT ")", p2i(slots[c]), p2i(tams));
 445         assert (slots[c] < limit, "only objects below limit here: " PTR_FORMAT " (" PTR_FORMAT ")", p2i(slots[c]), p2i(limit));
 446         oop obj = oop(slots[c]);
 447         assert(oopDesc::is_oop(obj), "sanity");
 448         assert(ctx->is_marked(obj), "object expected to be marked");
 449         cl->do_object(obj);
 450       }
 451     } while (avail > 0);
 452   } else {
 453     while (cb < limit_bitmap) {
 454       assert (cb < tams,  "only objects below TAMS here: "  PTR_FORMAT " (" PTR_FORMAT ")", p2i(cb), p2i(tams));
 455       assert (cb < limit, "only objects below limit here: " PTR_FORMAT " (" PTR_FORMAT ")", p2i(cb), p2i(limit));
 456       oop obj = oop(cb);
 457       assert(oopDesc::is_oop(obj), "sanity");
 458       assert(ctx->is_marked(obj), "object expected to be marked");
 459       cl->do_object(obj);
 460       cb += skip_bitmap_delta;
 461       if (cb < limit_bitmap) {
 462         cb = mark_bit_map->getNextMarkedWordAddress(cb, limit_bitmap);
 463       }
 464     }
 465   }
 466 
 467   // Step 2. Accurate size-based traversal, happens past the TAMS.
 468   // This restarts the scan at TAMS, which makes sure we traverse all objects,
 469   // regardless of what happened at Step 1.
 470   HeapWord* cs = tams;
 471   while (cs < limit) {
 472     assert (cs >= tams, "only objects past TAMS here: "   PTR_FORMAT " (" PTR_FORMAT ")", p2i(cs), p2i(tams));
 473     assert (cs < limit, "only objects below limit here: " PTR_FORMAT " (" PTR_FORMAT ")", p2i(cs), p2i(limit));
 474     oop obj = oop(cs);
 475     assert(oopDesc::is_oop(obj), "sanity");
 476     assert(ctx->is_marked(obj), "object expected to be marked");
 477     int size = obj->size();
 478     cl->do_object(obj);
 479     cs += size;
 480   }
 481 }
 482 
 483 template <class T>
 484 class ShenandoahObjectToOopClosure : public ObjectClosure {
 485   T* _cl;
 486 public:
 487   ShenandoahObjectToOopClosure(T* cl) : _cl(cl) {}
 488 
 489   void do_object(oop obj) {
 490     obj->oop_iterate(_cl);
 491   }
 492 };
 493 
 494 template <class T>
 495 class ShenandoahObjectToOopBoundedClosure : public ObjectClosure {
 496   T* _cl;
 497   MemRegion _bounds;
 498 public:
 499   ShenandoahObjectToOopBoundedClosure(T* cl, HeapWord* bottom, HeapWord* top) :
 500     _cl(cl), _bounds(bottom, top) {}
 501 
 502   void do_object(oop obj) {
 503     obj->oop_iterate(_cl, _bounds);
 504   }
 505 };
 506 
 507 template<class T>
 508 inline void ShenandoahHeap::marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* top) {
 509   if (region->is_humongous()) {
 510     HeapWord* bottom = region->bottom();
 511     if (top > bottom) {
 512       region = region->humongous_start_region();
 513       ShenandoahObjectToOopBoundedClosure<T> objs(cl, bottom, top);
 514       marked_object_iterate(region, &objs);
 515     }
 516   } else {
 517     ShenandoahObjectToOopClosure<T> objs(cl);
 518     marked_object_iterate(region, &objs, top);
 519   }
 520 }
 521 
 522 inline ShenandoahHeapRegion* const ShenandoahHeap::get_region(size_t region_idx) const {
 523   if (region_idx < _num_regions) {
 524     return _regions[region_idx];
 525   } else {
 526     return NULL;
 527   }
 528 }
 529 
 530 inline void ShenandoahHeap::mark_complete_marking_context() {
 531   _marking_context->mark_complete();
 532 }
 533 
 534 inline void ShenandoahHeap::mark_incomplete_marking_context() {
 535   _marking_context->mark_incomplete();
 536 }
 537 
 538 inline ShenandoahMarkingContext* ShenandoahHeap::complete_marking_context() const {
 539   assert (_marking_context->is_complete()," sanity");
 540   return _marking_context;
 541 }
 542 
 543 inline ShenandoahMarkingContext* ShenandoahHeap::marking_context() const {
 544   return _marking_context;
 545 }
 546 
 547 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP