62 NotInCSet = 0, // The region is not in the collection set.
63 Young = 1, // The region is in the collection set and a young region.
64 Old = 2, // The region is in the collection set and an old region.
65 Num
66 };
67
68 InCSetState(in_cset_state_t value = NotInCSet) : _value(value) {
69 assert(is_valid(), err_msg("Invalid state %d", _value));
70 }
71
72 in_cset_state_t value() const { return _value; }
73
74 void set_old() { _value = Old; }
75
76 bool is_in_cset_or_humongous() const { return _value != NotInCSet; }
77 bool is_in_cset() const { return _value > NotInCSet; }
78 bool is_humongous() const { return _value < NotInCSet; }
79 bool is_young() const { return _value == Young; }
80 bool is_old() const { return _value == Old; }
81
82 #ifdef ASSERT
83 bool is_default() const { return !is_in_cset_or_humongous(); }
84 bool is_valid() const { return (_value >= Humongous) && (_value < Num); }
85 bool is_valid_gen() const { return (_value >= Young && _value <= Old); }
86 #endif
87 };
88
89 // Instances of this class are used for quick tests on whether a reference points
90 // into the collection set and into which generation or is a humongous object
91 //
92 // Each of the array's elements indicates whether the corresponding region is in
93 // the collection set and if so in which generation, or a humongous region.
94 //
95 // We use this to speed up reference processing during young collection and
96 // quickly reclaim humongous objects. For the latter, by making a humongous region
97 // succeed this test, we sort-of add it to the collection set. During the reference
98 // iteration closures, when we see a humongous region, we then simply mark it as
99 // referenced, i.e. live.
100 class G1InCSetStateFastTestBiasedMappedArray : public G1BiasedMappedArray<InCSetState> {
101 protected:
|
62 NotInCSet = 0, // The region is not in the collection set.
63 Young = 1, // The region is in the collection set and a young region.
64 Old = 2, // The region is in the collection set and an old region.
65 Num
66 };
67
68 InCSetState(in_cset_state_t value = NotInCSet) : _value(value) {
69 assert(is_valid(), err_msg("Invalid state %d", _value));
70 }
71
72 in_cset_state_t value() const { return _value; }
73
74 void set_old() { _value = Old; }
75
76 bool is_in_cset_or_humongous() const { return _value != NotInCSet; }
77 bool is_in_cset() const { return _value > NotInCSet; }
78 bool is_humongous() const { return _value < NotInCSet; }
79 bool is_young() const { return _value == Young; }
80 bool is_old() const { return _value == Old; }
81
82 // Converts the given InCSetState value into a generation number from 0 (Young)
83 // to 1 (Old).
84 static int to_gen_number(InCSetState value) {
85 assert(value.is_valid_gen(), err_msg("Cannot convert CSet state " CSETSTATE_FORMAT" to generation number.", value.value()));
86 return (int)(value.value() - Young);
87 }
88
89 #ifdef ASSERT
90 bool is_default() const { return !is_in_cset_or_humongous(); }
91 bool is_valid() const { return (_value >= Humongous) && (_value < Num); }
92 bool is_valid_gen() const { return (_value >= Young && _value <= Old); }
93 #endif
94 };
95
96 // Instances of this class are used for quick tests on whether a reference points
97 // into the collection set and into which generation or is a humongous object
98 //
99 // Each of the array's elements indicates whether the corresponding region is in
100 // the collection set and if so in which generation, or a humongous region.
101 //
102 // We use this to speed up reference processing during young collection and
103 // quickly reclaim humongous objects. For the latter, by making a humongous region
104 // succeed this test, we sort-of add it to the collection set. During the reference
105 // iteration closures, when we see a humongous region, we then simply mark it as
106 // referenced, i.e. live.
107 class G1InCSetStateFastTestBiasedMappedArray : public G1BiasedMappedArray<InCSetState> {
108 protected:
|