1 /* 2 * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_HPP 25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_HPP 26 27 #include "gc_implementation/shared/markBitMap.hpp" 28 #include "gc_implementation/shenandoah/shenandoahAsserts.hpp" 29 #include "gc_implementation/shenandoah/shenandoahAllocRequest.hpp" 30 #include "gc_implementation/shenandoah/shenandoahHeapLock.hpp" 31 #include "gc_implementation/shenandoah/shenandoahEvacOOMHandler.hpp" 32 #include "gc_implementation/shenandoah/shenandoahSharedVariables.hpp" 33 34 class ConcurrentGCTimer; 35 36 class ShenandoahAllocTracker; 37 class ShenandoahCollectionSet; 38 class ShenandoahCollectorPolicy; 39 class ShenandoahConcurrentMark; 40 class ShenandoahControlThread; 41 class ShenandoahGCSession; 42 class ShenandoahFreeSet; 43 class ShenandoahHeapRegion; 44 class ShenandoahHeapRegionClosure; 45 class ShenandoahMarkCompact; 46 class ShenandoahMonitoringSupport; 47 class ShenandoahHeuristics; 48 class ShenandoahMarkingContext; 49 class ShenandoahPhaseTimings; 50 class ShenandoahPacer; 51 class ShenandoahVerifier; 52 class ShenandoahWorkGang; 53 class VMStructs; 54 55 class ShenandoahRegionIterator : public StackObj { 56 private: 57 ShenandoahHeap* _heap; 58 59 char _pad0[DEFAULT_CACHE_LINE_SIZE]; 60 volatile jint _index; 61 char _pad1[DEFAULT_CACHE_LINE_SIZE]; 62 63 // No implicit copying: iterators should be passed by reference to capture the state 64 ShenandoahRegionIterator(const ShenandoahRegionIterator& that); 65 ShenandoahRegionIterator& operator=(const ShenandoahRegionIterator& o); 66 67 public: 68 ShenandoahRegionIterator(); 69 ShenandoahRegionIterator(ShenandoahHeap* heap); 70 71 // Reset iterator to default state 72 void reset(); 73 74 // Returns next region, or NULL if there are no more regions. 75 // This is multi-thread-safe. 76 inline ShenandoahHeapRegion* next(); 77 78 // This is *not* MT safe. However, in the absence of multithreaded access, it 79 // can be used to determine if there is more work to do. 80 bool has_next() const; 81 }; 82 83 class ShenandoahHeapRegionClosure : public StackObj { 84 public: 85 virtual void heap_region_do(ShenandoahHeapRegion* r) = 0; 86 virtual bool is_thread_safe() { return false; } 87 }; 88 89 class ShenandoahUpdateRefsClosure: public OopClosure { 90 private: 91 ShenandoahHeap* _heap; 92 93 template <class T> 94 inline void do_oop_work(T* p); 95 96 public: 97 ShenandoahUpdateRefsClosure(); 98 inline void do_oop(oop* p); 99 inline void do_oop(narrowOop* p); 100 }; 101 102 #ifdef ASSERT 103 class ShenandoahAssertToSpaceClosure : public OopClosure { 104 private: 105 template <class T> 106 void do_oop_nv(T* p); 107 public: 108 void do_oop(narrowOop* p); 109 void do_oop(oop* p); 110 }; 111 #endif 112 113 class ShenandoahAlwaysTrueClosure : public BoolObjectClosure { 114 public: 115 bool do_object_b(oop p) { return true; } 116 }; 117 118 class ShenandoahForwardedIsAliveClosure: public BoolObjectClosure { 119 private: 120 ShenandoahMarkingContext* const _mark_context; 121 public: 122 ShenandoahForwardedIsAliveClosure(); 123 bool do_object_b(oop obj); 124 }; 125 126 class ShenandoahIsAliveClosure: public BoolObjectClosure { 127 private: 128 ShenandoahMarkingContext* const _mark_context; 129 public: 130 ShenandoahIsAliveClosure(); 131 bool do_object_b(oop obj); 132 }; 133 134 class ShenandoahIsAliveSelector : public StackObj { 135 private: 136 ShenandoahIsAliveClosure _alive_cl; 137 ShenandoahForwardedIsAliveClosure _fwd_alive_cl; 138 public: 139 BoolObjectClosure* is_alive_closure(); 140 }; 141 142 // Shenandoah GC is low-pause concurrent GC that uses Brooks forwarding pointers 143 // to encode forwarding data. See BrooksPointer for details on forwarding data encoding. 144 // See ShenandoahControlThread for GC cycle structure. 145 // 146 class ShenandoahHeap : public SharedHeap { 147 friend class ShenandoahAsserts; 148 friend class VMStructs; 149 friend class ShenandoahGCSession; 150 151 // ---------- Locks that guard important data structures in Heap 152 // 153 private: 154 ShenandoahHeapLock _lock; 155 156 public: 157 ShenandoahHeapLock* lock() { 158 return &_lock; 159 } 160 161 void assert_heaplock_owned_by_current_thread() NOT_DEBUG_RETURN; 162 void assert_heaplock_not_owned_by_current_thread() NOT_DEBUG_RETURN; 163 void assert_heaplock_or_safepoint() NOT_DEBUG_RETURN; 164 165 // ---------- Initialization, termination, identification, printing routines 166 // 167 public: 168 static ShenandoahHeap* heap(); 169 static ShenandoahHeap* heap_no_check(); 170 static size_t conservative_max_heap_alignment(); 171 172 const char* name() const { return "Shenandoah"; } 173 ShenandoahHeap::Name kind() const { return CollectedHeap::ShenandoahHeap; } 174 175 ShenandoahHeap(ShenandoahCollectorPolicy* policy); 176 jint initialize(); 177 void post_initialize(); 178 void initialize_heuristics(); 179 180 void print_on(outputStream* st) const; 181 void print_extended_on(outputStream *st) const; 182 void print_tracing_info() const; 183 void print_gc_threads_on(outputStream* st) const; 184 void print_heap_regions_on(outputStream* st) const; 185 186 void stop(); 187 188 void prepare_for_verify(); 189 void verify(bool silent, VerifyOption vo); 190 191 // ---------- Heap counters and metrics 192 // 193 private: 194 size_t _initial_size; 195 char _pad0[DEFAULT_CACHE_LINE_SIZE]; 196 volatile jlong _used; 197 volatile size_t _committed; 198 volatile jlong _bytes_allocated_since_gc_start; 199 char _pad1[DEFAULT_CACHE_LINE_SIZE]; 200 201 public: 202 void increase_used(size_t bytes); 203 void decrease_used(size_t bytes); 204 void set_used(size_t bytes); 205 206 void increase_committed(size_t bytes); 207 void decrease_committed(size_t bytes); 208 void increase_allocated(size_t bytes); 209 210 size_t bytes_allocated_since_gc_start(); 211 void reset_bytes_allocated_since_gc_start(); 212 213 size_t max_capacity() const; 214 size_t initial_capacity() const; 215 size_t capacity() const; 216 size_t used() const; 217 size_t committed() const; 218 219 // ---------- Workers handling 220 // 221 private: 222 uint _max_workers; 223 ShenandoahWorkGang* _workers; 224 225 public: 226 uint max_workers(); 227 void assert_gc_workers(uint nworker) NOT_DEBUG_RETURN; 228 229 ShenandoahWorkGang* workers() const; 230 231 void gc_threads_do(ThreadClosure* tcl) const; 232 233 // ---------- Heap regions handling machinery 234 // 235 private: 236 MemRegion _heap_region; 237 size_t _num_regions; 238 ShenandoahHeapRegion** _regions; 239 ShenandoahRegionIterator _update_refs_iterator; 240 241 public: 242 inline size_t num_regions() const { return _num_regions; } 243 244 inline ShenandoahHeapRegion* const heap_region_containing(const void* addr) const; 245 inline size_t heap_region_index_containing(const void* addr) const; 246 247 inline ShenandoahHeapRegion* const get_region(size_t region_idx) const; 248 249 void heap_region_iterate(ShenandoahHeapRegionClosure* blk) const; 250 void parallel_heap_region_iterate(ShenandoahHeapRegionClosure* blk) const; 251 252 // ---------- GC state machinery 253 // 254 // GC state describes the important parts of collector state, that may be 255 // used to make barrier selection decisions in the native and generated code. 256 // Multiple bits can be set at once. 257 // 258 // Important invariant: when GC state is zero, the heap is stable, and no barriers 259 // are required. 260 // 261 public: 262 enum GCStateBitPos { 263 // Heap has forwarded objects: need RB, ACMP, CAS barriers. 264 HAS_FORWARDED_BITPOS = 0, 265 266 // Heap is under marking: needs SATB barriers. 267 MARKING_BITPOS = 1, 268 269 // Heap is under evacuation: needs WB barriers. (Set together with UNSTABLE) 270 EVACUATION_BITPOS = 2, 271 272 // Heap is under updating: needs SVRB/SVWB barriers. 273 UPDATEREFS_BITPOS = 3, 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 }; 283 284 private: 285 ShenandoahSharedBitmap _gc_state; 286 ShenandoahSharedFlag _degenerated_gc_in_progress; 287 ShenandoahSharedFlag _full_gc_in_progress; 288 ShenandoahSharedFlag _full_gc_move_in_progress; 289 ShenandoahSharedFlag _progress_last_gc; 290 291 void set_gc_state_mask(uint mask, bool value); 292 293 public: 294 char gc_state(); 295 static address gc_state_addr(); 296 297 void set_concurrent_mark_in_progress(bool in_progress); 298 void set_evacuation_in_progress(bool in_progress); 299 void set_update_refs_in_progress(bool in_progress); 300 void set_degenerated_gc_in_progress(bool in_progress); 301 void set_full_gc_in_progress(bool in_progress); 302 void set_full_gc_move_in_progress(bool in_progress); 303 void set_has_forwarded_objects(bool cond); 304 305 inline bool is_stable() const; 306 inline bool is_idle() const; 307 inline bool is_concurrent_mark_in_progress() const; 308 inline bool is_update_refs_in_progress() const; 309 inline bool is_evacuation_in_progress() const; 310 inline bool is_degenerated_gc_in_progress() const; 311 inline bool is_full_gc_in_progress() const; 312 inline bool is_full_gc_move_in_progress() const; 313 inline bool has_forwarded_objects() const; 314 inline bool is_gc_in_progress_mask(uint mask) const; 315 316 // ---------- GC cancellation and degeneration machinery 317 // 318 // Cancelled GC flag is used to notify concurrent phases that they should terminate. 319 // 320 public: 321 enum ShenandoahDegenPoint { 322 _degenerated_unset, 323 _degenerated_outside_cycle, 324 _degenerated_mark, 325 _degenerated_evac, 326 _degenerated_updaterefs, 327 _DEGENERATED_LIMIT, 328 }; 329 330 static const char* degen_point_to_string(ShenandoahDegenPoint point) { 331 switch (point) { 332 case _degenerated_unset: 333 return "<UNSET>"; 334 case _degenerated_outside_cycle: 335 return "Outside of Cycle"; 336 case _degenerated_mark: 337 return "Mark"; 338 case _degenerated_evac: 339 return "Evacuation"; 340 case _degenerated_updaterefs: 341 return "Update Refs"; 342 default: 343 ShouldNotReachHere(); 344 return "ERROR"; 345 } 346 }; 347 348 private: 349 ShenandoahSharedFlag _cancelled_gc; 350 inline bool try_cancel_gc(); 351 352 public: 353 static address cancelled_gc_addr(); 354 355 inline bool cancelled_gc() const; 356 357 inline void clear_cancelled_gc(); 358 359 void cancel_gc(GCCause::Cause cause); 360 361 // ---------- GC operations entry points 362 // 363 public: 364 // Entry points to STW GC operations, these cause a related safepoint, that then 365 // call the entry method below 366 void vmop_entry_init_mark(); 367 void vmop_entry_final_mark(); 368 void vmop_entry_final_evac(); 369 void vmop_entry_init_updaterefs(); 370 void vmop_entry_final_updaterefs(); 371 void vmop_entry_full(GCCause::Cause cause); 372 void vmop_degenerated(ShenandoahDegenPoint point); 373 374 // Entry methods to normally STW GC operations. These set up logging, monitoring 375 // and workers for net VM operation 376 void entry_init_mark(); 377 void entry_final_mark(); 378 void entry_final_evac(); 379 void entry_init_updaterefs(); 380 void entry_final_updaterefs(); 381 void entry_full(GCCause::Cause cause); 382 void entry_degenerated(int point); 383 384 // Entry methods to normally concurrent GC operations. These set up logging, monitoring 385 // for concurrent operation. 386 void entry_reset(); 387 void entry_mark(); 388 void entry_preclean(); 389 void entry_cleanup(); 390 void entry_evac(); 391 void entry_updaterefs(); 392 void entry_uncommit(double shrink_before); 393 394 private: 395 // Actual work for the phases 396 void op_init_mark(); 397 void op_final_mark(); 398 void op_final_evac(); 399 void op_init_updaterefs(); 400 void op_final_updaterefs(); 401 void op_full(GCCause::Cause cause); 402 void op_degenerated(ShenandoahDegenPoint point); 403 void op_degenerated_fail(); 404 void op_degenerated_futile(); 405 406 void op_reset(); 407 void op_mark(); 408 void op_preclean(); 409 void op_cleanup(); 410 void op_conc_evac(); 411 void op_stw_evac(); 412 void op_updaterefs(); 413 void op_uncommit(double shrink_before); 414 415 // Messages for GC trace event, they have to be immortal for 416 // passing around the logging/tracing systems 417 const char* init_mark_event_message() const; 418 const char* final_mark_event_message() const; 419 const char* conc_mark_event_message() const; 420 const char* degen_event_message(ShenandoahDegenPoint point) const; 421 422 // ---------- GC subsystems 423 // 424 private: 425 ShenandoahControlThread* _control_thread; 426 ShenandoahCollectorPolicy* _shenandoah_policy; 427 ShenandoahHeuristics* _heuristics; 428 ShenandoahFreeSet* _free_set; 429 ShenandoahConcurrentMark* _scm; 430 ShenandoahMarkCompact* _full_gc; 431 ShenandoahPacer* _pacer; 432 ShenandoahVerifier* _verifier; 433 434 ShenandoahAllocTracker* _alloc_tracker; 435 ShenandoahPhaseTimings* _phase_timings; 436 437 ShenandoahControlThread* control_thread() { return _control_thread; } 438 ShenandoahMarkCompact* full_gc() { return _full_gc; } 439 440 public: 441 ShenandoahCollectorPolicy* shenandoah_policy() const { return _shenandoah_policy; } 442 ShenandoahHeuristics* heuristics() const { return _heuristics; } 443 ShenandoahFreeSet* free_set() const { return _free_set; } 444 ShenandoahConcurrentMark* concurrent_mark() { return _scm; } 445 ShenandoahPacer* pacer() const { return _pacer; } 446 447 ShenandoahPhaseTimings* phase_timings() const { return _phase_timings; } 448 ShenandoahAllocTracker* alloc_tracker() const { return _alloc_tracker; } 449 450 ShenandoahVerifier* verifier(); 451 452 // ---------- VM subsystem bindings 453 // 454 private: 455 ShenandoahMonitoringSupport* _monitoring_support; 456 ConcurrentGCTimer* _gc_timer; 457 458 public: 459 ShenandoahMonitoringSupport* monitoring_support() { return _monitoring_support; } 460 461 GCTracer* tracer(); 462 GCTimer* gc_timer() const; 463 CollectorPolicy* collector_policy() const; 464 465 // ---------- Reference processing 466 // 467 private: 468 ReferenceProcessor* _ref_processor; 469 ShenandoahSharedFlag _process_references; 470 471 void ref_processing_init(); 472 473 public: 474 ReferenceProcessor* ref_processor() { return _ref_processor;} 475 void set_process_references(bool pr); 476 bool process_references() const; 477 478 // ---------- Class Unloading 479 // 480 private: 481 ShenandoahSharedFlag _unload_classes; 482 483 public: 484 void set_unload_classes(bool uc); 485 bool unload_classes() const; 486 487 // Delete entries for dead interned string and clean up unreferenced symbols 488 // in symbol table, possibly in parallel. 489 void unload_classes_and_cleanup_tables(bool full_gc); 490 491 // ---------- Generic interface hooks 492 // Minor things that super-interface expects us to implement to play nice with 493 // the rest of runtime. Some of the things here are not required to be implemented, 494 // and can be stubbed out. 495 // 496 public: 497 AdaptiveSizePolicy* size_policy() shenandoah_not_implemented_return(NULL); 498 bool is_maximal_no_gc() const shenandoah_not_implemented_return(false); 499 500 bool is_in(const void* p) const; 501 502 // All objects can potentially move 503 bool is_scavengable(const void* addr) { return true; } 504 505 void collect(GCCause::Cause cause); 506 void do_full_collection(bool clear_all_soft_refs); 507 508 // Used for parsing heap during error printing 509 HeapWord* block_start(const void* addr) const; 510 size_t block_size(const HeapWord* addr) const; 511 bool block_is_obj(const HeapWord* addr) const; 512 513 // Used for native heap walkers: heap dumpers, mostly 514 void object_iterate(ObjectClosure* cl); 515 void safe_object_iterate(ObjectClosure* cl); 516 void space_iterate(SpaceClosure* scl); 517 void oop_iterate(ExtendedOopClosure* cl); 518 Space* space_containing(const void* oop) const; 519 520 // Used by RMI 521 jlong millis_since_last_gc(); 522 523 bool can_elide_tlab_store_barriers() const { return true; } 524 oop new_store_pre_barrier(JavaThread* thread, oop new_obj) { return new_obj; } 525 bool can_elide_initializing_store_barrier(oop new_obj) { return true; } 526 bool card_mark_must_follow_store() const { return false; } 527 528 bool is_in_partial_collection(const void* p) shenandoah_not_implemented_return(false); 529 bool supports_heap_inspection() const { return true; } 530 531 void gc_prologue(bool b); 532 void gc_epilogue(bool b); 533 534 void acquire_pending_refs_lock(); 535 void release_pending_refs_lock(); 536 537 // ---------- Code roots handling hooks 538 // 539 public: 540 void register_nmethod(nmethod* nm); 541 void unregister_nmethod(nmethod* nm); 542 543 // ---------- Pinning hooks 544 // 545 public: 546 // Shenandoah supports per-object (per-region) pinning 547 bool supports_object_pinning() const { return true; } 548 549 oop pin_object(JavaThread* thread, oop obj); 550 void unpin_object(JavaThread* thread, oop obj); 551 552 // ---------- Allocation support 553 // 554 private: 555 HeapWord* allocate_memory_under_lock(ShenandoahAllocRequest& request, bool& in_new_region); 556 inline HeapWord* allocate_from_gclab(Thread* thread, size_t size); 557 HeapWord* allocate_from_gclab_slow(Thread* thread, size_t size); 558 HeapWord* allocate_new_gclab(size_t min_size, size_t word_size, size_t* actual_size); 559 560 public: 561 #ifndef CC_INTERP 562 void compile_prepare_oop(MacroAssembler* masm, Register obj); 563 #endif 564 565 HeapWord* allocate_memory(ShenandoahAllocRequest& request); 566 HeapWord* mem_allocate(size_t size, bool* what); 567 568 uint oop_extra_words(); 569 570 void notify_mutator_alloc_words(size_t words, bool waste); 571 572 // Shenandoah supports TLAB allocation 573 bool supports_tlab_allocation() const { return true; } 574 575 HeapWord* allocate_new_tlab(size_t word_size); 576 size_t tlab_capacity(Thread *thr) const; 577 size_t unsafe_max_tlab_alloc(Thread *thread) const; 578 size_t max_tlab_size() const; 579 size_t tlab_used(Thread* ignored) const; 580 581 HeapWord* tlab_post_allocation_setup(HeapWord* obj); 582 583 void resize_tlabs(); 584 void resize_all_tlabs(); 585 586 void accumulate_statistics_tlabs(); 587 void accumulate_statistics_all_gclabs(); 588 589 void make_parsable(bool retire_tlabs); 590 void ensure_parsability(bool retire_tlabs); 591 592 // ---------- Marking support 593 // 594 private: 595 ShenandoahMarkingContext* _marking_context; 596 MemRegion _bitmap_region; 597 MemRegion _aux_bitmap_region; 598 MarkBitMap _verification_bit_map; 599 MarkBitMap _aux_bit_map; 600 601 size_t _bitmap_size; 602 size_t _bitmap_regions_per_slice; 603 size_t _bitmap_bytes_per_slice; 604 605 // Used for buffering per-region liveness data. 606 // Needed since ShenandoahHeapRegion uses atomics to update liveness. 607 // 608 // The array has max-workers elements, each of which is an array of 609 // jushort * max_regions. The choice of jushort is not accidental: 610 // there is a tradeoff between static/dynamic footprint that translates 611 // into cache pressure (which is already high during marking), and 612 // too many atomic updates. size_t/jint is too large, jbyte is too small. 613 jushort** _liveness_cache; 614 615 public: 616 inline ShenandoahMarkingContext* complete_marking_context() const; 617 inline ShenandoahMarkingContext* marking_context() const; 618 inline void mark_complete_marking_context(); 619 inline void mark_incomplete_marking_context(); 620 621 template<class T> 622 inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl); 623 624 template<class T> 625 inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit); 626 627 template<class T> 628 inline void marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit); 629 630 void reset_mark_bitmap(); 631 632 // SATB barriers hooks 633 inline bool requires_marking(const void* entry) const; 634 void force_satb_flush_all_threads(); 635 636 // Support for bitmap uncommits 637 bool commit_bitmap_slice(ShenandoahHeapRegion *r); 638 bool uncommit_bitmap_slice(ShenandoahHeapRegion *r); 639 bool is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self = false); 640 641 // Liveness caching support 642 jushort* get_liveness_cache(uint worker_id); 643 void flush_liveness_cache(uint worker_id); 644 645 // ---------- Evacuation support 646 // 647 private: 648 ShenandoahCollectionSet* _collection_set; 649 ShenandoahEvacOOMHandler _oom_evac_handler; 650 651 void evacuate_and_update_roots(); 652 653 public: 654 static address in_cset_fast_test_addr(); 655 656 ShenandoahCollectionSet* collection_set() const { return _collection_set; } 657 658 template <class T> 659 inline bool in_collection_set(T obj) const; 660 661 // Avoid accidentally calling the method above with ShenandoahHeapRegion*, which would be *wrong*. 662 inline bool in_collection_set(ShenandoahHeapRegion* r) shenandoah_not_implemented_return(false); 663 664 // Evacuates object src. Returns the evacuated object, either evacuated 665 // by this thread, or by some other thread. 666 inline oop evacuate_object(oop src, Thread* thread, bool& evacuated); 667 668 // Call before/after evacuation. 669 void enter_evacuation(); 670 void leave_evacuation(); 671 672 // ---------- Helper functions 673 // 674 public: 675 template <class T> 676 inline oop maybe_update_with_forwarded(T* p); 677 678 template <class T> 679 inline oop maybe_update_with_forwarded_not_null(T* p, oop obj); 680 681 template <class T> 682 inline oop update_with_forwarded_not_null(T* p, oop obj); 683 684 inline oop atomic_compare_exchange_oop(oop n, narrowOop* addr, oop c); 685 inline oop atomic_compare_exchange_oop(oop n, oop* addr, oop c); 686 687 void trash_humongous_region_at(ShenandoahHeapRegion *r); 688 689 void stop_concurrent_marking(); 690 691 void roots_iterate(OopClosure* cl); 692 693 private: 694 void trash_cset_regions(); 695 void update_heap_references(bool concurrent); 696 697 // ---------- Testing helpers functions 698 // 699 private: 700 ShenandoahSharedFlag _inject_alloc_failure; 701 702 void try_inject_alloc_failure(); 703 bool should_inject_alloc_failure(); 704 }; 705 706 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_HPP