Mercurial > hg > truffle
comparison src/share/vm/gc_interface/collectedHeap.hpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | d2a62e0f25eb |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
72 // SharedHeap | 72 // SharedHeap |
73 // GenCollectedHeap | 73 // GenCollectedHeap |
74 // G1CollectedHeap | 74 // G1CollectedHeap |
75 // ParallelScavengeHeap | 75 // ParallelScavengeHeap |
76 // | 76 // |
77 class CollectedHeap : public CHeapObj { | 77 class CollectedHeap : public CHeapObj<mtInternal> { |
78 friend class VMStructs; | 78 friend class VMStructs; |
79 friend class IsGCActiveMark; // Block structured external access to _is_gc_active | 79 friend class IsGCActiveMark; // Block structured external access to _is_gc_active |
80 friend class constantPoolCacheKlass; // allocate() method inserts is_conc_safe | 80 friend class constantPoolCacheKlass; // allocate() method inserts is_conc_safe |
81 | 81 |
82 #ifdef ASSERT | 82 #ifdef ASSERT |
126 virtual void accumulate_statistics_all_tlabs(); | 126 virtual void accumulate_statistics_all_tlabs(); |
127 | 127 |
128 // Reinitialize tlabs before resuming mutators. | 128 // Reinitialize tlabs before resuming mutators. |
129 virtual void resize_all_tlabs(); | 129 virtual void resize_all_tlabs(); |
130 | 130 |
131 protected: | |
132 // Allocate from the current thread's TLAB, with broken-out slow path. | 131 // Allocate from the current thread's TLAB, with broken-out slow path. |
133 inline static HeapWord* allocate_from_tlab(Thread* thread, size_t size); | 132 inline static HeapWord* allocate_from_tlab(Thread* thread, size_t size); |
134 static HeapWord* allocate_from_tlab_slow(Thread* thread, size_t size); | 133 static HeapWord* allocate_from_tlab_slow(Thread* thread, size_t size); |
135 | 134 |
136 // Allocate an uninitialized block of the given size, or returns NULL if | 135 // Allocate an uninitialized block of the given size, or returns NULL if |
148 // Same as common_mem version, except memory is allocated in the permanent area | 147 // Same as common_mem version, except memory is allocated in the permanent area |
149 // If there is no permanent area, revert to common_mem_allocate_init | 148 // If there is no permanent area, revert to common_mem_allocate_init |
150 inline static HeapWord* common_permanent_mem_allocate_init(size_t size, TRAPS); | 149 inline static HeapWord* common_permanent_mem_allocate_init(size_t size, TRAPS); |
151 | 150 |
152 // Helper functions for (VM) allocation. | 151 // Helper functions for (VM) allocation. |
153 inline static void post_allocation_setup_common(KlassHandle klass, | 152 inline static void post_allocation_setup_common(KlassHandle klass, HeapWord* obj); |
154 HeapWord* obj, size_t size); | |
155 inline static void post_allocation_setup_no_klass_install(KlassHandle klass, | 153 inline static void post_allocation_setup_no_klass_install(KlassHandle klass, |
156 HeapWord* objPtr, | 154 HeapWord* objPtr); |
157 size_t size); | 155 |
158 | 156 inline static void post_allocation_setup_obj(KlassHandle klass, HeapWord* obj); |
159 inline static void post_allocation_setup_obj(KlassHandle klass, | |
160 HeapWord* obj, size_t size); | |
161 | 157 |
162 inline static void post_allocation_setup_array(KlassHandle klass, | 158 inline static void post_allocation_setup_array(KlassHandle klass, |
163 HeapWord* obj, size_t size, | 159 HeapWord* obj, int length); |
164 int length); | |
165 | 160 |
166 // Clears an allocated object. | 161 // Clears an allocated object. |
167 inline static void init_obj(HeapWord* obj, size_t size); | 162 inline static void init_obj(HeapWord* obj, size_t size); |
168 | 163 |
169 // Filler object utilities. | 164 // Filler object utilities. |
170 static inline size_t filler_array_hdr_size(); | 165 static inline size_t filler_array_hdr_size(); |
171 static inline size_t filler_array_min_size(); | 166 static inline size_t filler_array_min_size(); |
172 static inline size_t filler_array_max_size(); | |
173 | 167 |
174 DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);) | 168 DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);) |
175 DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);) | 169 DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words, bool zap = true);) |
176 | 170 |
177 // Fill with a single array; caller must ensure filler_array_min_size() <= | 171 // Fill with a single array; caller must ensure filler_array_min_size() <= |
194 SharedHeap, | 188 SharedHeap, |
195 GenCollectedHeap, | 189 GenCollectedHeap, |
196 ParallelScavengeHeap, | 190 ParallelScavengeHeap, |
197 G1CollectedHeap | 191 G1CollectedHeap |
198 }; | 192 }; |
193 | |
194 static inline size_t filler_array_max_size() { | |
195 return _filler_array_max_size; | |
196 } | |
199 | 197 |
200 virtual CollectedHeap::Name kind() const { return CollectedHeap::Abstract; } | 198 virtual CollectedHeap::Name kind() const { return CollectedHeap::Abstract; } |
201 | 199 |
202 /** | 200 /** |
203 * Returns JNI error code JNI_ENOMEM if memory could not be allocated, | 201 * Returns JNI error code JNI_ENOMEM if memory could not be allocated, |
364 // method post_allocation_install_obj_klass() is used to install the | 362 // method post_allocation_install_obj_klass() is used to install the |
365 // klass pointer. | 363 // klass pointer. |
366 inline static oop permanent_obj_allocate_no_klass_install(KlassHandle klass, | 364 inline static oop permanent_obj_allocate_no_klass_install(KlassHandle klass, |
367 int size, | 365 int size, |
368 TRAPS); | 366 TRAPS); |
369 inline static void post_allocation_install_obj_klass(KlassHandle klass, | 367 inline static void post_allocation_install_obj_klass(KlassHandle klass, oop obj); |
370 oop obj, | |
371 int size); | |
372 inline static oop permanent_array_allocate(KlassHandle klass, int size, int length, TRAPS); | 368 inline static oop permanent_array_allocate(KlassHandle klass, int size, int length, TRAPS); |
373 | 369 |
374 // Raw memory allocation facilities | 370 // Raw memory allocation facilities |
375 // The obj and array allocate methods are covers for these methods. | 371 // The obj and array allocate methods are covers for these methods. |
376 // The permanent allocation method should default to mem_allocate if | 372 // The permanent allocation method should default to mem_allocate if |
660 if (_gc_heap_log != NULL) { | 656 if (_gc_heap_log != NULL) { |
661 _gc_heap_log->log_heap_after(); | 657 _gc_heap_log->log_heap_after(); |
662 } | 658 } |
663 } | 659 } |
664 | 660 |
665 // Allocate GCHeapLog during VM startup | |
666 static void initialize_heap_log(); | |
667 | |
668 // Heap verification | 661 // Heap verification |
669 virtual void verify(bool allow_dirty, bool silent, VerifyOption option) = 0; | 662 virtual void verify(bool silent, VerifyOption option) = 0; |
670 | 663 |
671 // Non product verification and debugging. | 664 // Non product verification and debugging. |
672 #ifndef PRODUCT | 665 #ifndef PRODUCT |
673 // Support for PromotionFailureALot. Return true if it's time to cause a | 666 // Support for PromotionFailureALot. Return true if it's time to cause a |
674 // promotion failure. The no-argument version uses | 667 // promotion failure. The no-argument version uses |