Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/heapRegion.cpp @ 24234:ea6f94ab283b default tip
Added tag jvmci-0.36 for changeset 8128b98d4736
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 18 Sep 2017 18:49:45 +0200 |
parents | f13e777eb255 |
children |
rev | line source |
---|---|
342 | 1 /* |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
342 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1550
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1550
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:
1550
diff
changeset
|
21 * questions. |
342 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
12080 | 26 #include "code/nmethod.hpp" |
1972 | 27 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp" |
28 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | |
29 #include "gc_implementation/g1/g1OopClosures.inline.hpp" | |
30 #include "gc_implementation/g1/heapRegion.inline.hpp" | |
20423 | 31 #include "gc_implementation/g1/heapRegionBounds.inline.hpp" |
1972 | 32 #include "gc_implementation/g1/heapRegionRemSet.hpp" |
20377
a8ea2f110d87
8054819: Rename HeapRegionSeq to HeapRegionManager
tschatzl
parents:
20336
diff
changeset
|
33 #include "gc_implementation/g1/heapRegionManager.inline.hpp" |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
34 #include "gc_implementation/shared/liveRange.hpp" |
1972 | 35 #include "memory/genOopClosures.inline.hpp" |
36 #include "memory/iterator.hpp" | |
20198
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
20197
diff
changeset
|
37 #include "memory/space.inline.hpp" |
1972 | 38 #include "oops/oop.inline.hpp" |
20197
ce8f6bb717c9
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
17937
diff
changeset
|
39 #include "runtime/orderAccess.inline.hpp" |
342 | 40 |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17773
diff
changeset
|
41 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17773
diff
changeset
|
42 |
3986
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
43 int HeapRegion::LogOfHRGrainBytes = 0; |
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
44 int HeapRegion::LogOfHRGrainWords = 0; |
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
45 size_t HeapRegion::GrainBytes = 0; |
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
46 size_t HeapRegion::GrainWords = 0; |
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
47 size_t HeapRegion::CardsPerRegion = 0; |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
48 |
342 | 49 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
50 HeapRegion* hr, |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
51 G1ParPushHeapRSClosure* cl, |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
52 CardTableModRefBS::PrecisionStyle precision) : |
20272
e635a728f9da
8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC
mgerdin
parents:
20198
diff
changeset
|
53 DirtyCardToOopClosure(hr, cl, precision, NULL), |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
54 _hr(hr), _rs_scan(cl), _g1(g1) { } |
342 | 55 |
56 FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r, | |
57 OopClosure* oc) : | |
6254
a2f7274eb6ef
7114678: G1: various small fixes, code cleanup, and refactoring
tonyp
parents:
6027
diff
changeset
|
58 _r_bottom(r->bottom()), _r_end(r->end()), _oc(oc) { } |
342 | 59 |
20272
e635a728f9da
8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC
mgerdin
parents:
20198
diff
changeset
|
60 void HeapRegionDCTOC::walk_mem_region(MemRegion mr, |
e635a728f9da
8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC
mgerdin
parents:
20198
diff
changeset
|
61 HeapWord* bottom, |
e635a728f9da
8047819: G1 HeapRegionDCTOC does not need to inherit ContiguousSpaceDCTOC
mgerdin
parents:
20198
diff
changeset
|
62 HeapWord* top) { |
342 | 63 G1CollectedHeap* g1h = _g1; |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
64 size_t oop_size; |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
65 HeapWord* cur = bottom; |
342 | 66 |
67 // Start filtering what we add to the remembered set. If the object is | |
68 // not considered dead, either because it is marked (in the mark bitmap) | |
69 // or it was allocated after marking finished, then we add it. Otherwise | |
70 // we can safely ignore the object. | |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
71 if (!g1h->is_obj_dead(oop(cur), _hr)) { |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
72 oop_size = oop(cur)->oop_iterate(_rs_scan, mr); |
342 | 73 } else { |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
74 oop_size = _hr->block_size(cur); |
342 | 75 } |
76 | |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
77 cur += oop_size; |
3979
4dfb2df418f2
6484982: G1: process references during evacuation pauses
johnc
parents:
3978
diff
changeset
|
78 |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
79 if (cur < top) { |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
80 oop cur_oop = oop(cur); |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
81 oop_size = _hr->block_size(cur); |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
82 HeapWord* next_obj = cur + oop_size; |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
83 while (next_obj < top) { |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
84 // Keep filtering the remembered set. |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
85 if (!g1h->is_obj_dead(cur_oop, _hr)) { |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
86 // Bottom lies entirely below top, so we can call the |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
87 // non-memRegion version of oop_iterate below. |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
88 cur_oop->oop_iterate(_rs_scan); |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
89 } |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
90 cur = next_obj; |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
91 cur_oop = oop(cur); |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
92 oop_size = _hr->block_size(cur); |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
93 next_obj = cur + oop_size; |
342 | 94 } |
95 | |
96 // Last object. Need to do dead-obj filtering here too. | |
23220
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
97 if (!g1h->is_obj_dead(oop(cur), _hr)) { |
b554c7fa9478
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
20652
diff
changeset
|
98 oop(cur)->oop_iterate(_rs_scan, mr); |
342 | 99 } |
100 } | |
101 } | |
102 | |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12178
diff
changeset
|
103 size_t HeapRegion::max_region_size() { |
20423 | 104 return HeapRegionBounds::max_size(); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12178
diff
changeset
|
105 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12178
diff
changeset
|
106 |
12178
84683e78e713
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
12080
diff
changeset
|
107 void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) { |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
108 uintx region_size = G1HeapRegionSize; |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
109 if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { |
12178
84683e78e713
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
12080
diff
changeset
|
110 size_t average_heap_size = (initial_heap_size + max_heap_size) / 2; |
20423 | 111 region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(), |
112 (uintx) HeapRegionBounds::min_size()); | |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
113 } |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
114 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
115 int region_size_log = log2_long((jlong) region_size); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
116 // Recalculate the region size to make sure it's a power of |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
117 // 2. This means that region_size is the largest power of 2 that's |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
118 // <= what we've calculated so far. |
1485
fb57d4cf76c2
6931180: Migration to recent versions of MS Platform SDK
prr
parents:
1394
diff
changeset
|
119 region_size = ((uintx)1 << region_size_log); |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
120 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
121 // Now make sure that we don't go over or under our limits. |
20423 | 122 if (region_size < HeapRegionBounds::min_size()) { |
123 region_size = HeapRegionBounds::min_size(); | |
124 } else if (region_size > HeapRegionBounds::max_size()) { | |
125 region_size = HeapRegionBounds::max_size(); | |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
126 } |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
127 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
128 // And recalculate the log. |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
129 region_size_log = log2_long((jlong) region_size); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
130 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
131 // Now, set up the globals. |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
132 guarantee(LogOfHRGrainBytes == 0, "we should only set it once"); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
133 LogOfHRGrainBytes = region_size_log; |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
134 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
135 guarantee(LogOfHRGrainWords == 0, "we should only set it once"); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
136 LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize; |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
137 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
138 guarantee(GrainBytes == 0, "we should only set it once"); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
139 // The cast to int is safe, given that we've bounded region_size by |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
140 // MIN_REGION_SIZE and MAX_REGION_SIZE. |
3986
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
141 GrainBytes = (size_t)region_size; |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
142 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
143 guarantee(GrainWords == 0, "we should only set it once"); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
144 GrainWords = GrainBytes >> LogHeapWordSize; |
6010
720b6a76dd9d
7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents:
6008
diff
changeset
|
145 guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity"); |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
146 |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
147 guarantee(CardsPerRegion == 0, "we should only set it once"); |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
148 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
149 } |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
866
diff
changeset
|
150 |
342 | 151 void HeapRegion::reset_after_compaction() { |
152 G1OffsetTableContigSpace::reset_after_compaction(); | |
153 // After a compaction the mark bitmap is invalid, so we must | |
154 // treat all objects as being inside the unmarked area. | |
155 zero_marked_bytes(); | |
156 init_top_at_mark_start(); | |
157 } | |
158 | |
17755
96b1c2e06e25
8027295: Free CSet takes ~50% of young pause time
tschatzl
parents:
17753
diff
changeset
|
159 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { |
2152 | 160 assert(_humongous_start_region == NULL, |
161 "we should have already filtered out humongous regions"); | |
162 assert(_end == _orig_end, | |
163 "we should have already filtered out humongous regions"); | |
164 | |
342 | 165 _in_collection_set = false; |
166 | |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
20377
diff
changeset
|
167 set_allocation_context(AllocationContext::system()); |
342 | 168 set_young_index_in_cset(-1); |
169 uninstall_surv_rate_group(); | |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
170 set_free(); |
2433
abdfc822206f
7023069: G1: Introduce symmetric locking in the slow allocation path
tonyp
parents:
2152
diff
changeset
|
171 reset_pre_dummy_top(); |
342 | 172 |
173 if (!par) { | |
174 // If this is parallel, this will be done later. | |
175 HeapRegionRemSet* hrrs = rem_set(); | |
17755
96b1c2e06e25
8027295: Free CSet takes ~50% of young pause time
tschatzl
parents:
17753
diff
changeset
|
176 if (locked) { |
96b1c2e06e25
8027295: Free CSet takes ~50% of young pause time
tschatzl
parents:
17753
diff
changeset
|
177 hrrs->clear_locked(); |
96b1c2e06e25
8027295: Free CSet takes ~50% of young pause time
tschatzl
parents:
17753
diff
changeset
|
178 } else { |
96b1c2e06e25
8027295: Free CSet takes ~50% of young pause time
tschatzl
parents:
17753
diff
changeset
|
179 hrrs->clear(); |
96b1c2e06e25
8027295: Free CSet takes ~50% of young pause time
tschatzl
parents:
17753
diff
changeset
|
180 } |
355 | 181 _claimed = InitialClaimValue; |
342 | 182 } |
183 zero_marked_bytes(); | |
184 | |
185 _offsets.resize(HeapRegion::GrainWords); | |
186 init_top_at_mark_start(); | |
356 | 187 if (clear_space) clear(SpaceDecorator::Mangle); |
342 | 188 } |
189 | |
3317
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
190 void HeapRegion::par_clear() { |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
191 assert(used() == 0, "the region should have been already cleared"); |
3986
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
192 assert(capacity() == HeapRegion::GrainBytes, "should be back to normal"); |
3317
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
193 HeapRegionRemSet* hrrs = rem_set(); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
194 hrrs->clear(); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
195 CardTableModRefBS* ct_bs = |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
196 (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set(); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
197 ct_bs->clear(MemRegion(bottom(), end())); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
198 } |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
199 |
342 | 200 void HeapRegion::calc_gc_efficiency() { |
6611 | 201 // GC efficiency is the ratio of how much space would be |
202 // reclaimed over how long we predict it would take to reclaim it. | |
342 | 203 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
4912
a9647476d1a4
7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents:
4839
diff
changeset
|
204 G1CollectorPolicy* g1p = g1h->g1_policy(); |
6611 | 205 |
206 // Retrieve a prediction of the elapsed time for this region for | |
207 // a mixed gc because the region will only be evacuated during a | |
208 // mixed gc. | |
209 double region_elapsed_time_ms = | |
210 g1p->predict_region_elapsed_time_ms(this, false /* for_young_gc */); | |
211 _gc_efficiency = (double) reclaimable_bytes() / region_elapsed_time_ms; | |
342 | 212 } |
213 | |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
214 void HeapRegion::set_startsHumongous(HeapWord* new_top, HeapWord* new_end) { |
2152 | 215 assert(!isHumongous(), "sanity / pre-condition"); |
1886
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
216 assert(end() == _orig_end, |
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
217 "Should be normal before the humongous object allocation"); |
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
218 assert(top() == bottom(), "should be empty"); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
219 assert(bottom() <= new_top && new_top <= new_end, "pre-condition"); |
1886
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
220 |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
221 _type.set_starts_humongous(); |
342 | 222 _humongous_start_region = this; |
1886
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
223 |
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
224 set_end(new_end); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
225 _offsets.set_for_starts_humongous(new_top); |
1886
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
226 } |
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
227 |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
228 void HeapRegion::set_continuesHumongous(HeapRegion* first_hr) { |
2152 | 229 assert(!isHumongous(), "sanity / pre-condition"); |
1886
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
230 assert(end() == _orig_end, |
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
231 "Should be normal before the humongous object allocation"); |
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
232 assert(top() == bottom(), "should be empty"); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
233 assert(first_hr->startsHumongous(), "pre-condition"); |
1886
72a161e62cc4
6991377: G1: race between concurrent refinement and humongous object allocation
tonyp
parents:
1718
diff
changeset
|
234 |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
235 _type.set_continues_humongous(); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
236 _humongous_start_region = first_hr; |
342 | 237 } |
238 | |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
239 void HeapRegion::clear_humongous() { |
2152 | 240 assert(isHumongous(), "pre-condition"); |
241 | |
242 if (startsHumongous()) { | |
243 assert(top() <= end(), "pre-condition"); | |
244 set_end(_orig_end); | |
245 if (top() > end()) { | |
246 // at least one "continues humongous" region after it | |
247 set_top(end()); | |
248 } | |
249 } else { | |
250 // continues humongous | |
251 assert(end() == _orig_end, "sanity"); | |
252 } | |
253 | |
3986
65a8ff39a6da
7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
johnc
parents:
3983
diff
changeset
|
254 assert(capacity() == HeapRegion::GrainBytes, "pre-condition"); |
2152 | 255 _humongous_start_region = NULL; |
256 } | |
257 | |
342 | 258 bool HeapRegion::claimHeapRegion(jint claimValue) { |
259 jint current = _claimed; | |
260 if (current != claimValue) { | |
261 jint res = Atomic::cmpxchg(claimValue, &_claimed, current); | |
262 if (res == current) { | |
263 return true; | |
264 } | |
265 } | |
266 return false; | |
267 } | |
268 | |
20377
a8ea2f110d87
8054819: Rename HeapRegionSeq to HeapRegionManager
tschatzl
parents:
20336
diff
changeset
|
269 HeapRegion::HeapRegion(uint hrm_index, |
6010
720b6a76dd9d
7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents:
6008
diff
changeset
|
270 G1BlockOffsetSharedArray* sharedOffsetArray, |
20417 | 271 MemRegion mr) : |
6754
8fbf05030e24
7016955: G1: remove the is_zeroed parameter from the HeapRegion constructor
johnc
parents:
6725
diff
changeset
|
272 G1OffsetTableContigSpace(sharedOffsetArray, mr), |
20417 | 273 _hrm_index(hrm_index), |
274 _allocation_context(AllocationContext::system()), | |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
275 _humongous_start_region(NULL), |
3830
f44782f04dd4
7039627: G1: avoid BOT updates for survivor allocations and dirty survivor regions incrementally
tonyp
parents:
3772
diff
changeset
|
276 _in_collection_set(false), |
342 | 277 _next_in_special_set(NULL), _orig_end(NULL), |
355 | 278 _claimed(InitialClaimValue), _evacuation_failed(false), |
6011 | 279 _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0), |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
280 _next_young_region(NULL), |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
281 _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL), |
2152 | 282 #ifdef ASSERT |
283 _containing_set(NULL), | |
284 #endif // ASSERT | |
285 _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1), | |
286 _rem_set(NULL), _recorded_rs_length(0), _predicted_elapsed_time_ms(0), | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1388
diff
changeset
|
287 _predicted_bytes_to_copy(0) |
342 | 288 { |
12080 | 289 _rem_set = new HeapRegionRemSet(sharedOffsetArray, this); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
290 assert(HeapRegionRemSet::num_par_rem_sets() > 0, "Invariant."); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
291 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
292 initialize(mr); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
293 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
294 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
295 void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
296 assert(_rem_set->is_empty(), "Remembered set must be empty"); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
297 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
298 G1OffsetTableContigSpace::initialize(mr, clear_space, mangle_space); |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
299 |
342 | 300 _orig_end = mr.end(); |
6754
8fbf05030e24
7016955: G1: remove the is_zeroed parameter from the HeapRegion constructor
johnc
parents:
6725
diff
changeset
|
301 hr_clear(false /*par*/, false /*clear_space*/); |
356 | 302 set_top(bottom()); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
303 record_timestamp(); |
342 | 304 } |
305 | |
6254
a2f7274eb6ef
7114678: G1: various small fixes, code cleanup, and refactoring
tonyp
parents:
6027
diff
changeset
|
306 CompactibleSpace* HeapRegion::next_compaction_space() const { |
20295
3f2894c5052e
8048112: G1 Full GC needs to support the case when the very first region is not available
tschatzl
parents:
20278
diff
changeset
|
307 return G1CollectedHeap::heap()->next_compaction_region(this); |
342 | 308 } |
309 | |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
310 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
311 bool during_conc_mark) { |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
312 // We always recreate the prev marking info and we'll explicitly |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
313 // mark all objects we find to be self-forwarded on the prev |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
314 // bitmap. So all objects need to be below PTAMS. |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
315 _prev_marked_bytes = 0; |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
316 |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
317 if (during_initial_mark) { |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
318 // During initial-mark, we'll also explicitly mark all objects |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
319 // we find to be self-forwarded on the next bitmap. So all |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
320 // objects need to be below NTAMS. |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
321 _next_top_at_mark_start = top(); |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
322 _next_marked_bytes = 0; |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
323 } else if (during_conc_mark) { |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
324 // During concurrent mark, all objects in the CSet (including |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
325 // the ones we find to be self-forwarded) are implicitly live. |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
326 // So all objects need to be above NTAMS. |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
327 _next_top_at_mark_start = bottom(); |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
328 _next_marked_bytes = 0; |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
329 } |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
330 } |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
331 |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
332 void HeapRegion::note_self_forwarding_removal_end(bool during_initial_mark, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
333 bool during_conc_mark, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
334 size_t marked_bytes) { |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
335 assert(0 <= marked_bytes && marked_bytes <= used(), |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
336 err_msg("marked: "SIZE_FORMAT" used: "SIZE_FORMAT, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
337 marked_bytes, used())); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
338 _prev_top_at_mark_start = top(); |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
339 _prev_marked_bytes = marked_bytes; |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
340 } |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4725
diff
changeset
|
341 |
342 | 342 HeapWord* |
343 HeapRegion::object_iterate_mem_careful(MemRegion mr, | |
344 ObjectClosure* cl) { | |
345 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | |
346 // We used to use "block_start_careful" here. But we're actually happy | |
347 // to update the BOT while we do this... | |
348 HeapWord* cur = block_start(mr.start()); | |
349 mr = mr.intersection(used_region()); | |
350 if (mr.is_empty()) return NULL; | |
351 // Otherwise, find the obj that extends onto mr.start(). | |
352 | |
353 assert(cur <= mr.start() | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
354 && (oop(cur)->klass_or_null() == NULL || |
342 | 355 cur + oop(cur)->size() > mr.start()), |
356 "postcondition of block_start"); | |
357 oop obj; | |
358 while (cur < mr.end()) { | |
359 obj = oop(cur); | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
360 if (obj->klass_or_null() == NULL) { |
342 | 361 // Ran into an unparseable point. |
362 return cur; | |
363 } else if (!g1h->is_obj_dead(obj)) { | |
364 cl->do_object(obj); | |
365 } | |
366 if (cl->abort()) return cur; | |
367 // The check above must occur before the operation below, since an | |
368 // abort might invalidate the "size" operation. | |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
369 cur += block_size(cur); |
342 | 370 } |
371 return NULL; | |
372 } | |
373 | |
374 HeapWord* | |
375 HeapRegion:: | |
376 oops_on_card_seq_iterate_careful(MemRegion mr, | |
1666
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
377 FilterOutOfRegionClosure* cl, |
3317
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
378 bool filter_young, |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
379 jbyte* card_ptr) { |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
380 // Currently, we should only have to clean the card if filter_young |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
381 // is true and vice versa. |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
382 if (filter_young) { |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
383 assert(card_ptr != NULL, "pre-condition"); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
384 } else { |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
385 assert(card_ptr == NULL, "pre-condition"); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
386 } |
342 | 387 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
388 | |
389 // If we're within a stop-world GC, then we might look at a card in a | |
390 // GC alloc region that extends onto a GC LAB, which may not be | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
391 // parseable. Stop such at the "scan_top" of the region. |
4839 | 392 if (g1h->is_gc_active()) { |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
393 mr = mr.intersection(MemRegion(bottom(), scan_top())); |
342 | 394 } else { |
395 mr = mr.intersection(used_region()); | |
396 } | |
397 if (mr.is_empty()) return NULL; | |
398 // Otherwise, find the obj that extends onto mr.start(). | |
399 | |
1666
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
400 // The intersection of the incoming mr (for the card) and the |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
401 // allocated part of the region is non-empty. This implies that |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
402 // we have actually allocated into this region. The code in |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
403 // G1CollectedHeap.cpp that allocates a new region sets the |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
404 // is_young tag on the region before allocating. Thus we |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
405 // safely know if this region is young. |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
406 if (is_young() && filter_young) { |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
407 return NULL; |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
408 } |
5cbac8938c4c
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
1552
diff
changeset
|
409 |
1705 | 410 assert(!is_young(), "check value of filter_young"); |
411 | |
3317
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
412 // We can only clean the card here, after we make the decision that |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
413 // the card is not young. And we only clean the card if we have been |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
414 // asked to (i.e., card_ptr != NULL). |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
415 if (card_ptr != NULL) { |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
416 *card_ptr = CardTableModRefBS::clean_card_val(); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
417 // We must complete this write before we do any of the reads below. |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
418 OrderAccess::storeload(); |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
419 } |
063382f9b575
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
2433
diff
changeset
|
420 |
4839 | 421 // Cache the boundaries of the memory region in some const locals |
422 HeapWord* const start = mr.start(); | |
423 HeapWord* const end = mr.end(); | |
424 | |
342 | 425 // We used to use "block_start_careful" here. But we're actually happy |
426 // to update the BOT while we do this... | |
4839 | 427 HeapWord* cur = block_start(start); |
428 assert(cur <= start, "Postcondition"); | |
429 | |
430 oop obj; | |
342 | 431 |
4839 | 432 HeapWord* next = cur; |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
433 do { |
4839 | 434 cur = next; |
435 obj = oop(cur); | |
436 if (obj->klass_or_null() == NULL) { | |
342 | 437 // Ran into an unparseable point. |
438 return cur; | |
439 } | |
440 // Otherwise... | |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
441 next = cur + block_size(cur); |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
442 } while (next <= start); |
4839 | 443 |
444 // If we finish the above loop...We have a parseable object that | |
445 // begins on or before the start of the memory region, and ends | |
446 // inside or spans the entire region. | |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
447 assert(cur <= start, "Loop postcondition"); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
448 assert(obj->klass_or_null() != NULL, "Loop postcondition"); |
4839 | 449 |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
450 do { |
342 | 451 obj = oop(cur); |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
452 assert((cur + block_size(cur)) > (HeapWord*)obj, "Loop invariant"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
453 if (obj->klass_or_null() == NULL) { |
342 | 454 // Ran into an unparseable point. |
455 return cur; | |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
456 } |
4839 | 457 |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
458 // Advance the current pointer. "obj" still points to the object to iterate. |
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
459 cur = cur + block_size(cur); |
4839 | 460 |
342 | 461 if (!g1h->is_obj_dead(obj)) { |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
462 // Non-objArrays are sometimes marked imprecise at the object start. We |
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
463 // always need to iterate over them in full. |
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
464 // We only iterate over object arrays in full if they are completely contained |
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
465 // in the memory region. |
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
466 if (!obj->is_objArray() || (((HeapWord*)obj) >= start && cur <= end)) { |
342 | 467 obj->oop_iterate(cl); |
468 } else { | |
4839 | 469 obj->oop_iterate(cl, mr); |
342 | 470 } |
471 } | |
22904
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
472 } while (cur < end); |
36c7518fd486
8069760: When iterating over a card, G1 often iterates over much more references than are contained in the card
tschatzl
parents:
22897
diff
changeset
|
473 |
342 | 474 return NULL; |
475 } | |
476 | |
12080 | 477 // Code roots support |
478 | |
479 void HeapRegion::add_strong_code_root(nmethod* nm) { | |
480 HeapRegionRemSet* hrrs = rem_set(); | |
481 hrrs->add_strong_code_root(nm); | |
482 } | |
483 | |
20494 | 484 void HeapRegion::add_strong_code_root_locked(nmethod* nm) { |
485 assert_locked_or_safepoint(CodeCache_lock); | |
486 HeapRegionRemSet* hrrs = rem_set(); | |
487 hrrs->add_strong_code_root_locked(nm); | |
488 } | |
489 | |
12080 | 490 void HeapRegion::remove_strong_code_root(nmethod* nm) { |
491 HeapRegionRemSet* hrrs = rem_set(); | |
492 hrrs->remove_strong_code_root(nm); | |
493 } | |
494 | |
495 void HeapRegion::strong_code_roots_do(CodeBlobClosure* blk) const { | |
496 HeapRegionRemSet* hrrs = rem_set(); | |
497 hrrs->strong_code_roots_do(blk); | |
498 } | |
499 | |
500 class VerifyStrongCodeRootOopClosure: public OopClosure { | |
501 const HeapRegion* _hr; | |
502 nmethod* _nm; | |
503 bool _failures; | |
504 bool _has_oops_in_region; | |
505 | |
506 template <class T> void do_oop_work(T* p) { | |
507 T heap_oop = oopDesc::load_heap_oop(p); | |
508 if (!oopDesc::is_null(heap_oop)) { | |
509 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); | |
510 | |
511 // Note: not all the oops embedded in the nmethod are in the | |
512 // current region. We only look at those which are. | |
513 if (_hr->is_in(obj)) { | |
514 // Object is in the region. Check that its less than top | |
515 if (_hr->top() <= (HeapWord*)obj) { | |
516 // Object is above top | |
517 gclog_or_tty->print_cr("Object "PTR_FORMAT" in region " | |
518 "["PTR_FORMAT", "PTR_FORMAT") is above " | |
519 "top "PTR_FORMAT, | |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
12233
diff
changeset
|
520 (void *)obj, _hr->bottom(), _hr->end(), _hr->top()); |
12080 | 521 _failures = true; |
522 return; | |
523 } | |
524 // Nmethod has at least one oop in the current region | |
525 _has_oops_in_region = true; | |
526 } | |
527 } | |
528 } | |
529 | |
530 public: | |
531 VerifyStrongCodeRootOopClosure(const HeapRegion* hr, nmethod* nm): | |
532 _hr(hr), _failures(false), _has_oops_in_region(false) {} | |
533 | |
534 void do_oop(narrowOop* p) { do_oop_work(p); } | |
535 void do_oop(oop* p) { do_oop_work(p); } | |
536 | |
537 bool failures() { return _failures; } | |
538 bool has_oops_in_region() { return _has_oops_in_region; } | |
539 }; | |
540 | |
541 class VerifyStrongCodeRootCodeBlobClosure: public CodeBlobClosure { | |
542 const HeapRegion* _hr; | |
543 bool _failures; | |
544 public: | |
545 VerifyStrongCodeRootCodeBlobClosure(const HeapRegion* hr) : | |
546 _hr(hr), _failures(false) {} | |
547 | |
548 void do_code_blob(CodeBlob* cb) { | |
549 nmethod* nm = (cb == NULL) ? NULL : cb->as_nmethod_or_null(); | |
550 if (nm != NULL) { | |
551 // Verify that the nemthod is live | |
552 if (!nm->is_alive()) { | |
553 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has dead nmethod " | |
554 PTR_FORMAT" in its strong code roots", | |
555 _hr->bottom(), _hr->end(), nm); | |
556 _failures = true; | |
557 } else { | |
558 VerifyStrongCodeRootOopClosure oop_cl(_hr, nm); | |
559 nm->oops_do(&oop_cl); | |
560 if (!oop_cl.has_oops_in_region()) { | |
561 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has nmethod " | |
562 PTR_FORMAT" in its strong code roots " | |
563 "with no pointers into region", | |
564 _hr->bottom(), _hr->end(), nm); | |
565 _failures = true; | |
566 } else if (oop_cl.failures()) { | |
567 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has other " | |
568 "failures for nmethod "PTR_FORMAT, | |
569 _hr->bottom(), _hr->end(), nm); | |
570 _failures = true; | |
571 } | |
572 } | |
573 } | |
574 } | |
575 | |
576 bool failures() { return _failures; } | |
577 }; | |
578 | |
579 void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const { | |
580 if (!G1VerifyHeapRegionCodeRoots) { | |
581 // We're not verifying code roots. | |
582 return; | |
583 } | |
584 if (vo == VerifyOption_G1UseMarkWord) { | |
585 // Marking verification during a full GC is performed after class | |
586 // unloading, code cache unloading, etc so the strong code roots | |
587 // attached to each heap region are in an inconsistent state. They won't | |
588 // be consistent until the strong code roots are rebuilt after the | |
589 // actual GC. Skip verifying the strong code roots in this particular | |
590 // time. | |
591 assert(VerifyDuringGC, "only way to get here"); | |
592 return; | |
593 } | |
594 | |
595 HeapRegionRemSet* hrrs = rem_set(); | |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
13062
diff
changeset
|
596 size_t strong_code_roots_length = hrrs->strong_code_roots_list_length(); |
12080 | 597 |
598 // if this region is empty then there should be no entries | |
599 // on its strong code root list | |
600 if (is_empty()) { | |
601 if (strong_code_roots_length > 0) { | |
602 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty " | |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
13062
diff
changeset
|
603 "but has "SIZE_FORMAT" code root entries", |
12080 | 604 bottom(), end(), strong_code_roots_length); |
605 *failures = true; | |
606 } | |
607 return; | |
608 } | |
609 | |
13062
28674af341ac
8027756: assert(!hr->isHumongous()) failed: code root in humongous region?
tschatzl
parents:
13060
diff
changeset
|
610 if (continuesHumongous()) { |
12080 | 611 if (strong_code_roots_length > 0) { |
13062
28674af341ac
8027756: assert(!hr->isHumongous()) failed: code root in humongous region?
tschatzl
parents:
13060
diff
changeset
|
612 gclog_or_tty->print_cr("region "HR_FORMAT" is a continuation of a humongous " |
17753
191174b49bec
8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
13062
diff
changeset
|
613 "region but has "SIZE_FORMAT" code root entries", |
13062
28674af341ac
8027756: assert(!hr->isHumongous()) failed: code root in humongous region?
tschatzl
parents:
13060
diff
changeset
|
614 HR_FORMAT_PARAMS(this), strong_code_roots_length); |
12080 | 615 *failures = true; |
616 } | |
617 return; | |
618 } | |
619 | |
620 VerifyStrongCodeRootCodeBlobClosure cb_cl(this); | |
621 strong_code_roots_do(&cb_cl); | |
622 | |
623 if (cb_cl.failures()) { | |
624 *failures = true; | |
625 } | |
626 } | |
627 | |
342 | 628 void HeapRegion::print() const { print_on(gclog_or_tty); } |
629 void HeapRegion::print_on(outputStream* st) const { | |
20404
227a9e5e4b4a
8057536: Refactor G1 to allow context specific allocations
sjohanss
parents:
20377
diff
changeset
|
630 st->print("AC%4u", allocation_context()); |
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
20423
diff
changeset
|
631 st->print(" %2s", get_short_type_str()); |
342 | 632 if (in_collection_set()) |
633 st->print(" CS"); | |
634 else | |
635 st->print(" "); | |
4073
53074c2c4600
7099849: G1: include heap region information in hs_err files
tonyp
parents:
4023
diff
changeset
|
636 st->print(" TS %5d", _gc_time_stamp); |
1388 | 637 st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, |
638 prev_top_at_mark_start(), next_top_at_mark_start()); | |
342 | 639 G1OffsetTableContigSpace::print_on(st); |
640 } | |
641 | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
642 class G1VerificationClosure : public OopClosure { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
643 protected: |
12080 | 644 G1CollectedHeap* _g1h; |
645 CardTableModRefBS* _bs; | |
646 oop _containing_obj; | |
647 bool _failures; | |
648 int _n_failures; | |
649 VerifyOption _vo; | |
650 public: | |
651 // _vo == UsePrevMarking -> use "prev" marking information, | |
652 // _vo == UseNextMarking -> use "next" marking information, | |
653 // _vo == UseMarkWord -> use mark word from object header. | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
654 G1VerificationClosure(G1CollectedHeap* g1h, VerifyOption vo) : |
12080 | 655 _g1h(g1h), _bs(NULL), _containing_obj(NULL), |
656 _failures(false), _n_failures(0), _vo(vo) | |
657 { | |
658 BarrierSet* bs = _g1h->barrier_set(); | |
659 if (bs->is_a(BarrierSet::CardTableModRef)) | |
660 _bs = (CardTableModRefBS*)bs; | |
661 } | |
662 | |
663 void set_containing_obj(oop obj) { | |
664 _containing_obj = obj; | |
665 } | |
666 | |
667 bool failures() { return _failures; } | |
668 int n_failures() { return _n_failures; } | |
669 | |
670 void print_object(outputStream* out, oop obj) { | |
671 #ifdef PRODUCT | |
672 Klass* k = obj->klass(); | |
673 const char* class_name = InstanceKlass::cast(k)->external_name(); | |
674 out->print_cr("class name %s", class_name); | |
675 #else // PRODUCT | |
676 obj->print_on(out); | |
677 #endif // PRODUCT | |
678 } | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
679 }; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
680 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
681 class VerifyLiveClosure : public G1VerificationClosure { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
682 public: |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
683 VerifyLiveClosure(G1CollectedHeap* g1h, VerifyOption vo) : G1VerificationClosure(g1h, vo) {} |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
684 virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
685 virtual void do_oop(oop* p) { do_oop_work(p); } |
12080 | 686 |
687 template <class T> | |
688 void do_oop_work(T* p) { | |
689 assert(_containing_obj != NULL, "Precondition"); | |
690 assert(!_g1h->is_obj_dead_cond(_containing_obj, _vo), | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
691 "Precondition"); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
692 verify_liveness(p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
693 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
694 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
695 template <class T> |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
696 void verify_liveness(T* p) { |
12080 | 697 T heap_oop = oopDesc::load_heap_oop(p); |
698 if (!oopDesc::is_null(heap_oop)) { | |
699 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); | |
700 bool failed = false; | |
701 if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) { | |
702 MutexLockerEx x(ParGCRareEvent_lock, | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
703 Mutex::_no_safepoint_check_flag); |
12080 | 704 |
705 if (!_failures) { | |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17773
diff
changeset
|
706 gclog_or_tty->cr(); |
12080 | 707 gclog_or_tty->print_cr("----------"); |
708 } | |
709 if (!_g1h->is_in_closed_subset(obj)) { | |
710 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); | |
711 gclog_or_tty->print_cr("Field "PTR_FORMAT | |
712 " of live obj "PTR_FORMAT" in region " | |
713 "["PTR_FORMAT", "PTR_FORMAT")", | |
714 p, (void*) _containing_obj, | |
715 from->bottom(), from->end()); | |
716 print_object(gclog_or_tty, _containing_obj); | |
717 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap", | |
718 (void*) obj); | |
719 } else { | |
720 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); | |
721 HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); | |
722 gclog_or_tty->print_cr("Field "PTR_FORMAT | |
723 " of live obj "PTR_FORMAT" in region " | |
724 "["PTR_FORMAT", "PTR_FORMAT")", | |
725 p, (void*) _containing_obj, | |
726 from->bottom(), from->end()); | |
727 print_object(gclog_or_tty, _containing_obj); | |
728 gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region " | |
729 "["PTR_FORMAT", "PTR_FORMAT")", | |
730 (void*) obj, to->bottom(), to->end()); | |
731 print_object(gclog_or_tty, obj); | |
732 } | |
733 gclog_or_tty->print_cr("----------"); | |
734 gclog_or_tty->flush(); | |
735 _failures = true; | |
736 failed = true; | |
737 _n_failures++; | |
738 } | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
739 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
740 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
741 }; |
12080 | 742 |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
743 class VerifyRemSetClosure : public G1VerificationClosure { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
744 public: |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
745 VerifyRemSetClosure(G1CollectedHeap* g1h, VerifyOption vo) : G1VerificationClosure(g1h, vo) {} |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
746 virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
747 virtual void do_oop(oop* p) { do_oop_work(p); } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
748 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
749 template <class T> |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
750 void do_oop_work(T* p) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
751 assert(_containing_obj != NULL, "Precondition"); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
752 assert(!_g1h->is_obj_dead_cond(_containing_obj, _vo), |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
753 "Precondition"); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
754 verify_remembered_set(p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
755 } |
12080 | 756 |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
757 template <class T> |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
758 void verify_remembered_set(T* p) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
759 T heap_oop = oopDesc::load_heap_oop(p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
760 if (!oopDesc::is_null(heap_oop)) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
761 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
762 bool failed = false; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
763 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
764 HeapRegion* to = _g1h->heap_region_containing(obj); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
765 if (from != NULL && to != NULL && |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
766 from != to && |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
767 !to->isHumongous()) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
768 jbyte cv_obj = *_bs->byte_for_const(_containing_obj); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
769 jbyte cv_field = *_bs->byte_for_const(p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
770 const jbyte dirty = CardTableModRefBS::dirty_card_val(); |
12080 | 771 |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
772 bool is_bad = !(from->is_young() |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
773 || to->rem_set()->contains_reference(p) |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
774 || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
775 (_containing_obj->is_objArray() ? |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
776 cv_field == dirty |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
777 : cv_obj == dirty || cv_field == dirty)); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
778 if (is_bad) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
779 MutexLockerEx x(ParGCRareEvent_lock, |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
780 Mutex::_no_safepoint_check_flag); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
781 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
782 if (!_failures) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
783 gclog_or_tty->cr(); |
12080 | 784 gclog_or_tty->print_cr("----------"); |
785 } | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
786 gclog_or_tty->print_cr("Missing rem set entry:"); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
787 gclog_or_tty->print_cr("Field "PTR_FORMAT" " |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
788 "of obj "PTR_FORMAT", " |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
789 "in region "HR_FORMAT, |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
790 p, (void*) _containing_obj, |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
791 HR_FORMAT_PARAMS(from)); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
792 _containing_obj->print_on(gclog_or_tty); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
793 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" " |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
794 "in region "HR_FORMAT, |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
795 (void*) obj, |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
796 HR_FORMAT_PARAMS(to)); |
23835
f21c5c4d5231
8150002: Check for the validity of oop before printing it in verify_remembered_set
aeriksso
parents:
23626
diff
changeset
|
797 if (obj->is_oop()) { |
f21c5c4d5231
8150002: Check for the validity of oop before printing it in verify_remembered_set
aeriksso
parents:
23626
diff
changeset
|
798 obj->print_on(gclog_or_tty); |
f21c5c4d5231
8150002: Check for the validity of oop before printing it in verify_remembered_set
aeriksso
parents:
23626
diff
changeset
|
799 } |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
800 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
801 cv_obj, cv_field); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
802 gclog_or_tty->print_cr("----------"); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
803 gclog_or_tty->flush(); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
804 _failures = true; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
805 if (!failed) _n_failures++; |
12080 | 806 } |
807 } | |
808 } | |
809 } | |
810 }; | |
811 | 811 |
342 | 812 // This really ought to be commoned up into OffsetTableContigSpace somehow. |
813 // We would need a mechanism to make that code skip dead objects. | |
814 | |
6008 | 815 void HeapRegion::verify(VerifyOption vo, |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
816 bool* failures) const { |
342 | 817 G1CollectedHeap* g1 = G1CollectedHeap::heap(); |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
818 *failures = false; |
342 | 819 HeapWord* p = bottom(); |
820 HeapWord* prev_p = NULL; | |
3772
6747fd0512e0
7004681: G1: Extend marking verification to Full GCs
johnc
parents:
3766
diff
changeset
|
821 VerifyLiveClosure vl_cl(g1, vo); |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
822 VerifyRemSetClosure vr_cl(g1, vo); |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
823 bool is_humongous = isHumongous(); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
824 bool do_bot_verify = !is_young(); |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
825 size_t object_num = 0; |
342 | 826 while (p < top()) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
827 oop obj = oop(p); |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
828 size_t obj_size = block_size(p); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
829 object_num += 1; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
830 |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
831 if (is_humongous != g1->isHumongous(obj_size) && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
832 !g1->is_obj_dead(obj, this)) { // Dead objects may have bigger block_size since they span several objects. |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
833 gclog_or_tty->print_cr("obj "PTR_FORMAT" is of %shumongous size (" |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
834 SIZE_FORMAT" words) in a %shumongous region", |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
835 p, g1->isHumongous(obj_size) ? "" : "non-", |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
836 obj_size, is_humongous ? "" : "non-"); |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
837 *failures = true; |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
838 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
839 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
840 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
841 // If it returns false, verify_for_object() will output the |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
842 // appropriate message. |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
843 if (do_bot_verify && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
844 !g1->is_obj_dead(obj, this) && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
845 !_offsets.verify_for_object(p, obj_size)) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
846 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
847 return; |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
848 } |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
849 |
3772
6747fd0512e0
7004681: G1: Extend marking verification to Full GCs
johnc
parents:
3766
diff
changeset
|
850 if (!g1->is_obj_dead_cond(obj, this, vo)) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
851 if (obj->is_oop()) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6611
diff
changeset
|
852 Klass* klass = obj->klass(); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
853 bool is_metaspace_object = Metaspace::contains(klass) || |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
854 (vo == VerifyOption_G1UsePrevMarking && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
855 ClassLoaderDataGraph::unload_list_contains(klass)); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
856 if (!is_metaspace_object) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
857 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
12233
diff
changeset
|
858 "not metadata", klass, (void *)obj); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
859 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
860 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
861 } else if (!klass->is_klass()) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
862 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
12233
diff
changeset
|
863 "not a klass", klass, (void *)obj); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
864 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
865 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
866 } else { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
867 vl_cl.set_containing_obj(obj); |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
868 if (!g1->full_collection() || G1VerifyRSetsDuringFullGC) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
869 // verify liveness and rem_set |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
870 vr_cl.set_containing_obj(obj); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
871 G1Mux2Closure mux(&vl_cl, &vr_cl); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
872 obj->oop_iterate_no_header(&mux); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
873 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
874 if (vr_cl.failures()) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
875 *failures = true; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
876 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
877 if (G1MaxVerifyFailures >= 0 && |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
878 vr_cl.n_failures() >= G1MaxVerifyFailures) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
879 return; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
880 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
881 } else { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
882 // verify only liveness |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
883 obj->oop_iterate_no_header(&vl_cl); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
884 } |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
885 if (vl_cl.failures()) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
886 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
887 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
888 if (G1MaxVerifyFailures >= 0 && |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
889 vl_cl.n_failures() >= G1MaxVerifyFailures) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
890 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
891 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
892 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
893 } else { |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
894 gclog_or_tty->print_cr(PTR_FORMAT" not an oop", (void *)obj); |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
895 *failures = true; |
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
896 return; |
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
897 } |
342 | 898 } |
899 prev_p = p; | |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
900 p += obj_size; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
901 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
902 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
903 if (p != top()) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
904 gclog_or_tty->print_cr("end of last object "PTR_FORMAT" " |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
905 "does not match top "PTR_FORMAT, p, top()); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
906 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
907 return; |
342 | 908 } |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
909 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
910 HeapWord* the_end = end(); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
911 assert(p == top(), "it should still hold"); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
912 // Do some extra BOT consistency checking for addresses in the |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
913 // range [top, end). BOT look-ups in this range should yield |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
914 // top. No point in doing that if top == end (there's nothing there). |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
915 if (p < the_end) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
916 // Look up top |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
917 HeapWord* addr_1 = p; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
918 HeapWord* b_start_1 = _offsets.block_start_const(addr_1); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
919 if (b_start_1 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
920 gclog_or_tty->print_cr("BOT look up for top: "PTR_FORMAT" " |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
921 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
922 addr_1, b_start_1, p); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
923 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
924 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
925 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
926 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
927 // Look up top + 1 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
928 HeapWord* addr_2 = p + 1; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
929 if (addr_2 < the_end) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
930 HeapWord* b_start_2 = _offsets.block_start_const(addr_2); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
931 if (b_start_2 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
932 gclog_or_tty->print_cr("BOT look up for top + 1: "PTR_FORMAT" " |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
933 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
934 addr_2, b_start_2, p); |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
935 *failures = true; |
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
936 return; |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
937 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
938 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
939 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
940 // Look up an address between top and end |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
941 size_t diff = pointer_delta(the_end, p) / 2; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
942 HeapWord* addr_3 = p + diff; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
943 if (addr_3 < the_end) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
944 HeapWord* b_start_3 = _offsets.block_start_const(addr_3); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
945 if (b_start_3 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
946 gclog_or_tty->print_cr("BOT look up for top + diff: "PTR_FORMAT" " |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
947 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
948 addr_3, b_start_3, p); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
949 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
950 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
951 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
952 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
953 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
954 // Loook up end - 1 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
955 HeapWord* addr_4 = the_end - 1; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
956 HeapWord* b_start_4 = _offsets.block_start_const(addr_4); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
957 if (b_start_4 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
958 gclog_or_tty->print_cr("BOT look up for end - 1: "PTR_FORMAT" " |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
959 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
960 addr_4, b_start_4, p); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
961 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
962 return; |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
963 } |
342 | 964 } |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
965 |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
966 if (is_humongous && object_num > 1) { |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
967 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous " |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
968 "but has "SIZE_FORMAT", objects", |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
969 bottom(), end(), object_num); |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
970 *failures = true; |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
971 return; |
342 | 972 } |
12080 | 973 |
974 verify_strong_code_roots(vo, failures); | |
975 } | |
976 | |
977 void HeapRegion::verify() const { | |
978 bool dummy = false; | |
979 verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy); | |
342 | 980 } |
981 | |
23626
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
982 void HeapRegion::verify_rem_set(VerifyOption vo, bool* failures) const { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
983 G1CollectedHeap* g1 = G1CollectedHeap::heap(); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
984 *failures = false; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
985 HeapWord* p = bottom(); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
986 HeapWord* prev_p = NULL; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
987 VerifyRemSetClosure vr_cl(g1, vo); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
988 while (p < top()) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
989 oop obj = oop(p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
990 size_t obj_size = block_size(p); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
991 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
992 if (!g1->is_obj_dead_cond(obj, this, vo)) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
993 if (obj->is_oop()) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
994 vr_cl.set_containing_obj(obj); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
995 obj->oop_iterate_no_header(&vr_cl); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
996 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
997 if (vr_cl.failures()) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
998 *failures = true; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
999 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1000 if (G1MaxVerifyFailures >= 0 && |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1001 vr_cl.n_failures() >= G1MaxVerifyFailures) { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1002 return; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1003 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1004 } else { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1005 gclog_or_tty->print_cr(PTR_FORMAT " not an oop", p2i(obj)); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1006 *failures = true; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1007 return; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1008 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1009 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1010 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1011 prev_p = p; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1012 p += obj_size; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1013 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1014 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1015 |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1016 void HeapRegion::verify_rem_set() const { |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1017 bool failures = false; |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1018 verify_rem_set(VerifyOption_G1UsePrevMarking, &failures); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1019 guarantee(!failures, "HeapRegion RemSet verification failed"); |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1020 } |
8daf136b3218
8145442: Add the facility to verify remembered sets for G1
poonam
parents:
23228
diff
changeset
|
1021 |
342 | 1022 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go |
1023 // away eventually. | |
1024 | |
356 | 1025 void G1OffsetTableContigSpace::clear(bool mangle_space) { |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1026 set_top(bottom()); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1027 _scan_top = bottom(); |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1028 CompactibleSpace::clear(mangle_space); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1029 reset_bot(); |
342 | 1030 } |
1031 | |
1032 void G1OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) { | |
1033 Space::set_bottom(new_bottom); | |
1034 _offsets.set_bottom(new_bottom); | |
1035 } | |
1036 | |
1037 void G1OffsetTableContigSpace::set_end(HeapWord* new_end) { | |
1038 Space::set_end(new_end); | |
1039 _offsets.resize(new_end - bottom()); | |
1040 } | |
1041 | |
1042 void G1OffsetTableContigSpace::print() const { | |
1043 print_short(); | |
1044 gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " | |
1045 INTPTR_FORMAT ", " INTPTR_FORMAT ")", | |
1046 bottom(), top(), _offsets.threshold(), end()); | |
1047 } | |
1048 | |
1049 HeapWord* G1OffsetTableContigSpace::initialize_threshold() { | |
1050 return _offsets.initialize_threshold(); | |
1051 } | |
1052 | |
1053 HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start, | |
1054 HeapWord* end) { | |
1055 _offsets.alloc_block(start, end); | |
1056 return _offsets.threshold(); | |
1057 } | |
1058 | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1059 HeapWord* G1OffsetTableContigSpace::scan_top() const { |
342 | 1060 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
20652
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
1061 HeapWord* local_top = top(); |
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
1062 OrderAccess::loadload(); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1063 const unsigned local_time_stamp = _gc_time_stamp; |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1064 assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant"); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1065 if (local_time_stamp < g1h->get_gc_time_stamp()) { |
20652
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
1066 return local_top; |
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
1067 } else { |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1068 return _scan_top; |
20652
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
1069 } |
342 | 1070 } |
1071 | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1072 void G1OffsetTableContigSpace::record_timestamp() { |
342 | 1073 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
1074 unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp(); | |
1075 | |
1076 if (_gc_time_stamp < curr_gc_time_stamp) { | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1077 // Setting the time stamp here tells concurrent readers to look at |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1078 // scan_top to know the maximum allowed address to look at. |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1079 |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1080 // scan_top should be bottom for all regions except for the |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1081 // retained old alloc region which should have scan_top == top |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1082 HeapWord* st = _scan_top; |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1083 guarantee(st == _bottom || st == _top, "invariant"); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1084 |
353
9bb2c10ac07b
6723570: G1: assertion failure: p == current_top or oop(p)->is_oop(),"p is not a block start" (revisited!)
iveresov
parents:
342
diff
changeset
|
1085 _gc_time_stamp = curr_gc_time_stamp; |
342 | 1086 } |
1087 } | |
1088 | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1089 void G1OffsetTableContigSpace::record_retained_region() { |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1090 // scan_top is the maximum address where it's safe for the next gc to |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1091 // scan this region. |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1092 _scan_top = top(); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1093 } |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1094 |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1095 void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1096 object_iterate(blk); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1097 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1098 |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1099 void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1100 HeapWord* p = bottom(); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1101 while (p < top()) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1102 if (block_is_obj(p)) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1103 blk->do_object(oop(p)); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1104 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1105 p += block_size(p); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1106 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1107 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1108 |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1109 #define block_is_always_obj(q) true |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1110 void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1111 SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1112 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1113 #undef block_is_always_obj |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1114 |
342 | 1115 G1OffsetTableContigSpace:: |
1116 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, | |
6754
8fbf05030e24
7016955: G1: remove the is_zeroed parameter from the HeapRegion constructor
johnc
parents:
6725
diff
changeset
|
1117 MemRegion mr) : |
342 | 1118 _offsets(sharedOffsetArray, mr), |
1119 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true), | |
1120 _gc_time_stamp(0) | |
1121 { | |
1122 _offsets.set_space(this); | |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1123 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1124 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1125 void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) { |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1126 CompactibleSpace::initialize(mr, clear_space, mangle_space); |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1127 _top = bottom(); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1128 _scan_top = bottom(); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1129 set_saved_mark_word(NULL); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1130 reset_bot(); |
342 | 1131 } |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1132 |