Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @ 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 | e7d0505c8a30 |
comparison
equal
deleted
inserted
replaced
20336:6701abbc4441 | 20337:1f1d373cd044 |
---|---|
21 * questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
26 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | |
26 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" | 27 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
27 #include "gc_implementation/g1/heapRegion.hpp" | 28 #include "gc_implementation/g1/heapRegion.hpp" |
28 #include "gc_implementation/g1/satbQueue.hpp" | 29 #include "gc_implementation/g1/satbQueue.hpp" |
29 #include "runtime/mutexLocker.hpp" | 30 #include "runtime/mutexLocker.hpp" |
30 #include "runtime/orderAccess.inline.hpp" | 31 #include "runtime/orderAccess.inline.hpp" |
34 int max_covered_regions) : | 35 int max_covered_regions) : |
35 CardTableModRefBSForCTRS(whole_heap, max_covered_regions) | 36 CardTableModRefBSForCTRS(whole_heap, max_covered_regions) |
36 { | 37 { |
37 _kind = G1SATBCT; | 38 _kind = G1SATBCT; |
38 } | 39 } |
39 | |
40 | 40 |
41 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { | 41 void G1SATBCardTableModRefBS::enqueue(oop pre_val) { |
42 // Nulls should have been already filtered. | 42 // Nulls should have been already filtered. |
43 assert(pre_val->is_oop(true), "Error"); | 43 assert(pre_val->is_oop(true), "Error"); |
44 | 44 |
122 void G1SATBCardTableModRefBS::verify_g1_young_region(MemRegion mr) { | 122 void G1SATBCardTableModRefBS::verify_g1_young_region(MemRegion mr) { |
123 verify_region(mr, g1_young_gen, true); | 123 verify_region(mr, g1_young_gen, true); |
124 } | 124 } |
125 #endif | 125 #endif |
126 | 126 |
127 void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, size_t num_regions) { | |
128 MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords); | |
129 _card_table->clear(mr); | |
130 } | |
131 | |
127 G1SATBCardTableLoggingModRefBS:: | 132 G1SATBCardTableLoggingModRefBS:: |
128 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, | 133 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, |
129 int max_covered_regions) : | 134 int max_covered_regions) : |
130 G1SATBCardTableModRefBS(whole_heap, max_covered_regions), | 135 G1SATBCardTableModRefBS(whole_heap, max_covered_regions), |
131 _dcqs(JavaThread::dirty_card_queue_set()) | 136 _dcqs(JavaThread::dirty_card_queue_set()), |
137 _listener() | |
132 { | 138 { |
133 _kind = G1SATBCTLogging; | 139 _kind = G1SATBCTLogging; |
140 _listener.set_card_table(this); | |
141 } | |
142 | |
143 void G1SATBCardTableLoggingModRefBS::initialize(G1RegionToSpaceMapper* mapper) { | |
144 mapper->set_mapping_changed_listener(&_listener); | |
145 | |
146 _byte_map_size = mapper->reserved().byte_size(); | |
147 | |
148 _guard_index = cards_required(_whole_heap.word_size()) - 1; | |
149 _last_valid_index = _guard_index - 1; | |
150 | |
151 HeapWord* low_bound = _whole_heap.start(); | |
152 HeapWord* high_bound = _whole_heap.end(); | |
153 | |
154 _cur_covered_regions = 1; | |
155 _covered[0] = _whole_heap; | |
156 | |
157 _byte_map = (jbyte*) mapper->reserved().start(); | |
158 byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift); | |
159 assert(byte_for(low_bound) == &_byte_map[0], "Checking start of map"); | |
160 assert(byte_for(high_bound-1) <= &_byte_map[_last_valid_index], "Checking end of map"); | |
161 | |
162 if (TraceCardTableModRefBS) { | |
163 gclog_or_tty->print_cr("G1SATBCardTableModRefBS::G1SATBCardTableModRefBS: "); | |
164 gclog_or_tty->print_cr(" " | |
165 " &_byte_map[0]: " INTPTR_FORMAT | |
166 " &_byte_map[_last_valid_index]: " INTPTR_FORMAT, | |
167 p2i(&_byte_map[0]), | |
168 p2i(&_byte_map[_last_valid_index])); | |
169 gclog_or_tty->print_cr(" " | |
170 " byte_map_base: " INTPTR_FORMAT, | |
171 p2i(byte_map_base)); | |
172 } | |
134 } | 173 } |
135 | 174 |
136 void | 175 void |
137 G1SATBCardTableLoggingModRefBS::write_ref_field_work(void* field, | 176 G1SATBCardTableLoggingModRefBS::write_ref_field_work(void* field, |
138 oop new_val, | 177 oop new_val, |