49 in_cset_state_t _value; |
49 in_cset_state_t _value; |
50 public: |
50 public: |
51 enum { |
51 enum { |
52 // Selection of the values were driven to micro-optimize the encoding and |
52 // Selection of the values were driven to micro-optimize the encoding and |
53 // frequency of the checks. |
53 // frequency of the checks. |
54 // The most common check is whether the region is in the collection set or not. |
54 // The most common check is whether the region is in the collection set or not, |
55 // This encoding allows us to use an != 0 check which in some architectures |
55 // this encoding allows us to use an > 0 check. |
56 // (x86*) can be encoded slightly more efficently than a normal comparison |
|
57 // against zero. |
|
58 // The same situation occurs when checking whether the region is humongous |
|
59 // or not, which is encoded by values < 0. |
|
60 // The other values are simply encoded in increasing generation order, which |
56 // The other values are simply encoded in increasing generation order, which |
61 // makes getting the next generation fast by a simple increment. |
57 // makes getting the next generation fast by a simple increment. |
62 Humongous = -1, // The region is humongous - note that actually any value < 0 would be possible here. |
58 Humongous = -1, // The region is humongous |
63 NotInCSet = 0, // The region is not in the collection set. |
59 NotInCSet = 0, // The region is not in the collection set. |
64 Young = 1, // The region is in the collection set and a young region. |
60 Young = 1, // The region is in the collection set and a young region. |
65 Old = 2, // The region is in the collection set and an old region. |
61 Old = 2, // The region is in the collection set and an old region. |
66 Num |
62 Num |
67 }; |
63 }; |
72 |
68 |
73 in_cset_state_t value() const { return _value; } |
69 in_cset_state_t value() const { return _value; } |
74 |
70 |
75 void set_old() { _value = Old; } |
71 void set_old() { _value = Old; } |
76 |
72 |
77 bool is_in_cset_or_humongous() const { return _value != NotInCSet; } |
73 bool is_in_cset_or_humongous() const { return is_in_cset() || is_humongous(); } |
78 bool is_in_cset() const { return _value > NotInCSet; } |
74 bool is_in_cset() const { return _value > NotInCSet; } |
79 bool is_humongous() const { return _value < NotInCSet; } |
75 |
|
76 bool is_humongous() const { return _value == Humongous; } |
80 bool is_young() const { return _value == Young; } |
77 bool is_young() const { return _value == Young; } |
81 bool is_old() const { return _value == Old; } |
78 bool is_old() const { return _value == Old; } |
82 |
79 |
83 #ifdef ASSERT |
80 #ifdef ASSERT |
84 bool is_default() const { return !is_in_cset_or_humongous(); } |
81 bool is_default() const { return !is_in_cset_or_humongous(); } |