50 class ParallelScavengeHeap : public CollectedHeap {
51 friend class VMStructs;
52 private:
53 static PSYoungGen* _young_gen;
54 static PSOldGen* _old_gen;
55
56 // Sizing policy for entire heap
57 static PSAdaptiveSizePolicy* _size_policy;
58 static PSGCAdaptivePolicyCounters* _gc_policy_counters;
59
60 GenerationSizer* _collector_policy;
61
62 // Collection of generations that are adjacent in the
63 // space reserved for the heap.
64 AdjoiningGenerations* _gens;
65 unsigned int _death_march_count;
66
67 // The task manager
68 static GCTaskManager* _gc_task_manager;
69
70 GCMemoryManager* _young_mgr;
71 GCMemoryManager* _old_mgr;
72
73 MemoryPool* _eden_pool;
74 MemoryPool* _survivor_pool;
75 MemoryPool* _old_pool;
76
77 void trace_heap(GCWhen::Type when, const GCTracer* tracer);
78
79 protected:
80 static inline size_t total_invocations();
81 HeapWord* allocate_new_tlab(size_t size);
82
83 inline bool should_alloc_in_eden(size_t size) const;
84 inline void death_march_check(HeapWord* const result, size_t size);
85 HeapWord* mem_allocate_old_gen(size_t size);
86
87 public:
88 ParallelScavengeHeap(GenerationSizer* policy) :
89 CollectedHeap(), _collector_policy(policy), _death_march_count(0) { }
90
91 // For use by VM operations
241 // generation may be expanded in preparation for the resize.
242 void resize_young_gen(size_t eden_size, size_t survivor_size);
243
244 // Resize the old generation. The reserved space for the
245 // generation may be expanded in preparation for the resize.
246 void resize_old_gen(size_t desired_free_space);
247
248 // Save the tops of the spaces in all generations
249 void record_gen_tops_before_GC() PRODUCT_RETURN;
250
251 // Mangle the unused parts of all spaces in the heap
252 void gen_mangle_unused_area() PRODUCT_RETURN;
253
254 // Call these in sequential code around the processing of strong roots.
255 class ParStrongRootsScope : public MarkScope {
256 public:
257 ParStrongRootsScope();
258 ~ParStrongRootsScope();
259 };
260
261 GCMemoryManager* old_gc_mgr() const { return _old_mgr; }
262 GCMemoryManager* young_gc_mgr() const { return _young_mgr; }
263 };
264
265 // Simple class for storing info about the heap at the start of GC, to be used
266 // after GC for comparison/printing.
267 class PreGCValues {
268 public:
269 PreGCValues(ParallelScavengeHeap* heap) :
270 _heap_used(heap->used()),
271 _young_gen_used(heap->young_gen()->used_in_bytes()),
272 _old_gen_used(heap->old_gen()->used_in_bytes()),
273 _metadata_used(MetaspaceAux::used_bytes()) { };
274
275 size_t heap_used() const { return _heap_used; }
276 size_t young_gen_used() const { return _young_gen_used; }
277 size_t old_gen_used() const { return _old_gen_used; }
278 size_t metadata_used() const { return _metadata_used; }
279
280 private:
281 size_t _heap_used;
282 size_t _young_gen_used;
|
50 class ParallelScavengeHeap : public CollectedHeap {
51 friend class VMStructs;
52 private:
53 static PSYoungGen* _young_gen;
54 static PSOldGen* _old_gen;
55
56 // Sizing policy for entire heap
57 static PSAdaptiveSizePolicy* _size_policy;
58 static PSGCAdaptivePolicyCounters* _gc_policy_counters;
59
60 GenerationSizer* _collector_policy;
61
62 // Collection of generations that are adjacent in the
63 // space reserved for the heap.
64 AdjoiningGenerations* _gens;
65 unsigned int _death_march_count;
66
67 // The task manager
68 static GCTaskManager* _gc_task_manager;
69
70 GCMemoryManager* _young_manager;
71 GCMemoryManager* _old_manager;
72
73 MemoryPool* _eden_pool;
74 MemoryPool* _survivor_pool;
75 MemoryPool* _old_pool;
76
77 void trace_heap(GCWhen::Type when, const GCTracer* tracer);
78
79 protected:
80 static inline size_t total_invocations();
81 HeapWord* allocate_new_tlab(size_t size);
82
83 inline bool should_alloc_in_eden(size_t size) const;
84 inline void death_march_check(HeapWord* const result, size_t size);
85 HeapWord* mem_allocate_old_gen(size_t size);
86
87 public:
88 ParallelScavengeHeap(GenerationSizer* policy) :
89 CollectedHeap(), _collector_policy(policy), _death_march_count(0) { }
90
91 // For use by VM operations
241 // generation may be expanded in preparation for the resize.
242 void resize_young_gen(size_t eden_size, size_t survivor_size);
243
244 // Resize the old generation. The reserved space for the
245 // generation may be expanded in preparation for the resize.
246 void resize_old_gen(size_t desired_free_space);
247
248 // Save the tops of the spaces in all generations
249 void record_gen_tops_before_GC() PRODUCT_RETURN;
250
251 // Mangle the unused parts of all spaces in the heap
252 void gen_mangle_unused_area() PRODUCT_RETURN;
253
254 // Call these in sequential code around the processing of strong roots.
255 class ParStrongRootsScope : public MarkScope {
256 public:
257 ParStrongRootsScope();
258 ~ParStrongRootsScope();
259 };
260
261 GCMemoryManager* old_gc_manager() const { return _old_manager; }
262 GCMemoryManager* young_gc_manager() const { return _young_manager; }
263 };
264
265 // Simple class for storing info about the heap at the start of GC, to be used
266 // after GC for comparison/printing.
267 class PreGCValues {
268 public:
269 PreGCValues(ParallelScavengeHeap* heap) :
270 _heap_used(heap->used()),
271 _young_gen_used(heap->young_gen()->used_in_bytes()),
272 _old_gen_used(heap->old_gen()->used_in_bytes()),
273 _metadata_used(MetaspaceAux::used_bytes()) { };
274
275 size_t heap_used() const { return _heap_used; }
276 size_t young_gen_used() const { return _young_gen_used; }
277 size_t old_gen_used() const { return _old_gen_used; }
278 size_t metadata_used() const { return _metadata_used; }
279
280 private:
281 size_t _heap_used;
282 size_t _young_gen_used;
|