--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Fri Dec 21 18:26:55 2018 +0000
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Fri Dec 21 08:18:59 2018 -0800
@@ -45,6 +45,7 @@
#include "gc/g1/g1YCTypes.hpp"
#include "gc/g1/heapRegionManager.hpp"
#include "gc/g1/heapRegionSet.hpp"
+#include "gc/g1/heterogeneousHeapRegionManager.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/gcHeapSummary.hpp"
@@ -194,7 +195,7 @@
G1RegionMappingChangedListener _listener;
// The sequence of all heap regions in the heap.
- HeapRegionManager _hrm;
+ HeapRegionManager* _hrm;
// Manages all allocations with regions except humongous object allocations.
G1Allocator* _allocator;
@@ -267,6 +268,9 @@
// (e) cause == _wb_conc_mark
bool should_do_concurrent_full_gc(GCCause::Cause cause);
+ // Return true if should upgrade to full gc after an incremental one.
+ bool should_upgrade_to_full_gc(GCCause::Cause cause);
+
// indicates whether we are in young or mixed GC mode
G1CollectorState _collector_state;
@@ -369,9 +373,9 @@
// Try to allocate a single non-humongous HeapRegion sufficient for
// an allocation of the given word_size. If do_expand is true,
// attempt to expand the heap if necessary to satisfy the allocation
- // request. If the region is to be used as an old region or for a
- // humongous object, set is_old to true. If not, to false.
- HeapRegion* new_region(size_t word_size, bool is_old, bool do_expand);
+ // request. 'type' takes the type of region to be allocated. (Use constants
+ // Old, Eden, Humongous, Survivor defined in HeapRegionType.)
+ HeapRegion* new_region(size_t word_size, HeapRegionType type, bool do_expand);
// Initialize a contiguous set of free regions of length num_regions
// and starting at index first so that they appear as a single
@@ -957,10 +961,13 @@
// The current policy object for the collector.
G1Policy* g1_policy() const { return _g1_policy; }
+ HeapRegionManager* hrm() const { return _hrm; }
+
const G1CollectionSet* collection_set() const { return &_collection_set; }
G1CollectionSet* collection_set() { return &_collection_set; }
virtual CollectorPolicy* collector_policy() const;
+ virtual G1CollectorPolicy* g1_collector_policy() const;
virtual SoftRefPolicy* soft_ref_policy();
@@ -1009,7 +1016,7 @@
// But G1CollectedHeap doesn't yet support this.
virtual bool is_maximal_no_gc() const {
- return _hrm.available() == 0;
+ return _hrm->available() == 0;
}
// Returns whether there are any regions left in the heap for allocation.
@@ -1018,19 +1025,22 @@
}
// The current number of regions in the heap.
- uint num_regions() const { return _hrm.length(); }
+ uint num_regions() const { return _hrm->length(); }
// The max number of regions in the heap.
- uint max_regions() const { return _hrm.max_length(); }
+ uint max_regions() const { return _hrm->max_length(); }
+
+ // Max number of regions that can be comitted.
+ uint max_expandable_regions() const { return _hrm->max_expandable_length(); }
// The number of regions that are completely free.
- uint num_free_regions() const { return _hrm.num_free_regions(); }
+ uint num_free_regions() const { return _hrm->num_free_regions(); }
// The number of regions that can be allocated into.
- uint num_free_or_available_regions() const { return num_free_regions() + _hrm.available(); }
+ uint num_free_or_available_regions() const { return num_free_regions() + _hrm->available(); }
MemoryUsage get_auxiliary_data_memory_usage() const {
- return _hrm.get_auxiliary_data_memory_usage();
+ return _hrm->get_auxiliary_data_memory_usage();
}
// The number of regions that are not completely free.
@@ -1038,7 +1048,7 @@
#ifdef ASSERT
bool is_on_master_free_list(HeapRegion* hr) {
- return _hrm.is_free(hr);
+ return _hrm->is_free(hr);
}
#endif // ASSERT
@@ -1095,13 +1105,13 @@
// Return "TRUE" iff the given object address is in the reserved
// region of g1.
bool is_in_g1_reserved(const void* p) const {
- return _hrm.reserved().contains(p);
+ return _hrm->reserved().contains(p);
}
// Returns a MemRegion that corresponds to the space that has been
// reserved for the heap
MemRegion g1_reserved() const {
- return _hrm.reserved();
+ return _hrm->reserved();
}
virtual bool is_in_closed_subset(const void* p) const;
@@ -1227,6 +1237,9 @@
// Print the maximum heap capacity.
virtual size_t max_capacity() const;
+ // Return the size of reserved memory. Returns different value than max_capacity() when AllocateOldGenAt is used.
+ virtual size_t max_reserved_capacity() const;
+
virtual jlong millis_since_last_gc();