annotate src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp @ 2149:7e37af9d69ef

7011379: G1: overly long concurrent marking cycles Summary: This changeset introduces filtering of SATB buffers at the point when they are about to be enqueued. If this filtering clears enough entries on each buffer, the buffer can then be re-used and not enqueued. This cuts down the number of SATB buffers that need to be processed by the concurrent marking threads. Reviewed-by: johnc, ysr
author tonyp
date Wed, 19 Jan 2011 09:35:17 -0500
parents f95d63e2154a
children f08d439fab8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 237
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 237
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 237
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "gc_implementation/parallelScavenge/parMarkBitMap.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "runtime/os.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "utilities/bitMap.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #ifdef TARGET_OS_FAMILY_linux
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 # include "os_linux.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #ifdef TARGET_OS_FAMILY_solaris
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 # include "os_solaris.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #ifdef TARGET_OS_FAMILY_windows
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
39 # include "os_windows.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 bool
a61af66fc99e Initial load
duke
parents:
diff changeset
43 ParMarkBitMap::initialize(MemRegion covered_region)
a61af66fc99e Initial load
duke
parents:
diff changeset
44 {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 const idx_t bits = bits_required(covered_region);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // The bits will be divided evenly between two bitmaps; each of them should be
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // an integral number of words.
a61af66fc99e Initial load
duke
parents:
diff changeset
48 assert(bits % (BitsPerWord * 2) == 0, "region size unaligned");
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 const size_t words = bits / BitsPerWord;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 const size_t raw_bytes = words * sizeof(idx_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 const size_t granularity = os::vm_allocation_granularity();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 const size_t bytes = align_size_up(raw_bytes, MAX2(page_sz, granularity));
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 :
a61af66fc99e Initial load
duke
parents:
diff changeset
57 MAX2(page_sz, granularity);
79
82db0859acbe 6642862: Code cache allocation fails with large pages after 6588638
jcoomes
parents: 0
diff changeset
58 ReservedSpace rs(bytes, rs_align, rs_align > 0);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz,
a61af66fc99e Initial load
duke
parents:
diff changeset
60 rs.base(), rs.size());
a61af66fc99e Initial load
duke
parents:
diff changeset
61 _virtual_space = new PSVirtualSpace(rs, page_sz);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 if (_virtual_space != NULL && _virtual_space->expand_by(bytes)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _region_start = covered_region.start();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 _region_size = covered_region.word_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
65 idx_t* map = (idx_t*)_virtual_space->reserved_low_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
66 _beg_bits.set_map(map);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 _beg_bits.set_size(bits / 2);
a61af66fc99e Initial load
duke
parents:
diff changeset
68 _end_bits.set_map(map + words / 2);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 _end_bits.set_size(bits / 2);
a61af66fc99e Initial load
duke
parents:
diff changeset
70 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 _region_start = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 _region_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 if (_virtual_space != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 delete _virtual_space;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 _virtual_space = NULL;
237
1fdb98a17101 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 196
diff changeset
78 // Release memory reserved in the space.
1fdb98a17101 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 196
diff changeset
79 rs.release();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
85 extern size_t mark_bitmap_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
86 extern size_t mark_bitmap_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 #endif // #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 bool
a61af66fc99e Initial load
duke
parents:
diff changeset
90 ParMarkBitMap::mark_obj(HeapWord* addr, size_t size)
a61af66fc99e Initial load
duke
parents:
diff changeset
91 {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 const idx_t beg_bit = addr_to_bit(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 if (_beg_bits.par_set_bit(beg_bit)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 const idx_t end_bit = addr_to_bit(addr + size - 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
95 bool end_bit_ok = _end_bits.par_set_bit(end_bit);
a61af66fc99e Initial load
duke
parents:
diff changeset
96 assert(end_bit_ok, "concurrency problem");
a61af66fc99e Initial load
duke
parents:
diff changeset
97 DEBUG_ONLY(Atomic::inc_ptr(&mark_bitmap_count));
a61af66fc99e Initial load
duke
parents:
diff changeset
98 DEBUG_ONLY(Atomic::add_ptr(size, &mark_bitmap_size));
a61af66fc99e Initial load
duke
parents:
diff changeset
99 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 size_t
a61af66fc99e Initial load
duke
parents:
diff changeset
105 ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, HeapWord* end_addr) const
a61af66fc99e Initial load
duke
parents:
diff changeset
106 {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 assert(beg_addr <= end_addr, "bad range");
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 idx_t live_bits = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // The bitmap routines require the right boundary to be word-aligned.
a61af66fc99e Initial load
duke
parents:
diff changeset
112 const idx_t end_bit = addr_to_bit(end_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 const idx_t range_end = BitMap::word_align_up(end_bit);
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 idx_t beg_bit = find_obj_beg(addr_to_bit(beg_addr), range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 while (beg_bit < end_bit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 idx_t tmp_end = find_obj_end(beg_bit, range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
118 if (tmp_end < end_bit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 live_bits += tmp_end - beg_bit + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
120 beg_bit = find_obj_beg(tmp_end + 1, range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
122 live_bits += end_bit - beg_bit; // No + 1 here; end_bit is not counted.
a61af66fc99e Initial load
duke
parents:
diff changeset
123 return bits_to_words(live_bits);
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 return bits_to_words(live_bits);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 }
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 size_t ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, oop end_obj) const
a61af66fc99e Initial load
duke
parents:
diff changeset
130 {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 assert(beg_addr <= (HeapWord*)end_obj, "bad range");
a61af66fc99e Initial load
duke
parents:
diff changeset
132 assert(is_marked(end_obj), "end_obj must be live");
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 idx_t live_bits = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // The bitmap routines require the right boundary to be word-aligned.
a61af66fc99e Initial load
duke
parents:
diff changeset
137 const idx_t end_bit = addr_to_bit((HeapWord*)end_obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
138 const idx_t range_end = BitMap::word_align_up(end_bit);
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 idx_t beg_bit = find_obj_beg(addr_to_bit(beg_addr), range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
141 while (beg_bit < end_bit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 idx_t tmp_end = find_obj_end(beg_bit, range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
143 assert(tmp_end < end_bit, "missing end bit");
a61af66fc99e Initial load
duke
parents:
diff changeset
144 live_bits += tmp_end - beg_bit + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 beg_bit = find_obj_beg(tmp_end + 1, range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147 return bits_to_words(live_bits);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 ParMarkBitMap::IterationStatus
a61af66fc99e Initial load
duke
parents:
diff changeset
151 ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
a61af66fc99e Initial load
duke
parents:
diff changeset
152 idx_t range_beg, idx_t range_end) const
a61af66fc99e Initial load
duke
parents:
diff changeset
153 {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 DEBUG_ONLY(verify_bit(range_beg);)
a61af66fc99e Initial load
duke
parents:
diff changeset
155 DEBUG_ONLY(verify_bit(range_end);)
a61af66fc99e Initial load
duke
parents:
diff changeset
156 assert(range_beg <= range_end, "live range invalid");
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // The bitmap routines require the right boundary to be word-aligned.
a61af66fc99e Initial load
duke
parents:
diff changeset
159 const idx_t search_end = BitMap::word_align_up(range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 idx_t cur_beg = find_obj_beg(range_beg, search_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
162 while (cur_beg < range_end) {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 const idx_t cur_end = find_obj_end(cur_beg, search_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
164 if (cur_end >= range_end) {
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // The obj ends outside the range.
a61af66fc99e Initial load
duke
parents:
diff changeset
166 live_closure->set_source(bit_to_addr(cur_beg));
a61af66fc99e Initial load
duke
parents:
diff changeset
167 return incomplete;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 }
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 const size_t size = obj_size(cur_beg, cur_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
171 IterationStatus status = live_closure->do_addr(bit_to_addr(cur_beg), size);
a61af66fc99e Initial load
duke
parents:
diff changeset
172 if (status != incomplete) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 assert(status == would_overflow || status == full, "sanity");
a61af66fc99e Initial load
duke
parents:
diff changeset
174 return status;
a61af66fc99e Initial load
duke
parents:
diff changeset
175 }
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // Successfully processed the object; look for the next object.
a61af66fc99e Initial load
duke
parents:
diff changeset
178 cur_beg = find_obj_beg(cur_end + 1, search_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 live_closure->set_source(bit_to_addr(range_end));
a61af66fc99e Initial load
duke
parents:
diff changeset
182 return complete;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 ParMarkBitMap::IterationStatus
a61af66fc99e Initial load
duke
parents:
diff changeset
186 ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
a61af66fc99e Initial load
duke
parents:
diff changeset
187 ParMarkBitMapClosure* dead_closure,
a61af66fc99e Initial load
duke
parents:
diff changeset
188 idx_t range_beg, idx_t range_end,
a61af66fc99e Initial load
duke
parents:
diff changeset
189 idx_t dead_range_end) const
a61af66fc99e Initial load
duke
parents:
diff changeset
190 {
a61af66fc99e Initial load
duke
parents:
diff changeset
191 DEBUG_ONLY(verify_bit(range_beg);)
a61af66fc99e Initial load
duke
parents:
diff changeset
192 DEBUG_ONLY(verify_bit(range_end);)
a61af66fc99e Initial load
duke
parents:
diff changeset
193 DEBUG_ONLY(verify_bit(dead_range_end);)
a61af66fc99e Initial load
duke
parents:
diff changeset
194 assert(range_beg <= range_end, "live range invalid");
a61af66fc99e Initial load
duke
parents:
diff changeset
195 assert(range_end <= dead_range_end, "dead range invalid");
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 // The bitmap routines require the right boundary to be word-aligned.
a61af66fc99e Initial load
duke
parents:
diff changeset
198 const idx_t live_search_end = BitMap::word_align_up(range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 const idx_t dead_search_end = BitMap::word_align_up(dead_range_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201 idx_t cur_beg = range_beg;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 if (range_beg < range_end && is_unmarked(range_beg)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 // The range starts with dead space. Look for the next object, then fill.
a61af66fc99e Initial load
duke
parents:
diff changeset
204 cur_beg = find_obj_beg(range_beg + 1, dead_search_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 const idx_t dead_space_end = MIN2(cur_beg - 1, dead_range_end - 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 const size_t size = obj_size(range_beg, dead_space_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
207 dead_closure->do_addr(bit_to_addr(range_beg), size);
a61af66fc99e Initial load
duke
parents:
diff changeset
208 }
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 while (cur_beg < range_end) {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 const idx_t cur_end = find_obj_end(cur_beg, live_search_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
212 if (cur_end >= range_end) {
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // The obj ends outside the range.
a61af66fc99e Initial load
duke
parents:
diff changeset
214 live_closure->set_source(bit_to_addr(cur_beg));
a61af66fc99e Initial load
duke
parents:
diff changeset
215 return incomplete;
a61af66fc99e Initial load
duke
parents:
diff changeset
216 }
a61af66fc99e Initial load
duke
parents:
diff changeset
217
a61af66fc99e Initial load
duke
parents:
diff changeset
218 const size_t size = obj_size(cur_beg, cur_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
219 IterationStatus status = live_closure->do_addr(bit_to_addr(cur_beg), size);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 if (status != incomplete) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 assert(status == would_overflow || status == full, "sanity");
a61af66fc99e Initial load
duke
parents:
diff changeset
222 return status;
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 // Look for the start of the next object.
a61af66fc99e Initial load
duke
parents:
diff changeset
226 const idx_t dead_space_beg = cur_end + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
227 cur_beg = find_obj_beg(dead_space_beg, dead_search_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (cur_beg > dead_space_beg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // Found dead space; compute the size and invoke the dead closure.
a61af66fc99e Initial load
duke
parents:
diff changeset
230 const idx_t dead_space_end = MIN2(cur_beg - 1, dead_range_end - 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
231 const size_t size = obj_size(dead_space_beg, dead_space_end);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 dead_closure->do_addr(bit_to_addr(dead_space_beg), size);
a61af66fc99e Initial load
duke
parents:
diff changeset
233 }
a61af66fc99e Initial load
duke
parents:
diff changeset
234 }
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 live_closure->set_source(bit_to_addr(range_end));
a61af66fc99e Initial load
duke
parents:
diff changeset
237 return complete;
a61af66fc99e Initial load
duke
parents:
diff changeset
238 }
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
241 void ParMarkBitMap::reset_counters()
a61af66fc99e Initial load
duke
parents:
diff changeset
242 {
a61af66fc99e Initial load
duke
parents:
diff changeset
243 _cas_tries = _cas_retries = _cas_by_another = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245 #endif // #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
246
a61af66fc99e Initial load
duke
parents:
diff changeset
247 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
248 void ParMarkBitMap::verify_clear() const
a61af66fc99e Initial load
duke
parents:
diff changeset
249 {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 const idx_t* const beg = (const idx_t*)_virtual_space->committed_low_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
251 const idx_t* const end = (const idx_t*)_virtual_space->committed_high_addr();
a61af66fc99e Initial load
duke
parents:
diff changeset
252 for (const idx_t* p = beg; p < end; ++p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
253 assert(*p == 0, "bitmap not clear");
a61af66fc99e Initial load
duke
parents:
diff changeset
254 }
a61af66fc99e Initial load
duke
parents:
diff changeset
255 }
a61af66fc99e Initial load
duke
parents:
diff changeset
256 #endif // #ifdef ASSERT