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 bool _heap_region_special; 238 size_t _num_regions; 239 ShenandoahHeapRegion** _regions; 240 ShenandoahRegionIterator _update_refs_iterator; 241 242 public: 243 inline size_t num_regions() const { return _num_regions; } 244 inline bool is_heap_region_special() { return _heap_region_special; } 245 246 inline ShenandoahHeapRegion* const heap_region_containing(const void* addr) const; 247 inline size_t heap_region_index_containing(const void* addr) const; 248 249 inline ShenandoahHeapRegion* const get_region(size_t region_idx) const; 250 251 void heap_region_iterate(ShenandoahHeapRegionClosure* blk) const; 252 void parallel_heap_region_iterate(ShenandoahHeapRegionClosure* blk) const; 253 254 // ---------- GC state machinery 255 // 256 // GC state describes the important parts of collector state, that may be 257 // used to make barrier selection decisions in the native and generated code. 258 // Multiple bits can be set at once. 259 // 260 // Important invariant: when GC state is zero, the heap is stable, and no barriers 261 // are required. 262 // 263 public: 264 enum GCStateBitPos { 265 // Heap has forwarded objects: need RB, ACMP, CAS barriers. 266 HAS_FORWARDED_BITPOS = 0, 267 268 // Heap is under marking: needs SATB barriers. 269 MARKING_BITPOS = 1, 270 271 // Heap is under evacuation: needs WB barriers. (Set together with UNSTABLE) 272 EVACUATION_BITPOS = 2, 273 274 // Heap is under updating: needs SVRB/SVWB barriers. 275 UPDATEREFS_BITPOS = 3, 276 }; 277 278 enum GCState { 279 STABLE = 0, 280 HAS_FORWARDED = 1 << HAS_FORWARDED_BITPOS, 281 MARKING = 1 << MARKING_BITPOS, 282 EVACUATION = 1 << EVACUATION_BITPOS, 283 UPDATEREFS = 1 << UPDATEREFS_BITPOS, 284 }; 285 286 private: 287 ShenandoahSharedBitmap _gc_state; 288 ShenandoahSharedFlag _degenerated_gc_in_progress; 289 ShenandoahSharedFlag _full_gc_in_progress; 290 ShenandoahSharedFlag _full_gc_move_in_progress; 291 ShenandoahSharedFlag _progress_last_gc; 292 293 void set_gc_state_mask(uint mask, bool value); 294 295 public: 296 char gc_state(); 297 static address gc_state_addr(); 298 299 void set_concurrent_mark_in_progress(bool in_progress); 300 void set_evacuation_in_progress(bool in_progress); 301 void set_update_refs_in_progress(bool in_progress); 302 void set_degenerated_gc_in_progress(bool in_progress); 303 void set_full_gc_in_progress(bool in_progress); 304 void set_full_gc_move_in_progress(bool in_progress); 305 void set_has_forwarded_objects(bool cond); 306 307 inline bool is_stable() const; 308 inline bool is_idle() const; 309 inline bool is_concurrent_mark_in_progress() const; 310 inline bool is_update_refs_in_progress() const; 311 inline bool is_evacuation_in_progress() const; 312 inline bool is_degenerated_gc_in_progress() const; 313 inline bool is_full_gc_in_progress() const; 314 inline bool is_full_gc_move_in_progress() const; 315 inline bool has_forwarded_objects() const; 316 inline bool is_gc_in_progress_mask(uint mask) const; 317 318 // ---------- GC cancellation and degeneration machinery 319 // 320 // Cancelled GC flag is used to notify concurrent phases that they should terminate. 321 // 322 public: 323 enum ShenandoahDegenPoint { 324 _degenerated_unset, 325 _degenerated_outside_cycle, 326 _degenerated_mark, 327 _degenerated_evac, 328 _degenerated_updaterefs, 329 _DEGENERATED_LIMIT, 330 }; 331 332 static const char* degen_point_to_string(ShenandoahDegenPoint point) { 333 switch (point) { 334 case _degenerated_unset: 335 return "<UNSET>"; 336 case _degenerated_outside_cycle: 337 return "Outside of Cycle"; 338 case _degenerated_mark: 339 return "Mark"; 340 case _degenerated_evac: 341 return "Evacuation"; 342 case _degenerated_updaterefs: 343 return "Update Refs"; 344 default: 345 ShouldNotReachHere(); 346 return "ERROR"; 347 } 348 }; 349 350 private: 351 ShenandoahSharedFlag _cancelled_gc; 352 inline bool try_cancel_gc(); 353 354 public: 355 static address cancelled_gc_addr(); 356 357 inline bool cancelled_gc() const; 358 359 inline void clear_cancelled_gc(); 360 361 void cancel_gc(GCCause::Cause cause); 362 363 // ---------- GC operations entry points 364 // 365 public: 366 // Entry points to STW GC operations, these cause a related safepoint, that then 367 // call the entry method below 368 void vmop_entry_init_mark(); 369 void vmop_entry_final_mark(); 370 void vmop_entry_final_evac(); 371 void vmop_entry_init_updaterefs(); 372 void vmop_entry_final_updaterefs(); 373 void vmop_entry_full(GCCause::Cause cause); 374 void vmop_degenerated(ShenandoahDegenPoint point); 375 376 // Entry methods to normally STW GC operations. These set up logging, monitoring 377 // and workers for net VM operation 378 void entry_init_mark(); 379 void entry_final_mark(); 380 void entry_final_evac(); 381 void entry_init_updaterefs(); 382 void entry_final_updaterefs(); 383 void entry_full(GCCause::Cause cause); 384 void entry_degenerated(int point); 385 386 // Entry methods to normally concurrent GC operations. These set up logging, monitoring 387 // for concurrent operation. 388 void entry_reset(); 389 void entry_mark(); 390 void entry_preclean(); 391 void entry_cleanup(); 392 void entry_evac(); 393 void entry_updaterefs(); 394 void entry_uncommit(double shrink_before); 395 396 private: 397 // Actual work for the phases 398 void op_init_mark(); 399 void op_final_mark(); 400 void op_final_evac(); 401 void op_init_updaterefs(); 402 void op_final_updaterefs(); 403 void op_full(GCCause::Cause cause); 404 void op_degenerated(ShenandoahDegenPoint point); 405 void op_degenerated_fail(); 406 void op_degenerated_futile(); 407 408 void op_reset(); 409 void op_mark(); 410 void op_preclean(); 411 void op_cleanup(); 412 void op_conc_evac(); 413 void op_stw_evac(); 414 void op_updaterefs(); 415 void op_uncommit(double shrink_before); 416 417 // Messages for GC trace event, they have to be immortal for 418 // passing around the logging/tracing systems 419 const char* init_mark_event_message() const; 420 const char* final_mark_event_message() const; 421 const char* conc_mark_event_message() const; 422 const char* degen_event_message(ShenandoahDegenPoint point) const; 423 424 // ---------- GC subsystems 425 // 426 private: 427 ShenandoahControlThread* _control_thread; 428 ShenandoahCollectorPolicy* _shenandoah_policy; 429 ShenandoahHeuristics* _heuristics; 430 ShenandoahFreeSet* _free_set; 431 ShenandoahConcurrentMark* _scm; 432 ShenandoahMarkCompact* _full_gc; 433 ShenandoahPacer* _pacer; 434 ShenandoahVerifier* _verifier; 435 436 ShenandoahAllocTracker* _alloc_tracker; 437 ShenandoahPhaseTimings* _phase_timings; 438 439 ShenandoahControlThread* control_thread() { return _control_thread; } 440 ShenandoahMarkCompact* full_gc() { return _full_gc; } 441 442 public: 443 ShenandoahCollectorPolicy* shenandoah_policy() const { return _shenandoah_policy; } 444 ShenandoahHeuristics* heuristics() const { return _heuristics; } 445 ShenandoahFreeSet* free_set() const { return _free_set; } 446 ShenandoahConcurrentMark* concurrent_mark() { return _scm; } 447 ShenandoahPacer* pacer() const { return _pacer; } 448 449 ShenandoahPhaseTimings* phase_timings() const { return _phase_timings; } 450 ShenandoahAllocTracker* alloc_tracker() const { return _alloc_tracker; } 451 452 ShenandoahVerifier* verifier(); 453 454 // ---------- VM subsystem bindings 455 // 456 private: 457 ShenandoahMonitoringSupport* _monitoring_support; 458 ConcurrentGCTimer* _gc_timer; 459 460 public: 461 ShenandoahMonitoringSupport* monitoring_support() { return _monitoring_support; } 462 463 GCTracer* tracer(); 464 GCTimer* gc_timer() const; 465 CollectorPolicy* collector_policy() const; 466 467 // ---------- Reference processing 468 // 469 private: 470 ReferenceProcessor* _ref_processor; 471 ShenandoahSharedFlag _process_references; 472 473 void ref_processing_init(); 474 475 public: 476 ReferenceProcessor* ref_processor() { return _ref_processor;} 477 void set_process_references(bool pr); 478 bool process_references() const; 479 480 // ---------- Class Unloading 481 // 482 private: 483 ShenandoahSharedFlag _unload_classes; 484 485 public: 486 void set_unload_classes(bool uc); 487 bool unload_classes() const; 488 489 // Delete entries for dead interned string and clean up unreferenced symbols 490 // in symbol table, possibly in parallel. 491 void unload_classes_and_cleanup_tables(bool full_gc); 492 493 // ---------- Generic interface hooks 494 // Minor things that super-interface expects us to implement to play nice with 495 // the rest of runtime. Some of the things here are not required to be implemented, 496 // and can be stubbed out. 497 // 498 public: 499 AdaptiveSizePolicy* size_policy() shenandoah_not_implemented_return(NULL); 500 bool is_maximal_no_gc() const shenandoah_not_implemented_return(false); 501 502 bool is_in(const void* p) const; 503 504 // All objects can potentially move 505 bool is_scavengable(const void* addr) { return true; } 506 507 void collect(GCCause::Cause cause); 508 void do_full_collection(bool clear_all_soft_refs); 509 510 // Used for parsing heap during error printing 511 HeapWord* block_start(const void* addr) const; 512 size_t block_size(const HeapWord* addr) const; 513 bool block_is_obj(const HeapWord* addr) const; 514 515 // Used for native heap walkers: heap dumpers, mostly 516 void object_iterate(ObjectClosure* cl); 517 void safe_object_iterate(ObjectClosure* cl); 518 void space_iterate(SpaceClosure* scl); 519 void oop_iterate(ExtendedOopClosure* cl); 520 Space* space_containing(const void* oop) const; 521 522 // Used by RMI 523 jlong millis_since_last_gc(); 524 525 bool can_elide_tlab_store_barriers() const { return true; } 526 oop new_store_pre_barrier(JavaThread* thread, oop new_obj) { return new_obj; } 527 bool can_elide_initializing_store_barrier(oop new_obj) { return true; } 528 bool card_mark_must_follow_store() const { return false; } 529 530 bool is_in_partial_collection(const void* p) shenandoah_not_implemented_return(false); 531 bool supports_heap_inspection() const { return true; } 532 533 void gc_prologue(bool b); 534 void gc_epilogue(bool b); 535 536 void acquire_pending_refs_lock(); 537 void release_pending_refs_lock(); 538 539 // ---------- Code roots handling hooks 540 // 541 public: 542 void register_nmethod(nmethod* nm); 543 void unregister_nmethod(nmethod* nm); 544 545 // ---------- Pinning hooks 546 // 547 public: 548 // Shenandoah supports per-object (per-region) pinning 549 bool supports_object_pinning() const { return true; } 550 551 oop pin_object(JavaThread* thread, oop obj); 552 void unpin_object(JavaThread* thread, oop obj); 553 554 // ---------- Allocation support 555 // 556 private: 557 HeapWord* allocate_memory_under_lock(ShenandoahAllocRequest& request, bool& in_new_region); 558 inline HeapWord* allocate_from_gclab(Thread* thread, size_t size); 559 HeapWord* allocate_from_gclab_slow(Thread* thread, size_t size); 560 HeapWord* allocate_new_gclab(size_t min_size, size_t word_size, size_t* actual_size); 561 562 public: 563 #ifndef CC_INTERP 564 void compile_prepare_oop(MacroAssembler* masm, Register obj); 565 #endif 566 567 HeapWord* allocate_memory(ShenandoahAllocRequest& request); 568 HeapWord* mem_allocate(size_t size, bool* what); 569 570 uint oop_extra_words(); 571 572 void notify_mutator_alloc_words(size_t words, bool waste); 573 574 // Shenandoah supports TLAB allocation 575 bool supports_tlab_allocation() const { return true; } 576 577 HeapWord* allocate_new_tlab(size_t word_size); 578 size_t tlab_capacity(Thread *thr) const; 579 size_t unsafe_max_tlab_alloc(Thread *thread) const; 580 size_t max_tlab_size() const; 581 size_t tlab_used(Thread* ignored) const; 582 583 HeapWord* tlab_post_allocation_setup(HeapWord* obj); 584 585 void resize_tlabs(); 586 void resize_all_tlabs(); 587 588 void accumulate_statistics_tlabs(); 589 void accumulate_statistics_all_gclabs(); 590 591 void make_parsable(bool retire_tlabs); 592 void ensure_parsability(bool retire_tlabs); 593 594 // ---------- Marking support 595 // 596 private: 597 ShenandoahMarkingContext* _marking_context; 598 MemRegion _bitmap_region; 599 MemRegion _aux_bitmap_region; 600 MarkBitMap _verification_bit_map; 601 MarkBitMap _aux_bit_map; 602 603 size_t _bitmap_size; 604 size_t _bitmap_regions_per_slice; 605 size_t _bitmap_bytes_per_slice; 606 607 bool _bitmap_region_special; 608 bool _aux_bitmap_region_special; 609 610 // Used for buffering per-region liveness data. 611 // Needed since ShenandoahHeapRegion uses atomics to update liveness. 612 // 613 // The array has max-workers elements, each of which is an array of 614 // jushort * max_regions. The choice of jushort is not accidental: 615 // there is a tradeoff between static/dynamic footprint that translates 616 // into cache pressure (which is already high during marking), and 617 // too many atomic updates. size_t/jint is too large, jbyte is too small. 618 jushort** _liveness_cache; 619 620 public: 621 inline ShenandoahMarkingContext* complete_marking_context() const; 622 inline ShenandoahMarkingContext* marking_context() const; 623 inline void mark_complete_marking_context(); 624 inline void mark_incomplete_marking_context(); 625 626 template<class T> 627 inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl); 628 629 template<class T> 630 inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit); 631 632 template<class T> 633 inline void marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit); 634 635 void reset_mark_bitmap(); 636 637 // SATB barriers hooks 638 inline bool requires_marking(const void* entry) const; 639 void force_satb_flush_all_threads(); 640 641 // Support for bitmap uncommits 642 bool commit_bitmap_slice(ShenandoahHeapRegion *r); 643 bool uncommit_bitmap_slice(ShenandoahHeapRegion *r); 644 bool is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self = false); 645 646 // Liveness caching support 647 jushort* get_liveness_cache(uint worker_id); 648 void flush_liveness_cache(uint worker_id); 649 650 // ---------- Evacuation support 651 // 652 private: 653 ShenandoahCollectionSet* _collection_set; 654 ShenandoahEvacOOMHandler _oom_evac_handler; 655 656 void evacuate_and_update_roots(); 657 658 public: 659 static address in_cset_fast_test_addr(); 660 661 ShenandoahCollectionSet* collection_set() const { return _collection_set; } 662 663 template <class T> 664 inline bool in_collection_set(T obj) const; 665 666 // Avoid accidentally calling the method above with ShenandoahHeapRegion*, which would be *wrong*. 667 inline bool in_collection_set(ShenandoahHeapRegion* r) shenandoah_not_implemented_return(false); 668 669 // Evacuates object src. Returns the evacuated object, either evacuated 670 // by this thread, or by some other thread. 671 inline oop evacuate_object(oop src, Thread* thread, bool& evacuated); 672 673 // Call before/after evacuation. 674 void enter_evacuation(); 675 void leave_evacuation(); 676 677 // ---------- Helper functions 678 // 679 public: 680 template <class T> 681 inline oop maybe_update_with_forwarded(T* p); 682 683 template <class T> 684 inline oop maybe_update_with_forwarded_not_null(T* p, oop obj); 685 686 template <class T> 687 inline oop update_with_forwarded_not_null(T* p, oop obj); 688 689 inline oop atomic_compare_exchange_oop(oop n, narrowOop* addr, oop c); 690 inline oop atomic_compare_exchange_oop(oop n, oop* addr, oop c); 691 692 void trash_humongous_region_at(ShenandoahHeapRegion *r); 693 694 void stop_concurrent_marking(); 695 696 void roots_iterate(OopClosure* cl); 697 698 private: 699 void trash_cset_regions(); 700 void update_heap_references(bool concurrent); 701 702 // ---------- Testing helpers functions 703 // 704 private: 705 ShenandoahSharedFlag _inject_alloc_failure; 706 707 void try_inject_alloc_failure(); 708 bool should_inject_alloc_failure(); 709 }; 710 711 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_HPP