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