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: 102 InCSetState default_value() const { return InCSetState::NotInCSet; } 103 public: 104 void set_humongous(uintptr_t index) { 105 assert(get_by_index(index).is_default(), 106 err_msg("State at index " INTPTR_FORMAT" should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); 107 set_by_index(index, InCSetState::Humongous); 108 } 109 110 void clear_humongous(uintptr_t index) { 111 set_by_index(index, InCSetState::NotInCSet); 112 } 113 114 void set_in_young(uintptr_t index) { 115 assert(get_by_index(index).is_default(), 116 err_msg("State at index " INTPTR_FORMAT" should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); 117 set_by_index(index, InCSetState::Young); 118 } 119 120 void set_in_old(uintptr_t index) { 121 assert(get_by_index(index).is_default(), 122 err_msg("State at index " INTPTR_FORMAT" should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); 123 set_by_index(index, InCSetState::Old); 124 } 125 126 bool is_in_cset_or_humongous(HeapWord* addr) const { return at(addr).is_in_cset_or_humongous(); } 127 bool is_in_cset(HeapWord* addr) const { return at(addr).is_in_cset(); } 128 InCSetState at(HeapWord* addr) const { return get_by_address(addr); } 129 void clear() { G1BiasedMappedArray<InCSetState>::clear(); } 130 }; 131 132 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1INCSETSTATE_HPP | 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: 102 InCSetState default_value() const { return InCSetState::NotInCSet; } 103 public: 104 void set_humongous(uintptr_t index) { 105 assert(get_by_index(index).is_default(), 106 err_msg("State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); 107 set_by_index(index, InCSetState::Humongous); 108 } 109 110 void clear_humongous(uintptr_t index) { 111 set_by_index(index, InCSetState::NotInCSet); 112 } 113 114 void set_in_young(uintptr_t index) { 115 assert(get_by_index(index).is_default(), 116 err_msg("State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); 117 set_by_index(index, InCSetState::Young); 118 } 119 120 void set_in_old(uintptr_t index) { 121 assert(get_by_index(index).is_default(), 122 err_msg("State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); 123 set_by_index(index, InCSetState::Old); 124 } 125 126 bool is_in_cset_or_humongous(HeapWord* addr) const { return at(addr).is_in_cset_or_humongous(); } 127 bool is_in_cset(HeapWord* addr) const { return at(addr).is_in_cset(); } 128 InCSetState at(HeapWord* addr) const { return get_by_address(addr); } 129 void clear() { G1BiasedMappedArray<InCSetState>::clear(); } 130 }; 131 132 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1INCSETSTATE_HPP |