< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp

Print this page

  1 /*
  2  * Copyright (c) 2015, 2020, 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  *

 25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
 26 #define SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
 27 
 28 #include "gc/shenandoah/shenandoahHeap.hpp"
 29 
 30 #include "classfile/javaClasses.inline.hpp"
 31 #include "gc/shared/markBitMap.inline.hpp"
 32 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
 33 #include "gc/shared/continuationGCSupport.inline.hpp"
 34 #include "gc/shared/suspendibleThreadSet.hpp"
 35 #include "gc/shared/tlab_globals.hpp"
 36 #include "gc/shenandoah/shenandoahAsserts.hpp"
 37 #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
 38 #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp"
 39 #include "gc/shenandoah/shenandoahForwarding.inline.hpp"
 40 #include "gc/shenandoah/shenandoahWorkGroup.hpp"
 41 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp"
 42 #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
 43 #include "gc/shenandoah/shenandoahControlThread.hpp"
 44 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"

 45 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"


 46 #include "oops/compressedOops.inline.hpp"
 47 #include "oops/oop.inline.hpp"
 48 #include "runtime/atomic.hpp"
 49 #include "runtime/javaThread.hpp"
 50 #include "runtime/prefetch.inline.hpp"

 51 #include "utilities/copy.hpp"
 52 #include "utilities/globalDefinitions.hpp"
 53 
 54 inline ShenandoahHeap* ShenandoahHeap::heap() {
 55   return named_heap<ShenandoahHeap>(CollectedHeap::Shenandoah);
 56 }
 57 
 58 inline ShenandoahHeapRegion* ShenandoahRegionIterator::next() {
 59   size_t new_index = Atomic::add(&_index, (size_t) 1, memory_order_relaxed);
 60   // get_region() provides the bounds-check and returns null on OOB.
 61   return _heap->get_region(new_index - 1);
 62 }
 63 
 64 inline bool ShenandoahHeap::has_forwarded_objects() const {
 65   return _gc_state.is_set(HAS_FORWARDED);
 66 }
 67 
 68 inline WorkerThreads* ShenandoahHeap::workers() const {
 69   return _workers;
 70 }
 71 
 72 inline WorkerThreads* ShenandoahHeap::safepoint_workers() {
 73   return _safepoint_workers;
 74 }
 75 
 76 inline size_t ShenandoahHeap::heap_region_index_containing(const void* addr) const {
 77   uintptr_t region_start = ((uintptr_t) addr);
 78   uintptr_t index = (region_start - (uintptr_t) base()) >> ShenandoahHeapRegion::region_size_bytes_shift();
 79   assert(index < num_regions(), "Region index is in bounds: " PTR_FORMAT, p2i(addr));
 80   return index;
 81 }
 82 
 83 inline ShenandoahHeapRegion* const ShenandoahHeap::heap_region_containing(const void* addr) const {
 84   size_t index = heap_region_index_containing(addr);
 85   ShenandoahHeapRegion* const result = get_region(index);
 86   assert(addr >= result->bottom() && addr < result->end(), "Heap region contains the address: " PTR_FORMAT, p2i(addr));
 87   return result;
 88 }
 89 
 90 inline void ShenandoahHeap::enter_evacuation(Thread* t) {
 91   _oom_evac_handler.enter_evacuation(t);
 92 }
 93 
 94 inline void ShenandoahHeap::leave_evacuation(Thread* t) {
 95   _oom_evac_handler.leave_evacuation(t);
 96 }
 97 
 98 template <class T>
 99 inline void ShenandoahHeap::update_with_forwarded(T* p) {
100   T o = RawAccess<>::oop_load(p);
101   if (!CompressedOops::is_null(o)) {
102     oop obj = CompressedOops::decode_not_null(o);
103     if (in_collection_set(obj)) {

235 }
236 
237 inline void ShenandoahHeap::atomic_clear_oop(narrowOop* addr, narrowOop compare) {
238   assert(is_aligned(addr, sizeof(narrowOop)), "Address should be aligned: " PTR_FORMAT, p2i(addr));
239   Atomic::cmpxchg(addr, compare, narrowOop(), memory_order_relaxed);
240 }
241 
242 inline bool ShenandoahHeap::cancelled_gc() const {
243   return _cancelled_gc.get() == CANCELLED;
244 }
245 
246 inline bool ShenandoahHeap::check_cancelled_gc_and_yield(bool sts_active) {
247   if (sts_active && !cancelled_gc()) {
248     if (SuspendibleThreadSet::should_yield()) {
249       SuspendibleThreadSet::yield();
250     }
251   }
252   return cancelled_gc();
253 }
254 
255 inline void ShenandoahHeap::clear_cancelled_gc() {
256   _cancelled_gc.set(CANCELLABLE);
257   _oom_evac_handler.clear();








258 }
259 
260 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {
261   assert(UseTLAB, "TLABs should be enabled");
262 
263   PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
264   if (gclab == nullptr) {
265     assert(!thread->is_Java_thread() && !thread->is_Worker_thread(),
266            "Performance: thread should have GCLAB: %s", thread->name());
267     // No GCLABs in this thread, fallback to shared allocation
268     return nullptr;
269   }
270   HeapWord* obj = gclab->allocate(size);
271   if (obj != nullptr) {
272     return obj;
273   }
274   // Otherwise...
275   return allocate_from_gclab_slow(thread, size);
276 }
277 






































278 inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
279   if (ShenandoahThreadLocalData::is_oom_during_evac(Thread::current())) {

280     // This thread went through the OOM during evac protocol and it is safe to return
281     // the forward pointer. It must not attempt to evacuate any more.
282     return ShenandoahBarrierSet::resolve_forwarded(p);
283   }
284 
285   assert(ShenandoahThreadLocalData::is_evac_allowed(thread), "must be enclosed in oom-evac scope");
286 
287   size_t size = p->size();

288 
289   assert(!heap_region_containing(p)->is_humongous(), "never evacuate humongous objects");




















290 
291   bool alloc_from_gclab = true;





292   HeapWord* copy = nullptr;


293 
294 #ifdef ASSERT
295   if (ShenandoahOOMDuringEvacALot &&
296       (os::random() & 1) == 0) { // Simulate OOM every ~2nd slow-path call
297         copy = nullptr;
298   } else {
299 #endif
300     if (UseTLAB) {
301       copy = allocate_from_gclab(thread, size);












































302     }

303     if (copy == nullptr) {
304       ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(size);
305       copy = allocate_memory(req);
306       alloc_from_gclab = false;







307     }
308 #ifdef ASSERT
309   }
310 #endif
311 
312   if (copy == nullptr) {













313     control_thread()->handle_alloc_failure_evac(size);
314 
315     _oom_evac_handler.handle_out_of_memory_during_evacuation();
316 
317     return ShenandoahBarrierSet::resolve_forwarded(p);
318   }
319 
320   // Copy the object:

321   Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(p), copy, size);
322 
323   // Try to install the new forwarding pointer.
324   oop copy_val = cast_to_oop(copy);






325   ContinuationGCSupport::relativize_stack_chunk(copy_val);
326 
327   oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val);
328   if (result == copy_val) {
329     // Successfully evacuated. Our copy is now the public one!















330     shenandoah_assert_correct(nullptr, copy_val);
331     return copy_val;
332   }  else {
333     // Failed to evacuate. We need to deal with the object that is left behind. Since this
334     // new allocation is certainly after TAMS, it will be considered live in the next cycle.
335     // But if it happens to contain references to evacuated regions, those references would
336     // not get updated for this stale copy during this cycle, and we will crash while scanning
337     // it the next cycle.
338     //
339     // For GCLAB allocations, it is enough to rollback the allocation ptr. Either the next
340     // object will overwrite this stale copy, or the filler object on LAB retirement will
341     // do this. For non-GCLAB allocations, we have no way to retract the allocation, and
342     // have to explicitly overwrite the copy with the filler object. With that overwrite,
343     // we have to keep the fwdptr initialized and pointing to our (stale) copy.
344     if (alloc_from_gclab) {
345       ShenandoahThreadLocalData::gclab(thread)->undo_allocation(copy, size);















346     } else {




347       fill_with_object(copy, size);
348       shenandoah_assert_correct(nullptr, copy_val);

349     }
350     shenandoah_assert_correct(nullptr, result);
351     return result;
352   }
353 }
354 












































































































































355 inline bool ShenandoahHeap::requires_marking(const void* entry) const {
356   oop obj = cast_to_oop(entry);
357   return !_marking_context->is_marked_strong(obj);
358 }
359 
360 inline bool ShenandoahHeap::in_collection_set(oop p) const {
361   assert(collection_set() != nullptr, "Sanity");
362   return collection_set()->is_in(p);
363 }
364 
365 inline bool ShenandoahHeap::in_collection_set_loc(void* p) const {
366   assert(collection_set() != nullptr, "Sanity");
367   return collection_set()->is_in_loc(p);
368 }
369 

370 inline bool ShenandoahHeap::is_stable() const {
371   return _gc_state.is_clear();
372 }
373 




374 inline bool ShenandoahHeap::is_idle() const {
375   return _gc_state.is_unset(MARKING | EVACUATION | UPDATEREFS);
376 }
377 
378 inline bool ShenandoahHeap::is_concurrent_mark_in_progress() const {
379   return _gc_state.is_set(MARKING);
380 }
381 








382 inline bool ShenandoahHeap::is_evacuation_in_progress() const {
383   return _gc_state.is_set(EVACUATION);
384 }
385 
386 inline bool ShenandoahHeap::is_degenerated_gc_in_progress() const {
387   return _degenerated_gc_in_progress.is_set();
388 }
389 
390 inline bool ShenandoahHeap::is_full_gc_in_progress() const {
391   return _full_gc_in_progress.is_set();
392 }
393 
394 inline bool ShenandoahHeap::is_full_gc_move_in_progress() const {
395   return _full_gc_move_in_progress.is_set();
396 }
397 
398 inline bool ShenandoahHeap::is_update_refs_in_progress() const {
399   return _gc_state.is_set(UPDATEREFS);
400 }
401 
402 inline bool ShenandoahHeap::is_stw_gc_in_progress() const {
403   return is_full_gc_in_progress() || is_degenerated_gc_in_progress();
404 }
405 
406 inline bool ShenandoahHeap::is_concurrent_strong_root_in_progress() const {
407   return _concurrent_strong_root_in_progress.is_set();
408 }
409 
410 inline bool ShenandoahHeap::is_concurrent_weak_root_in_progress() const {
411   return _gc_state.is_set(WEAK_ROOTS);
412 }
413 


























































414 template<class T>
415 inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl) {
416   marked_object_iterate(region, cl, region->top());
417 }
418 
419 template<class T>
420 inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit) {
421   assert(! region->is_humongous_continuation(), "no humongous continuation regions here");
422 
423   ShenandoahMarkingContext* const ctx = complete_marking_context();
424   assert(ctx->is_complete(), "sanity");
425 
426   HeapWord* tams = ctx->top_at_mark_start(region);
427 
428   size_t skip_bitmap_delta = 1;
429   HeapWord* start = region->bottom();
430   HeapWord* end = MIN2(tams, region->end());
431 
432   // Step 1. Scan below the TAMS based on bitmap data.
433   HeapWord* limit_bitmap = MIN2(limit, tams);
434 
435   // Try to scan the initial candidate. If the candidate is above the TAMS, it would
436   // fail the subsequent "< limit_bitmap" checks, and fall through to Step 2.
437   HeapWord* cb = ctx->get_next_marked_addr(start, end);
438 
439   intx dist = ShenandoahMarkScanPrefetch;
440   if (dist > 0) {
441     // Batched scan that prefetches the oop data, anticipating the access to
442     // either header, oop field, or forwarding pointer. Not that we cannot
443     // touch anything in oop, while it still being prefetched to get enough
444     // time for prefetch to work. This is why we try to scan the bitmap linearly,

527   void do_object(oop obj) {
528     obj->oop_iterate(_cl, _bounds);
529   }
530 };
531 
532 template<class T>
533 inline void ShenandoahHeap::marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* top) {
534   if (region->is_humongous()) {
535     HeapWord* bottom = region->bottom();
536     if (top > bottom) {
537       region = region->humongous_start_region();
538       ShenandoahObjectToOopBoundedClosure<T> objs(cl, bottom, top);
539       marked_object_iterate(region, &objs);
540     }
541   } else {
542     ShenandoahObjectToOopClosure<T> objs(cl);
543     marked_object_iterate(region, &objs, top);
544   }
545 }
546 
547 inline ShenandoahHeapRegion* const ShenandoahHeap::get_region(size_t region_idx) const {
548   if (region_idx < _num_regions) {
549     return _regions[region_idx];
550   } else {
551     return nullptr;
552   }
553 }
554 
555 inline void ShenandoahHeap::mark_complete_marking_context() {
556   _marking_context->mark_complete();
557 }
558 
559 inline void ShenandoahHeap::mark_incomplete_marking_context() {
560   _marking_context->mark_incomplete();
561 }
562 
563 inline ShenandoahMarkingContext* ShenandoahHeap::complete_marking_context() const {
564   assert (_marking_context->is_complete()," sanity");
565   return _marking_context;
566 }
567 
568 inline ShenandoahMarkingContext* ShenandoahHeap::marking_context() const {
569   return _marking_context;
570 }
571 












572 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP

  1 /*
  2  * Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved.
  3  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *

 26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
 27 #define SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
 28 
 29 #include "gc/shenandoah/shenandoahHeap.hpp"
 30 
 31 #include "classfile/javaClasses.inline.hpp"
 32 #include "gc/shared/markBitMap.inline.hpp"
 33 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
 34 #include "gc/shared/continuationGCSupport.inline.hpp"
 35 #include "gc/shared/suspendibleThreadSet.hpp"
 36 #include "gc/shared/tlab_globals.hpp"
 37 #include "gc/shenandoah/shenandoahAsserts.hpp"
 38 #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
 39 #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp"
 40 #include "gc/shenandoah/shenandoahForwarding.inline.hpp"
 41 #include "gc/shenandoah/shenandoahWorkGroup.hpp"
 42 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp"
 43 #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
 44 #include "gc/shenandoah/shenandoahControlThread.hpp"
 45 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
 46 #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
 47 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
 48 #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
 49 #include "gc/shenandoah/mode/shenandoahMode.hpp"
 50 #include "oops/compressedOops.inline.hpp"
 51 #include "oops/oop.inline.hpp"
 52 #include "runtime/atomic.hpp"
 53 #include "runtime/javaThread.hpp"
 54 #include "runtime/prefetch.inline.hpp"
 55 #include "runtime/objectMonitor.inline.hpp"
 56 #include "utilities/copy.hpp"
 57 #include "utilities/globalDefinitions.hpp"
 58 
 59 inline ShenandoahHeap* ShenandoahHeap::heap() {
 60   return named_heap<ShenandoahHeap>(CollectedHeap::Shenandoah);
 61 }
 62 
 63 inline ShenandoahHeapRegion* ShenandoahRegionIterator::next() {
 64   size_t new_index = Atomic::add(&_index, (size_t) 1, memory_order_relaxed);
 65   // get_region() provides the bounds-check and returns null on OOB.
 66   return _heap->get_region(new_index - 1);
 67 }
 68 
 69 inline bool ShenandoahHeap::has_forwarded_objects() const {
 70   return _gc_state.is_set(HAS_FORWARDED);
 71 }
 72 
 73 inline WorkerThreads* ShenandoahHeap::workers() const {
 74   return _workers;
 75 }
 76 
 77 inline WorkerThreads* ShenandoahHeap::safepoint_workers() {
 78   return _safepoint_workers;
 79 }
 80 
 81 inline size_t ShenandoahHeap::heap_region_index_containing(const void* addr) const {
 82   uintptr_t region_start = ((uintptr_t) addr);
 83   uintptr_t index = (region_start - (uintptr_t) base()) >> ShenandoahHeapRegion::region_size_bytes_shift();
 84   assert(index < num_regions(), "Region index is in bounds: " PTR_FORMAT, p2i(addr));
 85   return index;
 86 }
 87 
 88 inline ShenandoahHeapRegion* ShenandoahHeap::heap_region_containing(const void* addr) const {
 89   size_t index = heap_region_index_containing(addr);
 90   ShenandoahHeapRegion* const result = get_region(index);
 91   assert(addr >= result->bottom() && addr < result->end(), "Heap region contains the address: " PTR_FORMAT, p2i(addr));
 92   return result;
 93 }
 94 
 95 inline void ShenandoahHeap::enter_evacuation(Thread* t) {
 96   _oom_evac_handler.enter_evacuation(t);
 97 }
 98 
 99 inline void ShenandoahHeap::leave_evacuation(Thread* t) {
100   _oom_evac_handler.leave_evacuation(t);
101 }
102 
103 template <class T>
104 inline void ShenandoahHeap::update_with_forwarded(T* p) {
105   T o = RawAccess<>::oop_load(p);
106   if (!CompressedOops::is_null(o)) {
107     oop obj = CompressedOops::decode_not_null(o);
108     if (in_collection_set(obj)) {

240 }
241 
242 inline void ShenandoahHeap::atomic_clear_oop(narrowOop* addr, narrowOop compare) {
243   assert(is_aligned(addr, sizeof(narrowOop)), "Address should be aligned: " PTR_FORMAT, p2i(addr));
244   Atomic::cmpxchg(addr, compare, narrowOop(), memory_order_relaxed);
245 }
246 
247 inline bool ShenandoahHeap::cancelled_gc() const {
248   return _cancelled_gc.get() == CANCELLED;
249 }
250 
251 inline bool ShenandoahHeap::check_cancelled_gc_and_yield(bool sts_active) {
252   if (sts_active && !cancelled_gc()) {
253     if (SuspendibleThreadSet::should_yield()) {
254       SuspendibleThreadSet::yield();
255     }
256   }
257   return cancelled_gc();
258 }
259 
260 inline void ShenandoahHeap::clear_cancelled_gc(bool clear_oom_handler) {
261   _cancelled_gc.set(CANCELLABLE);
262   if (_cancel_requested_time > 0) {
263     double cancel_time = os::elapsedTime() - _cancel_requested_time;
264     log_info(gc)("GC cancellation took %.3fs", cancel_time);
265     _cancel_requested_time = 0;
266   }
267 
268   if (clear_oom_handler) {
269     _oom_evac_handler.clear();
270   }
271 }
272 
273 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {
274   assert(UseTLAB, "TLABs should be enabled");
275 
276   PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
277   if (gclab == nullptr) {
278     assert(!thread->is_Java_thread() && !thread->is_Worker_thread(),
279            "Performance: thread should have GCLAB: %s", thread->name());
280     // No GCLABs in this thread, fallback to shared allocation
281     return nullptr;
282   }
283   HeapWord* obj = gclab->allocate(size);
284   if (obj != nullptr) {
285     return obj;
286   }

287   return allocate_from_gclab_slow(thread, size);
288 }
289 
290 inline HeapWord* ShenandoahHeap::allocate_from_plab(Thread* thread, size_t size, bool is_promotion) {
291   assert(UseTLAB, "TLABs should be enabled");
292 
293   PLAB* plab = ShenandoahThreadLocalData::plab(thread);
294   HeapWord* obj;
295 
296   if (plab == nullptr) {
297     assert(!thread->is_Java_thread() && !thread->is_Worker_thread(), "Performance: thread should have PLAB: %s", thread->name());
298     // No PLABs in this thread, fallback to shared allocation
299     return nullptr;
300   } else if (is_promotion && !ShenandoahThreadLocalData::allow_plab_promotions(thread)) {
301     return nullptr;
302   }
303   // if plab->word_size() <= 0, thread's plab not yet initialized for this pass, so allow_plab_promotions() is not trustworthy
304   obj = plab->allocate(size);
305   if ((obj == nullptr) && (plab->words_remaining() < PLAB::min_size())) {
306     // allocate_from_plab_slow will establish allow_plab_promotions(thread) for future invocations
307     obj = allocate_from_plab_slow(thread, size, is_promotion);
308   }
309   // if plab->words_remaining() >= PLAB::min_size(), just return nullptr so we can use a shared allocation
310   if (obj == nullptr) {
311     return nullptr;
312   }
313 
314   if (is_promotion) {
315     ShenandoahThreadLocalData::add_to_plab_promoted(thread, size * HeapWordSize);
316   } else {
317     ShenandoahThreadLocalData::add_to_plab_evacuated(thread, size * HeapWordSize);
318   }
319   return obj;
320 }
321 
322 inline ShenandoahAgeCensus* ShenandoahHeap::age_census() const {
323   assert(mode()->is_generational(), "Only in generational mode");
324   assert(_age_census != nullptr, "Error: not initialized");
325   return _age_census;
326 }
327 
328 inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
329   assert(thread == Thread::current(), "Expected thread parameter to be current thread.");
330   if (ShenandoahThreadLocalData::is_oom_during_evac(thread)) {
331     // This thread went through the OOM during evac protocol and it is safe to return
332     // the forward pointer. It must not attempt to evacuate any more.
333     return ShenandoahBarrierSet::resolve_forwarded(p);
334   }
335 
336   assert(ShenandoahThreadLocalData::is_evac_allowed(thread), "must be enclosed in oom-evac scope");
337 
338   ShenandoahHeapRegion* r = heap_region_containing(p);
339   assert(!r->is_humongous(), "never evacuate humongous objects");
340 
341   ShenandoahAffiliation target_gen = r->affiliation();
342   if (mode()->is_generational() && ShenandoahHeap::heap()->is_gc_generation_young() &&
343       target_gen == YOUNG_GENERATION) {
344     markWord mark = p->mark();
345     if (mark.is_marked()) {
346       // Already forwarded.
347       return ShenandoahBarrierSet::resolve_forwarded(p);
348     }
349     if (mark.has_displaced_mark_helper()) {
350       // We don't want to deal with MT here just to ensure we read the right mark word.
351       // Skip the potential promotion attempt for this one.
352     } else if (r->age() + mark.age() >= age_census()->tenuring_threshold()) {
353       oop result = try_evacuate_object(p, thread, r, OLD_GENERATION);
354       if (result != nullptr) {
355         return result;
356       }
357       // If we failed to promote this aged object, we'll fall through to code below and evacuate to young-gen.
358     }
359   }
360   return try_evacuate_object(p, thread, r, target_gen);
361 }
362 
363 // try_evacuate_object registers the object and dirties the associated remembered set information when evacuating
364 // to OLD_GENERATION.
365 inline oop ShenandoahHeap::try_evacuate_object(oop p, Thread* thread, ShenandoahHeapRegion* from_region,
366                                                ShenandoahAffiliation target_gen) {
367   bool alloc_from_lab = true;
368   bool has_plab = false;
369   HeapWord* copy = nullptr;
370   size_t size = p->size();
371   bool is_promotion = (target_gen == OLD_GENERATION) && from_region->is_young();
372 
373 #ifdef ASSERT
374   if (ShenandoahOOMDuringEvacALot &&
375       (os::random() & 1) == 0) { // Simulate OOM every ~2nd slow-path call
376         copy = nullptr;
377   } else {
378 #endif
379     if (UseTLAB) {
380       switch (target_gen) {
381         case YOUNG_GENERATION: {
382            copy = allocate_from_gclab(thread, size);
383            if ((copy == nullptr) && (size < ShenandoahThreadLocalData::gclab_size(thread))) {
384              // GCLAB allocation failed because we are bumping up against the limit on young evacuation reserve.  Try resetting
385              // the desired GCLAB size and retry GCLAB allocation to avoid cascading of shared memory allocations.
386              ShenandoahThreadLocalData::set_gclab_size(thread, PLAB::min_size());
387              copy = allocate_from_gclab(thread, size);
388              // If we still get nullptr, we'll try a shared allocation below.
389            }
390            break;
391         }
392         case OLD_GENERATION: {
393            PLAB* plab = ShenandoahThreadLocalData::plab(thread);
394            if (plab != nullptr) {
395              has_plab = true;
396            }
397            copy = allocate_from_plab(thread, size, is_promotion);
398            if ((copy == nullptr) && (size < ShenandoahThreadLocalData::plab_size(thread)) &&
399                ShenandoahThreadLocalData::plab_retries_enabled(thread)) {
400              // PLAB allocation failed because we are bumping up against the limit on old evacuation reserve or because
401              // the requested object does not fit within the current plab but the plab still has an "abundance" of memory,
402              // where abundance is defined as >= PLAB::min_size().  In the former case, we try resetting the desired
403              // PLAB size and retry PLAB allocation to avoid cascading of shared memory allocations.
404 
405              // In this situation, PLAB memory is precious.  We'll try to preserve our existing PLAB by forcing
406              // this particular allocation to be shared.
407              if (plab->words_remaining() < PLAB::min_size()) {
408                ShenandoahThreadLocalData::set_plab_size(thread, PLAB::min_size());
409                copy = allocate_from_plab(thread, size, is_promotion);
410                // If we still get nullptr, we'll try a shared allocation below.
411                if (copy == nullptr) {
412                  // If retry fails, don't continue to retry until we have success (probably in next GC pass)
413                  ShenandoahThreadLocalData::disable_plab_retries(thread);
414                }
415              }
416              // else, copy still equals nullptr.  this causes shared allocation below, preserving this plab for future needs.
417            }
418            break;
419         }
420         default: {
421           ShouldNotReachHere();
422           break;
423         }
424       }
425     }
426 
427     if (copy == nullptr) {
428       // If we failed to allocate in LAB, we'll try a shared allocation.
429       if (!is_promotion || !has_plab || (size > PLAB::min_size())) {
430         ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(size, target_gen);
431         copy = allocate_memory(req, is_promotion);
432         alloc_from_lab = false;
433       }
434       // else, we leave copy equal to nullptr, signaling a promotion failure below if appropriate.
435       // We choose not to promote objects smaller than PLAB::min_size() by way of shared allocations, as this is too
436       // costly.  Instead, we'll simply "evacuate" to young-gen memory (using a GCLAB) and will promote in a future
437       // evacuation pass.  This condition is denoted by: is_promotion && has_plab && (size <= PLAB::min_size())
438     }
439 #ifdef ASSERT
440   }
441 #endif
442 
443   if (copy == nullptr) {
444     if (target_gen == OLD_GENERATION) {
445       assert(mode()->is_generational(), "Should only be here in generational mode.");
446       if (from_region->is_young()) {
447         // Signal that promotion failed. Will evacuate this old object somewhere in young gen.
448         report_promotion_failure(thread, size);
449         return nullptr;
450       } else {
451         // Remember that evacuation to old gen failed. We'll want to trigger a full gc to recover from this
452         // after the evacuation threads have finished.
453         handle_old_evacuation_failure();
454       }
455     }
456 
457     control_thread()->handle_alloc_failure_evac(size);
458 
459     _oom_evac_handler.handle_out_of_memory_during_evacuation();
460 
461     return ShenandoahBarrierSet::resolve_forwarded(p);
462   }
463 
464   // Copy the object:
465   _evac_tracker->begin_evacuation(thread, size * HeapWordSize);
466   Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(p), copy, size);
467 

468   oop copy_val = cast_to_oop(copy);
469 
470   if (mode()->is_generational() && target_gen == YOUNG_GENERATION && is_aging_cycle()) {
471     ShenandoahHeap::increase_object_age(copy_val, from_region->age() + 1);
472   }
473 
474   // Try to install the new forwarding pointer.
475   ContinuationGCSupport::relativize_stack_chunk(copy_val);
476 
477   oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val);
478   if (result == copy_val) {
479     // Successfully evacuated. Our copy is now the public one!
480     _evac_tracker->end_evacuation(thread, size * HeapWordSize);
481     if (mode()->is_generational()) {
482       if (target_gen == OLD_GENERATION) {
483         handle_old_evacuation(copy, size, from_region->is_young());
484       } else {
485         // When copying to the old generation above, we don't care
486         // about recording object age in the census stats.
487         assert(target_gen == YOUNG_GENERATION, "Error");
488         // We record this census only when simulating pre-adaptive tenuring behavior, or
489         // when we have been asked to record the census at evacuation rather than at mark
490         if (ShenandoahGenerationalCensusAtEvac || !ShenandoahGenerationalAdaptiveTenuring) {
491           _evac_tracker->record_age(thread, size * HeapWordSize, ShenandoahHeap::get_object_age(copy_val));
492         }
493       }
494     }
495     shenandoah_assert_correct(nullptr, copy_val);
496     return copy_val;
497   }  else {
498     // Failed to evacuate. We need to deal with the object that is left behind. Since this
499     // new allocation is certainly after TAMS, it will be considered live in the next cycle.
500     // But if it happens to contain references to evacuated regions, those references would
501     // not get updated for this stale copy during this cycle, and we will crash while scanning
502     // it the next cycle.
503     if (alloc_from_lab) {
504        // For LAB allocations, it is enough to rollback the allocation ptr. Either the next
505        // object will overwrite this stale copy, or the filler object on LAB retirement will
506        // do this.
507        switch (target_gen) {
508          case YOUNG_GENERATION: {
509              ShenandoahThreadLocalData::gclab(thread)->undo_allocation(copy, size);
510             break;
511          }
512          case OLD_GENERATION: {
513             ShenandoahThreadLocalData::plab(thread)->undo_allocation(copy, size);
514             if (is_promotion) {
515               ShenandoahThreadLocalData::subtract_from_plab_promoted(thread, size * HeapWordSize);
516             } else {
517               ShenandoahThreadLocalData::subtract_from_plab_evacuated(thread, size * HeapWordSize);
518             }
519             break;
520          }
521          default: {
522            ShouldNotReachHere();
523            break;
524          }
525        }
526     } else {
527       // For non-LAB allocations, we have no way to retract the allocation, and
528       // have to explicitly overwrite the copy with the filler object. With that overwrite,
529       // we have to keep the fwdptr initialized and pointing to our (stale) copy.
530       assert(size >= ShenandoahHeap::min_fill_size(), "previously allocated object known to be larger than min_size");
531       fill_with_object(copy, size);
532       shenandoah_assert_correct(nullptr, copy_val);
533       // For non-LAB allocations, the object has already been registered
534     }
535     shenandoah_assert_correct(nullptr, result);
536     return result;
537   }
538 }
539 
540 void ShenandoahHeap::increase_object_age(oop obj, uint additional_age) {
541   // This operates on new copy of an object. This means that the object's mark-word
542   // is thread-local and therefore safe to access. However, when the mark is
543   // displaced (i.e. stack-locked or monitor-locked), then it must be considered
544   // a shared memory location. It can be accessed by other threads.
545   // In particular, a competing evacuating thread can succeed to install its copy
546   // as the forwardee and continue to unlock the object, at which point 'our'
547   // write to the foreign stack-location would potentially over-write random
548   // information on that stack. Writing to a monitor is less problematic,
549   // but still not safe: while the ObjectMonitor would not randomly disappear,
550   // the other thread would also write to the same displaced header location,
551   // possibly leading to increase the age twice.
552   // For all these reasons, we take the conservative approach and not attempt
553   // to increase the age when the header is displaced.
554   markWord w = obj->mark();
555   // The mark-word has been copied from the original object. It can not be
556   // inflating, because inflation can not be interrupted by a safepoint,
557   // and after a safepoint, a Java thread would first have to successfully
558   // evacuate the object before it could inflate the monitor.
559   assert(!w.is_being_inflated() || LockingMode == LM_LIGHTWEIGHT, "must not inflate monitor before evacuation of object succeeds");
560   // It is possible that we have copied the object after another thread has
561   // already successfully completed evacuation. While harmless (we would never
562   // publish our copy), don't even attempt to modify the age when that
563   // happens.
564   if (!w.has_displaced_mark_helper() && !w.is_marked()) {
565     w = w.set_age(MIN2(markWord::max_age, w.age() + additional_age));
566     obj->set_mark(w);
567   }
568 }
569 
570 // Return the object's age, or a sentinel value when the age can't
571 // necessarily be determined because of concurrent locking by the
572 // mutator
573 uint ShenandoahHeap::get_object_age(oop obj) {
574   // This is impossible to do unless we "freeze" ABA-type oscillations
575   // With Lilliput, we can do this more easily.
576   markWord w = obj->mark();
577   assert(!w.is_marked(), "must not be forwarded");
578   if (w.has_monitor()) {
579     w = w.monitor()->header();
580   } else if (w.is_being_inflated() || w.has_displaced_mark_helper()) {
581     // Informs caller that we aren't able to determine the age
582     return markWord::max_age + 1; // sentinel
583   }
584   assert(w.age() <= markWord::max_age, "Impossible!");
585   return w.age();
586 }
587 
588 inline bool ShenandoahHeap::clear_old_evacuation_failure() {
589   return _old_gen_oom_evac.try_unset();
590 }
591 
592 bool ShenandoahHeap::is_in(const void* p) const {
593   HeapWord* heap_base = (HeapWord*) base();
594   HeapWord* last_region_end = heap_base + ShenandoahHeapRegion::region_size_words() * num_regions();
595   return p >= heap_base && p < last_region_end;
596 }
597 
598 inline bool ShenandoahHeap::is_in_active_generation(oop obj) const {
599   if (!mode()->is_generational()) {
600     // everything is the same single generation
601     return true;
602   }
603 
604   if (active_generation() == nullptr) {
605     // no collection is happening, only expect this to be called
606     // when concurrent processing is active, but that could change
607     return false;
608   }
609 
610   assert(is_in(obj), "only check if is in active generation for objects (" PTR_FORMAT ") in heap", p2i(obj));
611   assert((active_generation() == (ShenandoahGeneration*) old_generation()) ||
612          (active_generation() == (ShenandoahGeneration*) young_generation()) ||
613          (active_generation() == global_generation()), "Active generation must be old, young, or global");
614 
615   size_t index = heap_region_containing(obj)->index();
616   switch (_affiliations[index]) {
617   case ShenandoahAffiliation::FREE:
618     // Free regions are in Old, Young, Global
619     return true;
620   case ShenandoahAffiliation::YOUNG_GENERATION:
621     // Young regions are in young_generation and global_generation, not in old_generation
622     return (active_generation() != (ShenandoahGeneration*) old_generation());
623   case ShenandoahAffiliation::OLD_GENERATION:
624     // Old regions are in old_generation and global_generation, not in young_generation
625     return (active_generation() != (ShenandoahGeneration*) young_generation());
626   default:
627     assert(false, "Bad affiliation (%d) for region " SIZE_FORMAT, _affiliations[index], index);
628     return false;
629   }
630 }
631 
632 inline bool ShenandoahHeap::is_in_young(const void* p) const {
633   return is_in(p) && (_affiliations[heap_region_index_containing(p)] == ShenandoahAffiliation::YOUNG_GENERATION);
634 }
635 
636 inline bool ShenandoahHeap::is_in_old(const void* p) const {
637   return is_in(p) && (_affiliations[heap_region_index_containing(p)] == ShenandoahAffiliation::OLD_GENERATION);
638 }
639 
640 inline bool ShenandoahHeap::is_old(oop obj) const {
641   return is_gc_generation_young() && is_in_old(obj);
642 }
643 
644 inline ShenandoahAffiliation ShenandoahHeap::region_affiliation(const ShenandoahHeapRegion *r) {
645   return (ShenandoahAffiliation) _affiliations[r->index()];
646 }
647 
648 inline void ShenandoahHeap::assert_lock_for_affiliation(ShenandoahAffiliation orig_affiliation,
649                                                         ShenandoahAffiliation new_affiliation) {
650   // A lock is required when changing from FREE to NON-FREE.  Though it may be possible to elide the lock when
651   // transitioning from in-use to FREE, the current implementation uses a lock for this transition.  A lock is
652   // not required to change from YOUNG to OLD (i.e. when promoting humongous region).
653   //
654   //         new_affiliation is:     FREE   YOUNG   OLD
655   //  orig_affiliation is:  FREE      X       L      L
656   //                       YOUNG      L       X
657   //                         OLD      L       X      X
658   //  X means state transition won't happen (so don't care)
659   //  L means lock should be held
660   //  Blank means no lock required because affiliation visibility will not be required until subsequent safepoint
661   //
662   // Note: during full GC, all transitions between states are possible.  During Full GC, we should be in a safepoint.
663 
664   if ((orig_affiliation == ShenandoahAffiliation::FREE) || (new_affiliation == ShenandoahAffiliation::FREE)) {
665     shenandoah_assert_heaplocked_or_fullgc_safepoint();
666   }
667 }
668 
669 inline void ShenandoahHeap::set_affiliation(ShenandoahHeapRegion* r, ShenandoahAffiliation new_affiliation) {
670 #ifdef ASSERT
671   assert_lock_for_affiliation(region_affiliation(r), new_affiliation);
672 #endif
673   _affiliations[r->index()] = (uint8_t) new_affiliation;
674 }
675 
676 inline ShenandoahAffiliation ShenandoahHeap::region_affiliation(size_t index) {
677   return (ShenandoahAffiliation) _affiliations[index];
678 }
679 
680 inline bool ShenandoahHeap::requires_marking(const void* entry) const {
681   oop obj = cast_to_oop(entry);
682   return !_marking_context->is_marked_strong(obj);
683 }
684 
685 inline bool ShenandoahHeap::in_collection_set(oop p) const {
686   assert(collection_set() != nullptr, "Sanity");
687   return collection_set()->is_in(p);
688 }
689 
690 inline bool ShenandoahHeap::in_collection_set_loc(void* p) const {
691   assert(collection_set() != nullptr, "Sanity");
692   return collection_set()->is_in_loc(p);
693 }
694 
695 
696 inline bool ShenandoahHeap::is_stable() const {
697   return _gc_state.is_clear();
698 }
699 
700 inline bool ShenandoahHeap::has_evacuation_reserve_quantities() const {
701   return _has_evacuation_reserve_quantities;
702 }
703 
704 inline bool ShenandoahHeap::is_idle() const {
705   return _gc_state.is_unset(MARKING | EVACUATION | UPDATEREFS);
706 }
707 
708 inline bool ShenandoahHeap::is_concurrent_mark_in_progress() const {
709   return _gc_state.is_set(MARKING);
710 }
711 
712 inline bool ShenandoahHeap::is_concurrent_young_mark_in_progress() const {
713   return _gc_state.is_set(YOUNG_MARKING);
714 }
715 
716 inline bool ShenandoahHeap::is_concurrent_old_mark_in_progress() const {
717   return _gc_state.is_set(OLD_MARKING);
718 }
719 
720 inline bool ShenandoahHeap::is_evacuation_in_progress() const {
721   return _gc_state.is_set(EVACUATION);
722 }
723 
724 inline bool ShenandoahHeap::is_degenerated_gc_in_progress() const {
725   return _degenerated_gc_in_progress.is_set();
726 }
727 
728 inline bool ShenandoahHeap::is_full_gc_in_progress() const {
729   return _full_gc_in_progress.is_set();
730 }
731 
732 inline bool ShenandoahHeap::is_full_gc_move_in_progress() const {
733   return _full_gc_move_in_progress.is_set();
734 }
735 
736 inline bool ShenandoahHeap::is_update_refs_in_progress() const {
737   return _gc_state.is_set(UPDATEREFS);
738 }
739 
740 inline bool ShenandoahHeap::is_stw_gc_in_progress() const {
741   return is_full_gc_in_progress() || is_degenerated_gc_in_progress();
742 }
743 
744 inline bool ShenandoahHeap::is_concurrent_strong_root_in_progress() const {
745   return _concurrent_strong_root_in_progress.is_set();
746 }
747 
748 inline bool ShenandoahHeap::is_concurrent_weak_root_in_progress() const {
749   return _gc_state.is_set(WEAK_ROOTS);
750 }
751 
752 inline bool ShenandoahHeap::is_aging_cycle() const {
753   return _is_aging_cycle.is_set();
754 }
755 
756 inline size_t ShenandoahHeap::set_promoted_reserve(size_t new_val) {
757   size_t orig = _promoted_reserve;
758   _promoted_reserve = new_val;
759   return orig;
760 }
761 
762 inline size_t ShenandoahHeap::get_promoted_reserve() const {
763   return _promoted_reserve;
764 }
765 
766 inline size_t ShenandoahHeap::set_old_evac_reserve(size_t new_val) {
767   size_t orig = _old_evac_reserve;
768   _old_evac_reserve = new_val;
769   return orig;
770 }
771 
772 inline size_t ShenandoahHeap::get_old_evac_reserve() const {
773   return _old_evac_reserve;
774 }
775 
776 inline void ShenandoahHeap::augment_old_evac_reserve(size_t increment) {
777   _old_evac_reserve += increment;
778 }
779 
780 inline void ShenandoahHeap::augment_promo_reserve(size_t increment) {
781   _promoted_reserve += increment;
782 }
783 
784 inline void ShenandoahHeap::reset_promoted_expended() {
785   Atomic::store(&_promoted_expended, (size_t) 0);
786 }
787 
788 inline size_t ShenandoahHeap::expend_promoted(size_t increment) {
789   return Atomic::add(&_promoted_expended, increment);
790 }
791 
792 inline size_t ShenandoahHeap::unexpend_promoted(size_t decrement) {
793   return Atomic::sub(&_promoted_expended, decrement);
794 }
795 
796 inline size_t ShenandoahHeap::get_promoted_expended() {
797   return Atomic::load(&_promoted_expended);
798 }
799 
800 inline size_t ShenandoahHeap::set_young_evac_reserve(size_t new_val) {
801   size_t orig = _young_evac_reserve;
802   _young_evac_reserve = new_val;
803   return orig;
804 }
805 
806 inline size_t ShenandoahHeap::get_young_evac_reserve() const {
807   return _young_evac_reserve;
808 }
809 
810 template<class T>
811 inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl) {
812   marked_object_iterate(region, cl, region->top());
813 }
814 
815 template<class T>
816 inline void ShenandoahHeap::marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit) {
817   assert(! region->is_humongous_continuation(), "no humongous continuation regions here");
818 
819   ShenandoahMarkingContext* const ctx = marking_context();

820 
821   HeapWord* tams = ctx->top_at_mark_start(region);
822 
823   size_t skip_bitmap_delta = 1;
824   HeapWord* start = region->bottom();
825   HeapWord* end = MIN2(tams, region->end());
826 
827   // Step 1. Scan below the TAMS based on bitmap data.
828   HeapWord* limit_bitmap = MIN2(limit, tams);
829 
830   // Try to scan the initial candidate. If the candidate is above the TAMS, it would
831   // fail the subsequent "< limit_bitmap" checks, and fall through to Step 2.
832   HeapWord* cb = ctx->get_next_marked_addr(start, end);
833 
834   intx dist = ShenandoahMarkScanPrefetch;
835   if (dist > 0) {
836     // Batched scan that prefetches the oop data, anticipating the access to
837     // either header, oop field, or forwarding pointer. Not that we cannot
838     // touch anything in oop, while it still being prefetched to get enough
839     // time for prefetch to work. This is why we try to scan the bitmap linearly,

922   void do_object(oop obj) {
923     obj->oop_iterate(_cl, _bounds);
924   }
925 };
926 
927 template<class T>
928 inline void ShenandoahHeap::marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* top) {
929   if (region->is_humongous()) {
930     HeapWord* bottom = region->bottom();
931     if (top > bottom) {
932       region = region->humongous_start_region();
933       ShenandoahObjectToOopBoundedClosure<T> objs(cl, bottom, top);
934       marked_object_iterate(region, &objs);
935     }
936   } else {
937     ShenandoahObjectToOopClosure<T> objs(cl);
938     marked_object_iterate(region, &objs, top);
939   }
940 }
941 
942 inline ShenandoahHeapRegion* ShenandoahHeap::get_region(size_t region_idx) const {
943   if (region_idx < _num_regions) {
944     return _regions[region_idx];
945   } else {
946     return nullptr;
947   }
948 }
949 








950 inline ShenandoahMarkingContext* ShenandoahHeap::complete_marking_context() const {
951   assert (_marking_context->is_complete()," sanity");
952   return _marking_context;
953 }
954 
955 inline ShenandoahMarkingContext* ShenandoahHeap::marking_context() const {
956   return _marking_context;
957 }
958 
959 inline void ShenandoahHeap::clear_cards_for(ShenandoahHeapRegion* region) {
960   if (mode()->is_generational()) {
961     _card_scan->mark_range_as_empty(region->bottom(), pointer_delta(region->end(), region->bottom()));
962   }
963 }
964 
965 inline void ShenandoahHeap::mark_card_as_dirty(void* location) {
966   if (mode()->is_generational()) {
967     _card_scan->mark_card_as_dirty((HeapWord*)location);
968   }
969 }
970 
971 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
< prev index next >