Mercurial > hg > truffle
diff src/share/vm/gc_implementation/g1/heapRegion.hpp @ 20481:c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
Reviewed-by: brutisso, tschatzl
author | brutisso |
---|---|
date | Tue, 16 Sep 2014 14:27:40 +0200 |
parents | d35872270666 |
children | 7baf47cb97cb |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/heapRegion.hpp Tue Sep 16 11:03:19 2014 +0200 +++ b/src/share/vm/gc_implementation/g1/heapRegion.hpp Tue Sep 16 14:27:40 2014 +0200 @@ -28,6 +28,7 @@ #include "gc_implementation/g1/g1AllocationContext.hpp" #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" @@ -35,8 +36,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. @@ -56,10 +55,7 @@ #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 @@ -220,12 +216,6 @@ 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.) @@ -239,7 +229,8 @@ AllocationContext_t _allocation_context; - 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(). @@ -281,13 +272,6 @@ // 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; @@ -312,12 +296,6 @@ _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 @@ -437,9 +415,21 @@ _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; @@ -503,7 +493,7 @@ 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 { @@ -638,9 +628,6 @@ 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" ); @@ -692,11 +679,13 @@ } } - 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 @@ -841,6 +830,4 @@ bool complete() { return _complete; } }; -#endif // INCLUDE_ALL_GCS - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_HPP