Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @ 20337:1f1d373cd044
8038423: G1: Decommit memory within heap
Summary: Allow G1 to decommit memory of arbitrary regions within the heap and their associated auxiliary data structures card table, BOT, hot card cache, and mark bitmaps.
Reviewed-by: mgerdin, brutisso, jwilhelm
author | tschatzl |
---|---|
date | Thu, 21 Aug 2014 11:47:10 +0200 |
parents | e5035defa3c4 |
children | c02ec279b062 |
comparison
equal
deleted
inserted
replaced
20336:6701abbc4441 | 20337:1f1d373cd044 |
---|---|
23 */ | 23 */ |
24 | 24 |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP | 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP |
27 | 27 |
28 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp" | |
28 #include "memory/cardTableModRefBS.hpp" | 29 #include "memory/cardTableModRefBS.hpp" |
29 #include "memory/memRegion.hpp" | 30 #include "memory/memRegion.hpp" |
30 #include "oops/oop.inline.hpp" | 31 #include "oops/oop.inline.hpp" |
31 #include "utilities/macros.hpp" | 32 #include "utilities/macros.hpp" |
32 | 33 |
33 #if INCLUDE_ALL_GCS | 34 #if INCLUDE_ALL_GCS |
34 | 35 |
35 class DirtyCardQueueSet; | 36 class DirtyCardQueueSet; |
37 class G1SATBCardTableLoggingModRefBS; | |
36 | 38 |
37 // This barrier is specialized to use a logging barrier to support | 39 // This barrier is specialized to use a logging barrier to support |
38 // snapshot-at-the-beginning marking. | 40 // snapshot-at-the-beginning marking. |
39 | 41 |
40 class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS { | 42 class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS { |
124 | 126 |
125 bool is_card_deferred(size_t card_index) { | 127 bool is_card_deferred(size_t card_index) { |
126 jbyte val = _byte_map[card_index]; | 128 jbyte val = _byte_map[card_index]; |
127 return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val(); | 129 return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val(); |
128 } | 130 } |
131 }; | |
129 | 132 |
133 class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedListener { | |
134 private: | |
135 G1SATBCardTableLoggingModRefBS* _card_table; | |
136 public: | |
137 G1SATBCardTableLoggingModRefBSChangedListener() : _card_table(NULL) { } | |
138 | |
139 void set_card_table(G1SATBCardTableLoggingModRefBS* card_table) { _card_table = card_table; } | |
140 | |
141 virtual void on_commit(uint start_idx, size_t num_regions); | |
130 }; | 142 }; |
131 | 143 |
132 // Adds card-table logging to the post-barrier. | 144 // Adds card-table logging to the post-barrier. |
133 // Usual invariant: all dirty cards are logged in the DirtyCardQueueSet. | 145 // Usual invariant: all dirty cards are logged in the DirtyCardQueueSet. |
134 class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { | 146 class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { |
147 friend class G1SATBCardTableLoggingModRefBSChangedListener; | |
135 private: | 148 private: |
149 G1SATBCardTableLoggingModRefBSChangedListener _listener; | |
136 DirtyCardQueueSet& _dcqs; | 150 DirtyCardQueueSet& _dcqs; |
137 public: | 151 public: |
152 static size_t compute_size(size_t mem_region_size_in_words) { | |
153 size_t number_of_slots = (mem_region_size_in_words / card_size_in_words); | |
154 return ReservedSpace::allocation_align_size_up(number_of_slots); | |
155 } | |
156 | |
138 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, | 157 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, |
139 int max_covered_regions); | 158 int max_covered_regions); |
159 | |
160 virtual void initialize() { } | |
161 virtual void initialize(G1RegionToSpaceMapper* mapper); | |
162 | |
163 virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); } | |
140 | 164 |
141 bool is_a(BarrierSet::Name bsn) { | 165 bool is_a(BarrierSet::Name bsn) { |
142 return bsn == BarrierSet::G1SATBCTLogging || | 166 return bsn == BarrierSet::G1SATBCTLogging || |
143 G1SATBCardTableModRefBS::is_a(bsn); | 167 G1SATBCardTableModRefBS::is_a(bsn); |
144 } | 168 } |
152 // above no longer applies. | 176 // above no longer applies. |
153 void invalidate(MemRegion mr, bool whole_heap = false); | 177 void invalidate(MemRegion mr, bool whole_heap = false); |
154 | 178 |
155 void write_region_work(MemRegion mr) { invalidate(mr); } | 179 void write_region_work(MemRegion mr) { invalidate(mr); } |
156 void write_ref_array_work(MemRegion mr) { invalidate(mr); } | 180 void write_ref_array_work(MemRegion mr) { invalidate(mr); } |
157 | |
158 | |
159 }; | 181 }; |
160 | 182 |
161 | 183 |
162 #endif // INCLUDE_ALL_GCS | 184 #endif // INCLUDE_ALL_GCS |
163 | 185 |