69
70 static GCTaskManager* _gc_task_manager; // The task manager.
71
72 void trace_heap(GCWhen::Type when, GCTracer* tracer);
73
74 protected:
75 static inline size_t total_invocations();
76 HeapWord* allocate_new_tlab(size_t size);
77
78 inline bool should_alloc_in_eden(size_t size) const;
79 inline void death_march_check(HeapWord* const result, size_t size);
80 HeapWord* mem_allocate_old_gen(size_t size);
81
82 public:
83 ParallelScavengeHeap() : CollectedHeap() {
84 _death_march_count = 0;
85 set_alignment(_young_gen_alignment, intra_heap_alignment());
86 set_alignment(_old_gen_alignment, intra_heap_alignment());
87 }
88
89 // For use by VM operations
90 enum CollectionType {
91 Scavenge,
92 MarkSweep
93 };
94
95 ParallelScavengeHeap::Name kind() const {
96 return CollectedHeap::ParallelScavengeHeap;
97 }
98
99 virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
100
101 static PSYoungGen* young_gen() { return _young_gen; }
102 static PSOldGen* old_gen() { return _old_gen; }
103
104 virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; }
105
106 static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; }
107
108 static ParallelScavengeHeap* heap();
109
110 static GCTaskManager* const gc_task_manager() { return _gc_task_manager; }
111
112 AdjoiningGenerations* gens() { return _gens; }
113
114 // Returns JNI_OK on success
115 virtual jint initialize();
116
117 void post_initialize();
118 void update_counters();
119 // The alignment used for the various generations.
120 size_t young_gen_alignment() const { return _young_gen_alignment; }
121 size_t old_gen_alignment() const { return _old_gen_alignment; }
122
123 // The alignment used for eden and survivors within the young gen
124 // and for boundary between young gen and old gen.
125 size_t intra_heap_alignment() const { return 64 * K * HeapWordSize; }
126
127 size_t capacity() const;
128 size_t used() const;
129
130 // Return "true" if all generations have reached the
131 // maximal committed limit that they can reach, without a garbage
132 // collection.
133 virtual bool is_maximal_no_gc() const;
134
135 // Return true if the reference points to an object that
136 // can be moved in a partial collection. For currently implemented
137 // generational collectors that means during a collection of
138 // the young gen.
139 virtual bool is_scavengable(const void* addr);
140
141 // Does this heap support heap inspection? (+PrintClassHistogram)
142 bool supports_heap_inspection() const { return true; }
143
144 size_t max_capacity() const;
145
|
69
70 static GCTaskManager* _gc_task_manager; // The task manager.
71
72 void trace_heap(GCWhen::Type when, GCTracer* tracer);
73
74 protected:
75 static inline size_t total_invocations();
76 HeapWord* allocate_new_tlab(size_t size);
77
78 inline bool should_alloc_in_eden(size_t size) const;
79 inline void death_march_check(HeapWord* const result, size_t size);
80 HeapWord* mem_allocate_old_gen(size_t size);
81
82 public:
83 ParallelScavengeHeap() : CollectedHeap() {
84 _death_march_count = 0;
85 set_alignment(_young_gen_alignment, intra_heap_alignment());
86 set_alignment(_old_gen_alignment, intra_heap_alignment());
87 }
88
89 // return the (conservative) maximum heap alignment
90 static size_t max_heap_alignment() {
91 return MAX2(os::max_page_size(), intra_heap_alignment());
92 }
93
94 // For use by VM operations
95 enum CollectionType {
96 Scavenge,
97 MarkSweep
98 };
99
100 ParallelScavengeHeap::Name kind() const {
101 return CollectedHeap::ParallelScavengeHeap;
102 }
103
104 virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
105
106 static PSYoungGen* young_gen() { return _young_gen; }
107 static PSOldGen* old_gen() { return _old_gen; }
108
109 virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; }
110
111 static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; }
112
113 static ParallelScavengeHeap* heap();
114
115 static GCTaskManager* const gc_task_manager() { return _gc_task_manager; }
116
117 AdjoiningGenerations* gens() { return _gens; }
118
119 // Returns JNI_OK on success
120 virtual jint initialize();
121
122 void post_initialize();
123 void update_counters();
124 // The alignment used for the various generations.
125 size_t young_gen_alignment() const { return _young_gen_alignment; }
126 size_t old_gen_alignment() const { return _old_gen_alignment; }
127
128 // The alignment used for eden and survivors within the young gen
129 // and for boundary between young gen and old gen.
130 static size_t intra_heap_alignment() { return 64 * K * HeapWordSize; }
131
132 size_t capacity() const;
133 size_t used() const;
134
135 // Return "true" if all generations have reached the
136 // maximal committed limit that they can reach, without a garbage
137 // collection.
138 virtual bool is_maximal_no_gc() const;
139
140 // Return true if the reference points to an object that
141 // can be moved in a partial collection. For currently implemented
142 // generational collectors that means during a collection of
143 // the young gen.
144 virtual bool is_scavengable(const void* addr);
145
146 // Does this heap support heap inspection? (+PrintClassHistogram)
147 bool supports_heap_inspection() const { return true; }
148
149 size_t max_capacity() const;
150
|