Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/sharedHeap.hpp @ 342:37f87013dfd8
6711316: Open source the Garbage-First garbage collector
Summary: First mercurial integration of the code for the Garbage-First garbage collector.
Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author | ysr |
---|---|
date | Thu, 05 Jun 2008 15:57:56 -0700 |
parents | a61af66fc99e |
children | 7d7a7c599c17 |
comparison
equal
deleted
inserted
replaced
189:0b27f3512f9e | 342:37f87013dfd8 |
---|---|
42 class KlassHandle; | 42 class KlassHandle; |
43 | 43 |
44 class SharedHeap : public CollectedHeap { | 44 class SharedHeap : public CollectedHeap { |
45 friend class VMStructs; | 45 friend class VMStructs; |
46 | 46 |
47 friend class VM_GC_Operation; | |
48 friend class VM_CGC_Operation; | |
49 | |
47 private: | 50 private: |
48 // For claiming strong_roots tasks. | 51 // For claiming strong_roots tasks. |
49 SubTasksDone* _process_strong_tasks; | 52 SubTasksDone* _process_strong_tasks; |
50 | 53 |
51 protected: | 54 protected: |
80 | 83 |
81 // Full initialization is done in a concrete subtype's "initialize" | 84 // Full initialization is done in a concrete subtype's "initialize" |
82 // function. | 85 // function. |
83 SharedHeap(CollectorPolicy* policy_); | 86 SharedHeap(CollectorPolicy* policy_); |
84 | 87 |
88 // Returns true if the calling thread holds the heap lock, | |
89 // or the calling thread is a par gc thread and the heap_lock is held | |
90 // by the vm thread doing a gc operation. | |
91 bool heap_lock_held_for_gc(); | |
92 // True if the heap_lock is held by the a non-gc thread invoking a gc | |
93 // operation. | |
94 bool _thread_holds_heap_lock_for_gc; | |
95 | |
85 public: | 96 public: |
86 static SharedHeap* heap() { return _sh; } | 97 static SharedHeap* heap() { return _sh; } |
87 | 98 |
88 CollectorPolicy *collector_policy() const { return _collector_policy; } | 99 CollectorPolicy *collector_policy() const { return _collector_policy; } |
89 | 100 |
95 // Initialization of ("weak") reference processing support | 106 // Initialization of ("weak") reference processing support |
96 virtual void ref_processing_init(); | 107 virtual void ref_processing_init(); |
97 | 108 |
98 void set_perm(PermGen* perm_gen) { _perm_gen = perm_gen; } | 109 void set_perm(PermGen* perm_gen) { _perm_gen = perm_gen; } |
99 | 110 |
100 // A helper function that fills an allocated-but-not-yet-initialized | 111 // A helper function that fills a region of the heap with |
101 // region with a garbage object. | 112 // with a single object. |
102 static void fill_region_with_object(MemRegion mr); | 113 static void fill_region_with_object(MemRegion mr); |
103 | 114 |
104 // Minimum garbage fill object size | 115 // Minimum garbage fill object size |
105 static size_t min_fill_size() { return (size_t)align_object_size(oopDesc::header_size()); } | 116 static size_t min_fill_size() { return (size_t)align_object_size(oopDesc::header_size()); } |
106 static size_t min_fill_size_in_bytes() { return min_fill_size() * HeapWordSize; } | 117 static size_t min_fill_size_in_bytes() { return min_fill_size() * HeapWordSize; } |
212 | 223 |
213 // The functions below are helper functions that a subclass of | 224 // The functions below are helper functions that a subclass of |
214 // "SharedHeap" can use in the implementation of its virtual | 225 // "SharedHeap" can use in the implementation of its virtual |
215 // functions. | 226 // functions. |
216 | 227 |
217 protected: | 228 public: |
218 | 229 |
219 // Do anything common to GC's. | 230 // Do anything common to GC's. |
220 virtual void gc_prologue(bool full) = 0; | 231 virtual void gc_prologue(bool full) = 0; |
221 virtual void gc_epilogue(bool full) = 0; | 232 virtual void gc_epilogue(bool full) = 0; |
222 | 233 |
223 public: | |
224 // | 234 // |
225 // New methods from CollectedHeap | 235 // New methods from CollectedHeap |
226 // | 236 // |
227 | 237 |
228 size_t permanent_capacity() const { | 238 size_t permanent_capacity() const { |
264 assert(perm_gen(), "NULL perm gen"); | 274 assert(perm_gen(), "NULL perm gen"); |
265 _perm_gen->object_iterate(cl); | 275 _perm_gen->object_iterate(cl); |
266 } | 276 } |
267 | 277 |
268 // Some utilities. | 278 // Some utilities. |
269 void print_size_transition(size_t bytes_before, | 279 void print_size_transition(outputStream* out, |
280 size_t bytes_before, | |
270 size_t bytes_after, | 281 size_t bytes_after, |
271 size_t capacity); | 282 size_t capacity); |
272 }; | 283 }; |