< prev index next >

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

Print this page
rev 58143 : 8238633: JVMTI heap walk should consult GC for marking oops


  40 class ConcurrentGCTimer;
  41 class ReferenceProcessor;
  42 class ShenandoahAllocTracker;
  43 class ShenandoahCollectorPolicy;
  44 class ShenandoahControlThread;
  45 class ShenandoahGCSession;
  46 class ShenandoahGCStateResetter;
  47 class ShenandoahHeuristics;
  48 class ShenandoahMarkingContext;
  49 class ShenandoahMarkCompact;
  50 class ShenandoahMode;
  51 class ShenandoahPhaseTimings;
  52 class ShenandoahHeap;
  53 class ShenandoahHeapRegion;
  54 class ShenandoahHeapRegionClosure;
  55 class ShenandoahCollectionSet;
  56 class ShenandoahFreeSet;
  57 class ShenandoahConcurrentMark;
  58 class ShenandoahMarkCompact;
  59 class ShenandoahMonitoringSupport;

  60 class ShenandoahPacer;
  61 class ShenandoahTraversalGC;
  62 class ShenandoahVerifier;
  63 class ShenandoahWorkGang;
  64 class VMStructs;
  65 
  66 class ShenandoahRegionIterator : public StackObj {
  67 private:
  68   ShenandoahHeap* _heap;
  69 
  70   DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
  71   volatile size_t _index;
  72   DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0);
  73 
  74   // No implicit copying: iterators should be passed by reference to capture the state
  75   NONCOPYABLE(ShenandoahRegionIterator);
  76 
  77 public:
  78   ShenandoahRegionIterator();
  79   ShenandoahRegionIterator(ShenandoahHeap* heap);


 102   template <class T>
 103   void do_oop_work(T* p);
 104 public:
 105   void do_oop(narrowOop* p);
 106   void do_oop(oop* p);
 107 };
 108 #endif
 109 
 110 typedef ShenandoahLock    ShenandoahHeapLock;
 111 typedef ShenandoahLocker  ShenandoahHeapLocker;
 112 
 113 // Shenandoah GC is low-pause concurrent GC that uses Brooks forwarding pointers
 114 // to encode forwarding data. See BrooksPointer for details on forwarding data encoding.
 115 // See ShenandoahControlThread for GC cycle structure.
 116 //
 117 class ShenandoahHeap : public CollectedHeap {
 118   friend class ShenandoahAsserts;
 119   friend class VMStructs;
 120   friend class ShenandoahGCSession;
 121   friend class ShenandoahGCStateResetter;

 122 
 123 // ---------- Locks that guard important data structures in Heap
 124 //
 125 private:
 126   ShenandoahHeapLock _lock;
 127 
 128 public:
 129   ShenandoahHeapLock* lock() {
 130     return &_lock;
 131   }
 132 
 133   void assert_heaplock_owned_by_current_thread()     NOT_DEBUG_RETURN;
 134   void assert_heaplock_not_owned_by_current_thread() NOT_DEBUG_RETURN;
 135   void assert_heaplock_or_safepoint()                NOT_DEBUG_RETURN;
 136 
 137 // ---------- Initialization, termination, identification, printing routines
 138 //
 139 public:
 140   static ShenandoahHeap* heap();
 141   static ShenandoahHeap* heap_no_check();


 544 // the rest of runtime. Some of the things here are not required to be implemented,
 545 // and can be stubbed out.
 546 //
 547 public:
 548   AdaptiveSizePolicy* size_policy() shenandoah_not_implemented_return(NULL);
 549   bool is_maximal_no_gc() const shenandoah_not_implemented_return(false);
 550 
 551   bool is_in(const void* p) const;
 552 
 553   MemRegion reserved_region() const { return _reserved; }
 554   bool is_in_reserved(const void* addr) const { return _reserved.contains(addr); }
 555 
 556   void collect(GCCause::Cause cause);
 557   void do_full_collection(bool clear_all_soft_refs);
 558 
 559   // Used for parsing heap during error printing
 560   HeapWord* block_start(const void* addr) const;
 561   bool block_is_obj(const HeapWord* addr) const;
 562   bool print_location(outputStream* st, void* addr) const;
 563 

 564   // Used for native heap walkers: heap dumpers, mostly
 565   void object_iterate(ObjectClosure* cl);
 566 
 567   // Keep alive an object that was loaded with AS_NO_KEEPALIVE.
 568   void keep_alive(oop obj);
 569 
 570   // Used by RMI
 571   jlong millis_since_last_gc();
 572 
 573 // ---------- Safepoint interface hooks
 574 //
 575 public:
 576   void safepoint_synchronize_begin();
 577   void safepoint_synchronize_end();
 578 
 579 // ---------- Code roots handling hooks
 580 //
 581 public:
 582   void register_nmethod(nmethod* nm);
 583   void unregister_nmethod(nmethod* nm);


 636   MemRegion  _aux_bitmap_region;
 637   MarkBitMap _verification_bit_map;
 638   MarkBitMap _aux_bit_map;
 639 
 640   size_t _bitmap_size;
 641   size_t _bitmap_regions_per_slice;
 642   size_t _bitmap_bytes_per_slice;
 643 
 644   bool _bitmap_region_special;
 645   bool _aux_bitmap_region_special;
 646 
 647   // Used for buffering per-region liveness data.
 648   // Needed since ShenandoahHeapRegion uses atomics to update liveness.
 649   //
 650   // The array has max-workers elements, each of which is an array of
 651   // jushort * max_regions. The choice of jushort is not accidental:
 652   // there is a tradeoff between static/dynamic footprint that translates
 653   // into cache pressure (which is already high during marking), and
 654   // too many atomic updates. size_t/jint is too large, jbyte is too small.
 655   jushort** _liveness_cache;




 656 
 657 public:
 658   inline ShenandoahMarkingContext* complete_marking_context() const;
 659   inline ShenandoahMarkingContext* marking_context() const;
 660   inline void mark_complete_marking_context();
 661   inline void mark_incomplete_marking_context();
 662 
 663   template<class T>
 664   inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl);
 665 
 666   template<class T>
 667   inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit);
 668 
 669   template<class T>
 670   inline void marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit);
 671 
 672   void reset_mark_bitmap();
 673 
 674   // SATB barriers hooks
 675   template<bool RESOLVE>




  40 class ConcurrentGCTimer;
  41 class ReferenceProcessor;
  42 class ShenandoahAllocTracker;
  43 class ShenandoahCollectorPolicy;
  44 class ShenandoahControlThread;
  45 class ShenandoahGCSession;
  46 class ShenandoahGCStateResetter;
  47 class ShenandoahHeuristics;
  48 class ShenandoahMarkingContext;
  49 class ShenandoahMarkCompact;
  50 class ShenandoahMode;
  51 class ShenandoahPhaseTimings;
  52 class ShenandoahHeap;
  53 class ShenandoahHeapRegion;
  54 class ShenandoahHeapRegionClosure;
  55 class ShenandoahCollectionSet;
  56 class ShenandoahFreeSet;
  57 class ShenandoahConcurrentMark;
  58 class ShenandoahMarkCompact;
  59 class ShenandoahMonitoringSupport;
  60 class ShenandoahObjectMarker;
  61 class ShenandoahPacer;
  62 class ShenandoahTraversalGC;
  63 class ShenandoahVerifier;
  64 class ShenandoahWorkGang;
  65 class VMStructs;
  66 
  67 class ShenandoahRegionIterator : public StackObj {
  68 private:
  69   ShenandoahHeap* _heap;
  70 
  71   DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
  72   volatile size_t _index;
  73   DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0);
  74 
  75   // No implicit copying: iterators should be passed by reference to capture the state
  76   NONCOPYABLE(ShenandoahRegionIterator);
  77 
  78 public:
  79   ShenandoahRegionIterator();
  80   ShenandoahRegionIterator(ShenandoahHeap* heap);


 103   template <class T>
 104   void do_oop_work(T* p);
 105 public:
 106   void do_oop(narrowOop* p);
 107   void do_oop(oop* p);
 108 };
 109 #endif
 110 
 111 typedef ShenandoahLock    ShenandoahHeapLock;
 112 typedef ShenandoahLocker  ShenandoahHeapLocker;
 113 
 114 // Shenandoah GC is low-pause concurrent GC that uses Brooks forwarding pointers
 115 // to encode forwarding data. See BrooksPointer for details on forwarding data encoding.
 116 // See ShenandoahControlThread for GC cycle structure.
 117 //
 118 class ShenandoahHeap : public CollectedHeap {
 119   friend class ShenandoahAsserts;
 120   friend class VMStructs;
 121   friend class ShenandoahGCSession;
 122   friend class ShenandoahGCStateResetter;
 123   friend class ShenandoahObjectMarker;
 124 
 125 // ---------- Locks that guard important data structures in Heap
 126 //
 127 private:
 128   ShenandoahHeapLock _lock;
 129 
 130 public:
 131   ShenandoahHeapLock* lock() {
 132     return &_lock;
 133   }
 134 
 135   void assert_heaplock_owned_by_current_thread()     NOT_DEBUG_RETURN;
 136   void assert_heaplock_not_owned_by_current_thread() NOT_DEBUG_RETURN;
 137   void assert_heaplock_or_safepoint()                NOT_DEBUG_RETURN;
 138 
 139 // ---------- Initialization, termination, identification, printing routines
 140 //
 141 public:
 142   static ShenandoahHeap* heap();
 143   static ShenandoahHeap* heap_no_check();


 546 // the rest of runtime. Some of the things here are not required to be implemented,
 547 // and can be stubbed out.
 548 //
 549 public:
 550   AdaptiveSizePolicy* size_policy() shenandoah_not_implemented_return(NULL);
 551   bool is_maximal_no_gc() const shenandoah_not_implemented_return(false);
 552 
 553   bool is_in(const void* p) const;
 554 
 555   MemRegion reserved_region() const { return _reserved; }
 556   bool is_in_reserved(const void* addr) const { return _reserved.contains(addr); }
 557 
 558   void collect(GCCause::Cause cause);
 559   void do_full_collection(bool clear_all_soft_refs);
 560 
 561   // Used for parsing heap during error printing
 562   HeapWord* block_start(const void* addr) const;
 563   bool block_is_obj(const HeapWord* addr) const;
 564   bool print_location(outputStream* st, void* addr) const;
 565 
 566   ObjectMarker* object_marker();
 567   // Used for native heap walkers: heap dumpers, mostly
 568   void object_iterate(ObjectClosure* cl);
 569 
 570   // Keep alive an object that was loaded with AS_NO_KEEPALIVE.
 571   void keep_alive(oop obj);
 572 
 573   // Used by RMI
 574   jlong millis_since_last_gc();
 575 
 576 // ---------- Safepoint interface hooks
 577 //
 578 public:
 579   void safepoint_synchronize_begin();
 580   void safepoint_synchronize_end();
 581 
 582 // ---------- Code roots handling hooks
 583 //
 584 public:
 585   void register_nmethod(nmethod* nm);
 586   void unregister_nmethod(nmethod* nm);


 639   MemRegion  _aux_bitmap_region;
 640   MarkBitMap _verification_bit_map;
 641   MarkBitMap _aux_bit_map;
 642 
 643   size_t _bitmap_size;
 644   size_t _bitmap_regions_per_slice;
 645   size_t _bitmap_bytes_per_slice;
 646 
 647   bool _bitmap_region_special;
 648   bool _aux_bitmap_region_special;
 649 
 650   // Used for buffering per-region liveness data.
 651   // Needed since ShenandoahHeapRegion uses atomics to update liveness.
 652   //
 653   // The array has max-workers elements, each of which is an array of
 654   // jushort * max_regions. The choice of jushort is not accidental:
 655   // there is a tradeoff between static/dynamic footprint that translates
 656   // into cache pressure (which is already high during marking), and
 657   // too many atomic updates. size_t/jint is too large, jbyte is too small.
 658   jushort** _liveness_cache;
 659 
 660 private:
 661   bool commit_aux_bitmap();
 662   void uncommit_aux_bit_map();
 663 
 664 public:
 665   inline ShenandoahMarkingContext* complete_marking_context() const;
 666   inline ShenandoahMarkingContext* marking_context() const;
 667   inline void mark_complete_marking_context();
 668   inline void mark_incomplete_marking_context();
 669 
 670   template<class T>
 671   inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl);
 672 
 673   template<class T>
 674   inline void marked_object_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit);
 675 
 676   template<class T>
 677   inline void marked_object_oop_iterate(ShenandoahHeapRegion* region, T* cl, HeapWord* limit);
 678 
 679   void reset_mark_bitmap();
 680 
 681   // SATB barriers hooks
 682   template<bool RESOLVE>


< prev index next >