146 friend class G1ParScanThreadStateSet;
147 friend class G1EvacuateRegionsTask;
148 friend class G1PLABAllocator;
149
150 // Other related classes.
151 friend class HeapRegionClaimer;
152
153 // Testing classes.
154 friend class G1CheckRegionAttrTableClosure;
155
156 private:
157 G1YoungRemSetSamplingThread* _young_gen_sampling_thread;
158
159 WorkGang* _workers;
160 G1CardTable* _card_table;
161
162 SoftRefPolicy _soft_ref_policy;
163
164 static size_t _humongous_object_threshold_in_words;
165
166 // These sets keep track of old, archive and humongous regions respectively.
167 HeapRegionSet _old_set;
168 HeapRegionSet _archive_set;
169 HeapRegionSet _humongous_set;
170
171 void eagerly_reclaim_humongous_regions();
172 // Start a new incremental collection set for the next pause.
173 void start_new_collection_set();
174
175 // The block offset table for the G1 heap.
176 G1BlockOffsetTable* _bot;
177
178 // Tears down the region sets / lists so that they are empty and the
179 // regions on the heap do not belong to a region set / list. The
180 // only exception is the humongous set which we leave unaltered. If
181 // free_list_only is true, it will only tear down the master free
182 // list. It is called before a Full GC (free_list_only == false) or
183 // before heap shrinking (free_list_only == true).
184 void tear_down_region_sets(bool free_list_only);
185
1271 // humongous and that we don't allocate a humongous
1272 // object in a TLAB.
1273 return word_size > _humongous_object_threshold_in_words;
1274 }
1275
1276 // Returns the humongous threshold for a specific region size
1277 static size_t humongous_threshold_for(size_t region_size) {
1278 return (region_size / 2);
1279 }
1280
1281 // Returns the number of regions the humongous object of the given word size
1282 // requires.
1283 static size_t humongous_obj_size_in_regions(size_t word_size);
1284
1285 // Print the maximum heap capacity.
1286 virtual size_t max_capacity() const;
1287
1288 // Return the size of reserved memory. Returns different value than max_capacity() when AllocateOldGenAt is used.
1289 virtual size_t max_reserved_capacity() const;
1290
1291 virtual jlong millis_since_last_gc();
1292
1293
1294 // Convenience function to be used in situations where the heap type can be
1295 // asserted to be this type.
1296 static G1CollectedHeap* heap() {
1297 return named_heap<G1CollectedHeap>(CollectedHeap::G1);
1298 }
1299
1300 void set_region_short_lived_locked(HeapRegion* hr);
1301 // add appropriate methods for any other surv rate groups
1302
1303 const G1SurvivorRegions* survivor() const { return &_survivor; }
1304
1305 uint eden_regions_count() const { return _eden.length(); }
1306 uint eden_regions_count(uint node_index) const { return _eden.regions_on_node(node_index); }
1307 uint survivor_regions_count() const { return _survivor.length(); }
1308 uint survivor_regions_count(uint node_index) const { return _survivor.regions_on_node(node_index); }
1309 size_t eden_regions_used_bytes() const { return _eden.used_bytes(); }
1310 size_t survivor_regions_used_bytes() const { return _survivor.used_bytes(); }
1311 uint young_regions_count() const { return _eden.length() + _survivor.length(); }
1312 uint old_regions_count() const { return _old_set.length(); }
|
146 friend class G1ParScanThreadStateSet;
147 friend class G1EvacuateRegionsTask;
148 friend class G1PLABAllocator;
149
150 // Other related classes.
151 friend class HeapRegionClaimer;
152
153 // Testing classes.
154 friend class G1CheckRegionAttrTableClosure;
155
156 private:
157 G1YoungRemSetSamplingThread* _young_gen_sampling_thread;
158
159 WorkGang* _workers;
160 G1CardTable* _card_table;
161
162 SoftRefPolicy _soft_ref_policy;
163
164 static size_t _humongous_object_threshold_in_words;
165
166 // Records the end of the most recent collection regardless of type.
167 Ticks _collection_pause_end;
168
169 // For CollectedHeap::millis_since_last_gc() support. Records end of the last
170 // collection that visited all objects.
171 jlong _time_of_last_gc_ns;
172
173 // These sets keep track of old, archive and humongous regions respectively.
174 HeapRegionSet _old_set;
175 HeapRegionSet _archive_set;
176 HeapRegionSet _humongous_set;
177
178 void eagerly_reclaim_humongous_regions();
179 // Start a new incremental collection set for the next pause.
180 void start_new_collection_set();
181
182 // The block offset table for the G1 heap.
183 G1BlockOffsetTable* _bot;
184
185 // Tears down the region sets / lists so that they are empty and the
186 // regions on the heap do not belong to a region set / list. The
187 // only exception is the humongous set which we leave unaltered. If
188 // free_list_only is true, it will only tear down the master free
189 // list. It is called before a Full GC (free_list_only == false) or
190 // before heap shrinking (free_list_only == true).
191 void tear_down_region_sets(bool free_list_only);
192
1278 // humongous and that we don't allocate a humongous
1279 // object in a TLAB.
1280 return word_size > _humongous_object_threshold_in_words;
1281 }
1282
1283 // Returns the humongous threshold for a specific region size
1284 static size_t humongous_threshold_for(size_t region_size) {
1285 return (region_size / 2);
1286 }
1287
1288 // Returns the number of regions the humongous object of the given word size
1289 // requires.
1290 static size_t humongous_obj_size_in_regions(size_t word_size);
1291
1292 // Print the maximum heap capacity.
1293 virtual size_t max_capacity() const;
1294
1295 // Return the size of reserved memory. Returns different value than max_capacity() when AllocateOldGenAt is used.
1296 virtual size_t max_reserved_capacity() const;
1297
1298 Ticks last_collection_pause_end() const { return _collection_pause_end; }
1299 virtual jlong millis_since_last_gc();
1300
1301 // Convenience function to be used in situations where the heap type can be
1302 // asserted to be this type.
1303 static G1CollectedHeap* heap() {
1304 return named_heap<G1CollectedHeap>(CollectedHeap::G1);
1305 }
1306
1307 void set_region_short_lived_locked(HeapRegion* hr);
1308 // add appropriate methods for any other surv rate groups
1309
1310 const G1SurvivorRegions* survivor() const { return &_survivor; }
1311
1312 uint eden_regions_count() const { return _eden.length(); }
1313 uint eden_regions_count(uint node_index) const { return _eden.regions_on_node(node_index); }
1314 uint survivor_regions_count() const { return _survivor.length(); }
1315 uint survivor_regions_count(uint node_index) const { return _survivor.regions_on_node(node_index); }
1316 size_t eden_regions_used_bytes() const { return _eden.used_bytes(); }
1317 size_t survivor_regions_used_bytes() const { return _survivor.used_bytes(); }
1318 uint young_regions_count() const { return _eden.length() + _survivor.length(); }
1319 uint old_regions_count() const { return _old_set.length(); }
|