mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8057768
: Make heap region region type in G1 HeapRegion explicit
Reviewed-by: brutisso, tschatzl
This commit is contained in:
parent
debb101f7b
commit
a2984b6c88
13 changed files with 309 additions and 144 deletions
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "gc_implementation/g1/g1BlockOffsetTable.hpp"
|
||||
#include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
|
||||
#include "gc_implementation/g1/heapRegionType.hpp"
|
||||
#include "gc_implementation/g1/survRateGroup.hpp"
|
||||
#include "gc_implementation/shared/ageTable.hpp"
|
||||
#include "gc_implementation/shared/spaceDecorator.hpp"
|
||||
|
@ -34,8 +35,6 @@
|
|||
#include "memory/watermark.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
#if INCLUDE_ALL_GCS
|
||||
|
||||
// A HeapRegion is the smallest piece of a G1CollectedHeap that
|
||||
// can be collected independently.
|
||||
|
||||
|
@ -55,10 +54,7 @@ class nmethod;
|
|||
#define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
|
||||
#define HR_FORMAT_PARAMS(_hr_) \
|
||||
(_hr_)->hrm_index(), \
|
||||
(_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \
|
||||
(_hr_)->startsHumongous() ? "HS" : \
|
||||
(_hr_)->continuesHumongous() ? "HC" : \
|
||||
!(_hr_)->is_empty() ? "O" : "F", \
|
||||
(_hr_)->get_short_type_str(), \
|
||||
p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
|
||||
|
||||
// sentinel value for hrm_index
|
||||
|
@ -215,12 +211,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
friend class VMStructs;
|
||||
private:
|
||||
|
||||
enum HumongousType {
|
||||
NotHumongous = 0,
|
||||
StartsHumongous,
|
||||
ContinuesHumongous
|
||||
};
|
||||
|
||||
// The remembered set for this region.
|
||||
// (Might want to make this "inline" later, to avoid some alloc failure
|
||||
// issues.)
|
||||
|
@ -232,7 +222,8 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
// The index of this region in the heap region sequence.
|
||||
uint _hrm_index;
|
||||
|
||||
HumongousType _humongous_type;
|
||||
HeapRegionType _type;
|
||||
|
||||
// For a humongous region, region in which it starts.
|
||||
HeapRegion* _humongous_start_region;
|
||||
// For the start region of a humongous sequence, it's original end().
|
||||
|
@ -274,13 +265,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
// The calculated GC efficiency of the region.
|
||||
double _gc_efficiency;
|
||||
|
||||
enum YoungType {
|
||||
NotYoung, // a region is not young
|
||||
Young, // a region is young
|
||||
Survivor // a region is young and it contains survivors
|
||||
};
|
||||
|
||||
volatile YoungType _young_type;
|
||||
int _young_index_in_cset;
|
||||
SurvRateGroup* _surv_rate_group;
|
||||
int _age_index;
|
||||
|
@ -305,12 +289,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
_next_top_at_mark_start = bot;
|
||||
}
|
||||
|
||||
void set_young_type(YoungType new_type) {
|
||||
//assert(_young_type != new_type, "setting the same type" );
|
||||
// TODO: add more assertions here
|
||||
_young_type = new_type;
|
||||
}
|
||||
|
||||
// Cached attributes used in the collection set policy information
|
||||
|
||||
// The RSet length that was added to the total value
|
||||
|
@ -430,9 +408,21 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
_prev_marked_bytes = _next_marked_bytes = 0;
|
||||
}
|
||||
|
||||
bool isHumongous() const { return _humongous_type != NotHumongous; }
|
||||
bool startsHumongous() const { return _humongous_type == StartsHumongous; }
|
||||
bool continuesHumongous() const { return _humongous_type == ContinuesHumongous; }
|
||||
const char* get_type_str() const { return _type.get_str(); }
|
||||
const char* get_short_type_str() const { return _type.get_short_str(); }
|
||||
|
||||
bool is_free() const { return _type.is_free(); }
|
||||
|
||||
bool is_young() const { return _type.is_young(); }
|
||||
bool is_eden() const { return _type.is_eden(); }
|
||||
bool is_survivor() const { return _type.is_survivor(); }
|
||||
|
||||
bool isHumongous() const { return _type.is_humongous(); }
|
||||
bool startsHumongous() const { return _type.is_starts_humongous(); }
|
||||
bool continuesHumongous() const { return _type.is_continues_humongous(); }
|
||||
|
||||
bool is_old() const { return _type.is_old(); }
|
||||
|
||||
// For a humongous region, region in which it starts.
|
||||
HeapRegion* humongous_start_region() const {
|
||||
return _humongous_start_region;
|
||||
|
@ -496,7 +486,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
void set_continuesHumongous(HeapRegion* first_hr);
|
||||
|
||||
// Unsets the humongous-related fields on the region.
|
||||
void set_notHumongous();
|
||||
void clear_humongous();
|
||||
|
||||
// If the region has a remembered set, return a pointer to it.
|
||||
HeapRegionRemSet* rem_set() const {
|
||||
|
@ -623,9 +613,6 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
void calc_gc_efficiency(void);
|
||||
double gc_efficiency() { return _gc_efficiency;}
|
||||
|
||||
bool is_young() const { return _young_type != NotYoung; }
|
||||
bool is_survivor() const { return _young_type == Survivor; }
|
||||
|
||||
int young_index_in_cset() const { return _young_index_in_cset; }
|
||||
void set_young_index_in_cset(int index) {
|
||||
assert( (index == -1) || is_young(), "pre-condition" );
|
||||
|
@ -677,11 +664,13 @@ class HeapRegion: public G1OffsetTableContigSpace {
|
|||
}
|
||||
}
|
||||
|
||||
void set_young() { set_young_type(Young); }
|
||||
void set_free() { _type.set_free(); }
|
||||
|
||||
void set_survivor() { set_young_type(Survivor); }
|
||||
void set_eden() { _type.set_eden(); }
|
||||
void set_eden_pre_gc() { _type.set_eden_pre_gc(); }
|
||||
void set_survivor() { _type.set_survivor(); }
|
||||
|
||||
void set_not_young() { set_young_type(NotYoung); }
|
||||
void set_old() { _type.set_old(); }
|
||||
|
||||
// Determine if an object has been allocated since the last
|
||||
// mark performed by the collector. This returns true iff the object
|
||||
|
@ -809,6 +798,4 @@ class HeapRegionClosure : public StackObj {
|
|||
bool complete() { return _complete; }
|
||||
};
|
||||
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
|
||||
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue