1 /* 2 * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2013, 2021, Red Hat, Inc. 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 * 24 */ 25 26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_HPP 27 #define SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_HPP 28 29 #include "gc/shared/markBitMap.hpp" 30 #include "gc/shared/softRefPolicy.hpp" 31 #include "gc/shared/collectedHeap.hpp" 32 #include "gc/shenandoah/heuristics/shenandoahSpaceInfo.hpp" 33 #include "gc/shenandoah/shenandoahAsserts.hpp" 34 #include "gc/shenandoah/shenandoahAllocRequest.hpp" 35 #include "gc/shenandoah/shenandoahLock.hpp" 36 #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" 37 #include "gc/shenandoah/shenandoahPadding.hpp" 38 #include "gc/shenandoah/shenandoahSharedVariables.hpp" 39 #include "gc/shenandoah/shenandoahUnload.hpp" 40 #include "memory/metaspace.hpp" 41 #include "services/memoryManager.hpp" 42 #include "utilities/globalDefinitions.hpp" 43 #include "utilities/stack.hpp" 44 45 class ConcurrentGCTimer; 46 class ObjectIterateScanRootClosure; 47 class ShenandoahCollectorPolicy; 48 class ShenandoahControlThread; 49 class ShenandoahGCSession; 50 class ShenandoahGCStateResetter; 51 class ShenandoahHeuristics; 52 class ShenandoahMarkingContext; 53 class ShenandoahMode; 54 class ShenandoahPhaseTimings; 55 class ShenandoahHeap; 56 class ShenandoahHeapRegion; 57 class ShenandoahHeapRegionClosure; 58 class ShenandoahCollectionSet; 59 class ShenandoahFreeSet; 60 class ShenandoahConcurrentMark; 61 class ShenandoahFullGC; 62 class ShenandoahMonitoringSupport; 63 class ShenandoahPacer; 64 class ShenandoahReferenceProcessor; 65 class ShenandoahVerifier; 66 class ShenandoahWorkerThreads; 67 class VMStructs; 68 69 // Used for buffering per-region liveness data. 70 // Needed since ShenandoahHeapRegion uses atomics to update liveness. 71 // The ShenandoahHeap array has max-workers elements, each of which is an array of 72 // uint16_t * max_regions. The choice of uint16_t is not accidental: 73 // there is a tradeoff between static/dynamic footprint that translates 74 // into cache pressure (which is already high during marking), and 75 // too many atomic updates. uint32_t is too large, uint8_t is too small. 76 typedef uint16_t ShenandoahLiveData; 77 #define SHENANDOAH_LIVEDATA_MAX ((ShenandoahLiveData)-1) 78 79 class ShenandoahRegionIterator : public StackObj { 80 private: 81 ShenandoahHeap* _heap; 82 83 shenandoah_padding(0); 84 volatile size_t _index; 85 shenandoah_padding(1); 86 87 // No implicit copying: iterators should be passed by reference to capture the state 88 NONCOPYABLE(ShenandoahRegionIterator); 89 90 public: 91 ShenandoahRegionIterator(); 92 ShenandoahRegionIterator(ShenandoahHeap* heap); 93 94 // Reset iterator to default state 95 void reset(); 96 97 // Returns next region, or null if there are no more regions. 98 // This is multi-thread-safe. 99 inline ShenandoahHeapRegion* next(); 100 101 // This is *not* MT safe. However, in the absence of multithreaded access, it 102 // can be used to determine if there is more work to do. 103 bool has_next() const; 104 }; 105 106 class ShenandoahHeapRegionClosure : public StackObj { 107 public: 108 virtual void heap_region_do(ShenandoahHeapRegion* r) = 0; 109 virtual bool is_thread_safe() { return false; } 110 }; 111 112 typedef ShenandoahLock ShenandoahHeapLock; 113 typedef ShenandoahLocker ShenandoahHeapLocker; 114 typedef Stack<oop, mtGC> ShenandoahScanObjectStack; 115 116 // Shenandoah GC is low-pause concurrent GC that uses Brooks forwarding pointers 117 // to encode forwarding data. See BrooksPointer for details on forwarding data encoding. 118 // See ShenandoahControlThread for GC cycle structure. 119 // 120 class ShenandoahHeap : public CollectedHeap, public ShenandoahSpaceInfo { 121 friend class ShenandoahAsserts; 122 friend class VMStructs; 123 friend class ShenandoahGCSession; 124 friend class ShenandoahGCStateResetter; 125 friend class ShenandoahParallelObjectIterator; 126 friend class ShenandoahSafepoint; 127 // Supported GC 128 friend class ShenandoahConcurrentGC; 129 friend class ShenandoahDegenGC; 130 friend class ShenandoahFullGC; 131 friend class ShenandoahUnload; 132 133 // ---------- Locks that guard important data structures in Heap 134 // 135 private: 136 ShenandoahHeapLock _lock; 137 138 public: 139 ShenandoahHeapLock* lock() { 140 return &_lock; 141 } 142 143 // ---------- Initialization, termination, identification, printing routines 144 // 145 public: 146 static ShenandoahHeap* heap(); 147 148 const char* name() const override { return "Shenandoah"; } 149 ShenandoahHeap::Name kind() const override { return CollectedHeap::Shenandoah; } 150 151 ShenandoahHeap(ShenandoahCollectorPolicy* policy); 152 jint initialize() override; 153 void post_initialize() override; 154 void initialize_mode(); 155 void initialize_heuristics(); 156 157 void initialize_serviceability() override; 158 159 void print_on(outputStream* st) const override; 160 void print_extended_on(outputStream *st) const override; 161 void print_tracing_info() const override; 162 void print_heap_regions_on(outputStream* st) const; 163 164 void stop() override; 165 166 void prepare_for_verify() override; 167 void verify(VerifyOption vo) override; 168 169 // WhiteBox testing support. 170 bool supports_concurrent_gc_breakpoints() const override { 171 return true; 172 } 173 174 // ---------- Heap counters and metrics 175 // 176 private: 177 size_t _initial_size; 178 size_t _minimum_size; 179 volatile size_t _soft_max_size; 180 shenandoah_padding(0); 181 volatile size_t _used; 182 volatile size_t _committed; 183 volatile size_t _bytes_allocated_since_gc_start; 184 shenandoah_padding(1); 185 186 public: 187 void increase_used(size_t bytes); 188 void decrease_used(size_t bytes); 189 void set_used(size_t bytes); 190 191 void increase_committed(size_t bytes); 192 void decrease_committed(size_t bytes); 193 void increase_allocated(size_t bytes); 194 195 size_t bytes_allocated_since_gc_start() const override; 196 void reset_bytes_allocated_since_gc_start(); 197 198 size_t min_capacity() const; 199 size_t max_capacity() const override; 200 size_t soft_max_capacity() const override; 201 size_t initial_capacity() const; 202 size_t capacity() const override; 203 size_t used() const override; 204 size_t committed() const; 205 size_t available() const override; 206 207 void set_soft_max_capacity(size_t v); 208 209 // ---------- Workers handling 210 // 211 private: 212 uint _max_workers; 213 ShenandoahWorkerThreads* _workers; 214 ShenandoahWorkerThreads* _safepoint_workers; 215 216 public: 217 uint max_workers(); 218 void assert_gc_workers(uint nworker) NOT_DEBUG_RETURN; 219 220 WorkerThreads* workers() const; 221 WorkerThreads* safepoint_workers() override; 222 223 void gc_threads_do(ThreadClosure* tcl) const override; 224 225 // ---------- Heap regions handling machinery 226 // 227 private: 228 MemRegion _heap_region; 229 bool _heap_region_special; 230 size_t _num_regions; 231 ShenandoahHeapRegion** _regions; 232 ShenandoahRegionIterator _update_refs_iterator; 233 234 public: 235 236 inline HeapWord* base() const { return _heap_region.start(); } 237 238 inline size_t num_regions() const { return _num_regions; } 239 inline bool is_heap_region_special() { return _heap_region_special; } 240 241 inline ShenandoahHeapRegion* heap_region_containing(const void* addr) const; 242 inline size_t heap_region_index_containing(const void* addr) const; 243 244 inline ShenandoahHeapRegion* get_region(size_t region_idx) const; 245 246 void heap_region_iterate(ShenandoahHeapRegionClosure* blk) const; 247 void parallel_heap_region_iterate(ShenandoahHeapRegionClosure* blk) const; 248 249 // ---------- GC state machinery 250 // 251 // GC state describes the important parts of collector state, that may be 252 // used to make barrier selection decisions in the native and generated code. 253 // Multiple bits can be set at once. 254 // 255 // Important invariant: when GC state is zero, the heap is stable, and no barriers 256 // are required. 257 // 258 public: 259 enum GCStateBitPos { 260 // Heap has forwarded objects: needs LRB barriers. 261 HAS_FORWARDED_BITPOS = 0, 262 263 // Heap is under marking: needs SATB barriers. 264 MARKING_BITPOS = 1, 265 266 // Heap is under evacuation: needs LRB barriers. (Set together with HAS_FORWARDED) 267 EVACUATION_BITPOS = 2, 268 269 // Heap is under updating: needs no additional barriers. 270 UPDATEREFS_BITPOS = 3, 271 272 // Heap is under weak-reference/roots processing: needs weak-LRB barriers. 273 WEAK_ROOTS_BITPOS = 4, 274 }; 275 276 enum GCState { 277 STABLE = 0, 278 HAS_FORWARDED = 1 << HAS_FORWARDED_BITPOS, 279 MARKING = 1 << MARKING_BITPOS, 280 EVACUATION = 1 << EVACUATION_BITPOS, 281 UPDATEREFS = 1 << UPDATEREFS_BITPOS, 282 WEAK_ROOTS = 1 << WEAK_ROOTS_BITPOS, 283 }; 284 285 private: 286 ShenandoahSharedBitmap _gc_state; 287 ShenandoahSharedFlag _degenerated_gc_in_progress; 288 ShenandoahSharedFlag _full_gc_in_progress; 289 ShenandoahSharedFlag _full_gc_move_in_progress; 290 ShenandoahSharedFlag _progress_last_gc; 291 ShenandoahSharedFlag _concurrent_strong_root_in_progress; 292 293 void set_gc_state_all_threads(char state); 294 void set_gc_state_mask(uint mask, bool value); 295 296 public: 297 char gc_state() const; 298 static address gc_state_addr(); 299 300 void set_concurrent_mark_in_progress(bool in_progress); 301 void set_evacuation_in_progress(bool in_progress); 302 void set_update_refs_in_progress(bool in_progress); 303 void set_degenerated_gc_in_progress(bool in_progress); 304 void set_full_gc_in_progress(bool in_progress); 305 void set_full_gc_move_in_progress(bool in_progress); 306 void set_has_forwarded_objects(bool cond); 307 void set_concurrent_strong_root_in_progress(bool cond); 308 void set_concurrent_weak_root_in_progress(bool cond); 309 310 inline bool is_stable() const; 311 inline bool is_idle() const; 312 inline bool is_concurrent_mark_in_progress() const; 313 inline bool is_update_refs_in_progress() const; 314 inline bool is_evacuation_in_progress() const; 315 inline bool is_degenerated_gc_in_progress() const; 316 inline bool is_full_gc_in_progress() const; 317 inline bool is_full_gc_move_in_progress() const; 318 inline bool has_forwarded_objects() const; 319 inline bool is_gc_in_progress_mask(uint mask) const; 320 inline bool is_stw_gc_in_progress() const; 321 inline bool is_concurrent_strong_root_in_progress() const; 322 inline bool is_concurrent_weak_root_in_progress() const; 323 324 private: 325 enum CancelState { 326 // Normal state. GC has not been cancelled and is open for cancellation. 327 // Worker threads can suspend for safepoint. 328 CANCELLABLE, 329 330 // GC has been cancelled. Worker threads can not suspend for 331 // safepoint but must finish their work as soon as possible. 332 CANCELLED 333 }; 334 335 ShenandoahSharedEnumFlag<CancelState> _cancelled_gc; 336 bool try_cancel_gc(); 337 338 public: 339 static address cancelled_gc_addr(); 340 341 inline bool cancelled_gc() const; 342 inline bool check_cancelled_gc_and_yield(bool sts_active = true); 343 344 inline void clear_cancelled_gc(); 345 346 void cancel_gc(GCCause::Cause cause); 347 348 public: 349 // Elastic heap support 350 void entry_uncommit(double shrink_before, size_t shrink_until); 351 void op_uncommit(double shrink_before, size_t shrink_until); 352 353 private: 354 // GC support 355 // Reset bitmap, prepare regions for new GC cycle 356 void prepare_gc(); 357 void prepare_regions_and_collection_set(bool concurrent); 358 // Evacuation 359 void prepare_evacuation(bool concurrent); 360 void evacuate_collection_set(bool concurrent); 361 // Concurrent root processing 362 void prepare_concurrent_roots(); 363 void finish_concurrent_roots(); 364 // Concurrent class unloading support 365 void do_class_unloading(); 366 // Reference updating 367 void prepare_update_heap_references(bool concurrent); 368 void update_heap_references(bool concurrent); 369 // Final update region states 370 void update_heap_region_states(bool concurrent); 371 void rebuild_free_set(bool concurrent); 372 373 void rendezvous_threads(); 374 void recycle_trash(); 375 public: 376 void notify_gc_progress() { _progress_last_gc.set(); } 377 void notify_gc_no_progress() { _progress_last_gc.unset(); } 378 379 // 380 // Mark support 381 private: 382 ShenandoahControlThread* _control_thread; 383 ShenandoahCollectorPolicy* _shenandoah_policy; 384 ShenandoahMode* _gc_mode; 385 ShenandoahHeuristics* _heuristics; 386 ShenandoahFreeSet* _free_set; 387 ShenandoahPacer* _pacer; 388 ShenandoahVerifier* _verifier; 389 390 ShenandoahPhaseTimings* _phase_timings; 391 392 ShenandoahControlThread* control_thread() { return _control_thread; } 393 394 public: 395 ShenandoahCollectorPolicy* shenandoah_policy() const { return _shenandoah_policy; } 396 ShenandoahMode* mode() const { return _gc_mode; } 397 ShenandoahHeuristics* heuristics() const { return _heuristics; } 398 ShenandoahFreeSet* free_set() const { return _free_set; } 399 ShenandoahPacer* pacer() const { return _pacer; } 400 401 ShenandoahPhaseTimings* phase_timings() const { return _phase_timings; } 402 403 ShenandoahVerifier* verifier(); 404 405 // ---------- VM subsystem bindings 406 // 407 private: 408 ShenandoahMonitoringSupport* _monitoring_support; 409 MemoryPool* _memory_pool; 410 GCMemoryManager _stw_memory_manager; 411 GCMemoryManager _cycle_memory_manager; 412 ConcurrentGCTimer* _gc_timer; 413 SoftRefPolicy _soft_ref_policy; 414 415 // For exporting to SA 416 int _log_min_obj_alignment_in_bytes; 417 public: 418 ShenandoahMonitoringSupport* monitoring_support() { return _monitoring_support; } 419 GCMemoryManager* cycle_memory_manager() { return &_cycle_memory_manager; } 420 GCMemoryManager* stw_memory_manager() { return &_stw_memory_manager; } 421 SoftRefPolicy* soft_ref_policy() override { return &_soft_ref_policy; } 422 423 GrowableArray<GCMemoryManager*> memory_managers() override; 424 GrowableArray<MemoryPool*> memory_pools() override; 425 MemoryUsage memory_usage() override; 426 GCTracer* tracer(); 427 ConcurrentGCTimer* gc_timer() const; 428 429 // ---------- Reference processing 430 // 431 private: 432 ShenandoahReferenceProcessor* const _ref_processor; 433 434 public: 435 ShenandoahReferenceProcessor* ref_processor() { return _ref_processor; } 436 437 // ---------- Class Unloading 438 // 439 private: 440 ShenandoahSharedFlag _unload_classes; 441 ShenandoahUnload _unloader; 442 443 public: 444 void set_unload_classes(bool uc); 445 bool unload_classes() const; 446 447 // Perform STW class unloading and weak root cleaning 448 void parallel_cleaning(bool full_gc); 449 450 private: 451 void stw_unload_classes(bool full_gc); 452 void stw_process_weak_roots(bool full_gc); 453 void stw_weak_refs(bool full_gc); 454 455 // Heap iteration support 456 void scan_roots_for_iteration(ShenandoahScanObjectStack* oop_stack, ObjectIterateScanRootClosure* oops); 457 bool prepare_aux_bitmap_for_iteration(); 458 void reclaim_aux_bitmap_for_iteration(); 459 460 // ---------- Generic interface hooks 461 // Minor things that super-interface expects us to implement to play nice with 462 // the rest of runtime. Some of the things here are not required to be implemented, 463 // and can be stubbed out. 464 // 465 public: 466 bool is_maximal_no_gc() const override shenandoah_not_implemented_return(false); 467 468 bool is_in(const void* p) const override; 469 470 bool requires_barriers(stackChunkOop obj) const override; 471 472 MemRegion reserved_region() const { return _reserved; } 473 bool is_in_reserved(const void* addr) const { return _reserved.contains(addr); } 474 475 void collect(GCCause::Cause cause) override; 476 void do_full_collection(bool clear_all_soft_refs) override; 477 478 // Used for parsing heap during error printing 479 HeapWord* block_start(const void* addr) const; 480 bool block_is_obj(const HeapWord* addr) const; 481 bool print_location(outputStream* st, void* addr) const override; 482 483 // Used for native heap walkers: heap dumpers, mostly 484 void object_iterate(ObjectClosure* cl) override; 485 // Parallel heap iteration support 486 ParallelObjectIteratorImpl* parallel_object_iterator(uint workers) override; 487 488 // Keep alive an object that was loaded with AS_NO_KEEPALIVE. 489 void keep_alive(oop obj) override; 490 491 // ---------- Safepoint interface hooks 492 // 493 public: 494 void safepoint_synchronize_begin() override; 495 void safepoint_synchronize_end() override; 496 497 // ---------- Code roots handling hooks 498 // 499 public: 500 void register_nmethod(nmethod* nm) override; 501 void unregister_nmethod(nmethod* nm) override; 502 void verify_nmethod(nmethod* nm) override {} 503 504 // ---------- Pinning hooks 505 // 506 public: 507 // Shenandoah supports per-object (per-region) pinning 508 void pin_object(JavaThread* thread, oop obj) override; 509 void unpin_object(JavaThread* thread, oop obj) override; 510 511 void sync_pinned_region_status(); 512 void assert_pinned_region_status() NOT_DEBUG_RETURN; 513 514 // ---------- Concurrent Stack Processing support 515 // 516 public: 517 bool uses_stack_watermark_barrier() const override { return true; } 518 519 // ---------- Allocation support 520 // 521 private: 522 HeapWord* allocate_memory_under_lock(ShenandoahAllocRequest& request, bool& in_new_region); 523 inline HeapWord* allocate_from_gclab(Thread* thread, size_t size); 524 HeapWord* allocate_from_gclab_slow(Thread* thread, size_t size); 525 HeapWord* allocate_new_gclab(size_t min_size, size_t word_size, size_t* actual_size); 526 527 public: 528 HeapWord* allocate_memory(ShenandoahAllocRequest& request); 529 HeapWord* mem_allocate(size_t size, bool* what) override; 530 MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, 531 size_t size, 532 Metaspace::MetadataType mdtype) override; 533 534 void notify_mutator_alloc_words(size_t words, bool waste); 535 536 HeapWord* allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) override; 537 size_t tlab_capacity(Thread *thr) const override; 538 size_t unsafe_max_tlab_alloc(Thread *thread) const override; 539 size_t max_tlab_size() const override; 540 size_t tlab_used(Thread* ignored) const override; 541 542 void ensure_parsability(bool retire_labs) override; 543 544 void labs_make_parsable(); 545 void tlabs_retire(bool resize); 546 void gclabs_retire(bool resize); 547 548 // ---------- Marking support 549 // 550 private: 551 ShenandoahMarkingContext* _marking_context; 552 MemRegion _bitmap_region; 553 MemRegion _aux_bitmap_region; 554 MarkBitMap _verification_bit_map; 555 MarkBitMap _aux_bit_map; 556 557 size_t _bitmap_size; 558 size_t _bitmap_regions_per_slice; 559 size_t _bitmap_bytes_per_slice; 560 561 size_t _pretouch_heap_page_size; 562 size_t _pretouch_bitmap_page_size; 563 564 bool _bitmap_region_special; 565 bool _aux_bitmap_region_special; 566 567 ShenandoahLiveData** _liveness_cache; 568 569 public: 570 inline ShenandoahMarkingContext* complete_marking_context() const; 571 inline ShenandoahMarkingContext* marking_context() const; 572 inline void mark_complete_marking_context(); 573 inline void mark_incomplete_marking_context(); 574 575 template<class T> 576 inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl); 577 578 template<class T> 579 inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit); 580 581 template<class T> 582 inline void marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit); 583 584 void reset_mark_bitmap(); 585 586 // SATB barriers hooks 587 inline bool requires_marking(const void* entry) const; 588 589 // Support for bitmap uncommits 590 bool commit_bitmap_slice(ShenandoahHeapRegion *r); 591 bool uncommit_bitmap_slice(ShenandoahHeapRegion *r); 592 bool is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self = false); 593 594 // Liveness caching support 595 ShenandoahLiveData* get_liveness_cache(uint worker_id); 596 void flush_liveness_cache(uint worker_id); 597 598 size_t pretouch_heap_page_size() { return _pretouch_heap_page_size; } 599 600 // ---------- Evacuation support 601 // 602 private: 603 ShenandoahCollectionSet* _collection_set; 604 ShenandoahEvacOOMHandler _oom_evac_handler; 605 606 public: 607 static address in_cset_fast_test_addr(); 608 609 ShenandoahCollectionSet* collection_set() const { return _collection_set; } 610 611 // Checks if object is in the collection set. 612 inline bool in_collection_set(oop obj) const; 613 614 // Checks if location is in the collection set. Can be interior pointer, not the oop itself. 615 inline bool in_collection_set_loc(void* loc) const; 616 617 // Evacuates object src. Returns the evacuated object, either evacuated 618 // by this thread, or by some other thread. 619 inline oop evacuate_object(oop src, Thread* thread); 620 621 // Call before/after evacuation. 622 inline void enter_evacuation(Thread* t); 623 inline void leave_evacuation(Thread* t); 624 625 // ---------- Helper functions 626 // 627 public: 628 template <class T> 629 inline void conc_update_with_forwarded(T* p); 630 631 template <class T> 632 inline void update_with_forwarded(T* p); 633 634 static inline void atomic_update_oop(oop update, oop* addr, oop compare); 635 static inline void atomic_update_oop(oop update, narrowOop* addr, oop compare); 636 static inline void atomic_update_oop(oop update, narrowOop* addr, narrowOop compare); 637 638 static inline bool atomic_update_oop_check(oop update, oop* addr, oop compare); 639 static inline bool atomic_update_oop_check(oop update, narrowOop* addr, oop compare); 640 static inline bool atomic_update_oop_check(oop update, narrowOop* addr, narrowOop compare); 641 642 static inline void atomic_clear_oop( oop* addr, oop compare); 643 static inline void atomic_clear_oop(narrowOop* addr, oop compare); 644 static inline void atomic_clear_oop(narrowOop* addr, narrowOop compare); 645 646 void trash_humongous_region_at(ShenandoahHeapRegion *r); 647 648 private: 649 void trash_cset_regions(); 650 651 // ---------- Testing helpers functions 652 // 653 private: 654 ShenandoahSharedFlag _inject_alloc_failure; 655 656 void try_inject_alloc_failure(); 657 bool should_inject_alloc_failure(); 658 }; 659 660 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHHEAP_HPP