Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/heapRegion.cpp @ 22923:c04f46b4abe4
8068036: assert(is_available(index)) failed in G1 cset
Summary: Some verification code iterated over the heap using the region mapping array. This is not allowed. Changed to use the regular iteration method with closure.
Reviewed-by: jwilhelm, brutisso
author | tschatzl |
---|---|
date | Tue, 31 Mar 2015 11:36:37 +0200 |
parents | 8e9ede9dd2cd |
children | ea47136e6ea4 |
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, |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
50 HeapRegion* hr, |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
51 G1ParPushHeapRSClosure* cl, |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
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), |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
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; |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
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. | |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
71 if (!g1h->is_obj_dead(oop(cur), _hr)) { |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
72 oop_size = oop(cur)->oop_iterate(_rs_scan, mr); |
342 | 73 } else { |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
74 oop_size = _hr->block_size(cur); |
342 | 75 } |
76 | |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
77 cur += oop_size; |
3979
4dfb2df418f2
6484982: G1: process references during evacuation pauses
johnc
parents:
3978
diff
changeset
|
78 |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
79 if (cur < top) { |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
80 oop cur_oop = oop(cur); |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
81 oop_size = _hr->block_size(cur); |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
82 HeapWord* next_obj = cur + oop_size; |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
83 while (next_obj < top) { |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
84 // Keep filtering the remembered set. |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
85 if (!g1h->is_obj_dead(cur_oop, _hr)) { |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
86 // Bottom lies entirely below top, so we can call the |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
87 // non-memRegion version of oop_iterate below. |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
88 cur_oop->oop_iterate(_rs_scan); |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
89 } |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
90 cur = next_obj; |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
91 cur_oop = oop(cur); |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
92 oop_size = _hr->block_size(cur); |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
93 next_obj = cur + oop_size; |
342 | 94 } |
95 | |
96 // Last object. Need to do dead-obj filtering here too. | |
22905
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
diff
changeset
|
97 if (!g1h->is_obj_dead(oop(cur), _hr)) { |
8e9ede9dd2cd
8067655: Clean up G1 remembered set oop iteration
mgerdin
parents:
22904
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 | |
12080 | 642 class VerifyLiveClosure: public OopClosure { |
643 private: | |
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. | |
654 VerifyLiveClosure(G1CollectedHeap* g1h, VerifyOption vo) : | |
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 virtual void do_oop(narrowOop* p) { do_oop_work(p); } | |
671 virtual void do_oop( oop* p) { do_oop_work(p); } | |
672 | |
673 void print_object(outputStream* out, oop obj) { | |
674 #ifdef PRODUCT | |
675 Klass* k = obj->klass(); | |
676 const char* class_name = InstanceKlass::cast(k)->external_name(); | |
677 out->print_cr("class name %s", class_name); | |
678 #else // PRODUCT | |
679 obj->print_on(out); | |
680 #endif // PRODUCT | |
681 } | |
682 | |
683 template <class T> | |
684 void do_oop_work(T* p) { | |
685 assert(_containing_obj != NULL, "Precondition"); | |
686 assert(!_g1h->is_obj_dead_cond(_containing_obj, _vo), | |
687 "Precondition"); | |
688 T heap_oop = oopDesc::load_heap_oop(p); | |
689 if (!oopDesc::is_null(heap_oop)) { | |
690 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); | |
691 bool failed = false; | |
692 if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) { | |
693 MutexLockerEx x(ParGCRareEvent_lock, | |
694 Mutex::_no_safepoint_check_flag); | |
695 | |
696 if (!_failures) { | |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17773
diff
changeset
|
697 gclog_or_tty->cr(); |
12080 | 698 gclog_or_tty->print_cr("----------"); |
699 } | |
700 if (!_g1h->is_in_closed_subset(obj)) { | |
701 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); | |
702 gclog_or_tty->print_cr("Field "PTR_FORMAT | |
703 " of live obj "PTR_FORMAT" in region " | |
704 "["PTR_FORMAT", "PTR_FORMAT")", | |
705 p, (void*) _containing_obj, | |
706 from->bottom(), from->end()); | |
707 print_object(gclog_or_tty, _containing_obj); | |
708 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap", | |
709 (void*) obj); | |
710 } else { | |
711 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); | |
712 HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); | |
713 gclog_or_tty->print_cr("Field "PTR_FORMAT | |
714 " of live obj "PTR_FORMAT" in region " | |
715 "["PTR_FORMAT", "PTR_FORMAT")", | |
716 p, (void*) _containing_obj, | |
717 from->bottom(), from->end()); | |
718 print_object(gclog_or_tty, _containing_obj); | |
719 gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region " | |
720 "["PTR_FORMAT", "PTR_FORMAT")", | |
721 (void*) obj, to->bottom(), to->end()); | |
722 print_object(gclog_or_tty, obj); | |
723 } | |
724 gclog_or_tty->print_cr("----------"); | |
725 gclog_or_tty->flush(); | |
726 _failures = true; | |
727 failed = true; | |
728 _n_failures++; | |
729 } | |
730 | |
731 if (!_g1h->full_collection() || G1VerifyRSetsDuringFullGC) { | |
732 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); | |
733 HeapRegion* to = _g1h->heap_region_containing(obj); | |
734 if (from != NULL && to != NULL && | |
735 from != to && | |
736 !to->isHumongous()) { | |
737 jbyte cv_obj = *_bs->byte_for_const(_containing_obj); | |
738 jbyte cv_field = *_bs->byte_for_const(p); | |
739 const jbyte dirty = CardTableModRefBS::dirty_card_val(); | |
740 | |
741 bool is_bad = !(from->is_young() | |
742 || to->rem_set()->contains_reference(p) | |
743 || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed | |
744 (_containing_obj->is_objArray() ? | |
745 cv_field == dirty | |
746 : cv_obj == dirty || cv_field == dirty)); | |
747 if (is_bad) { | |
748 MutexLockerEx x(ParGCRareEvent_lock, | |
749 Mutex::_no_safepoint_check_flag); | |
750 | |
751 if (!_failures) { | |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17773
diff
changeset
|
752 gclog_or_tty->cr(); |
12080 | 753 gclog_or_tty->print_cr("----------"); |
754 } | |
755 gclog_or_tty->print_cr("Missing rem set entry:"); | |
756 gclog_or_tty->print_cr("Field "PTR_FORMAT" " | |
757 "of obj "PTR_FORMAT", " | |
758 "in region "HR_FORMAT, | |
759 p, (void*) _containing_obj, | |
760 HR_FORMAT_PARAMS(from)); | |
761 _containing_obj->print_on(gclog_or_tty); | |
762 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" " | |
763 "in region "HR_FORMAT, | |
764 (void*) obj, | |
765 HR_FORMAT_PARAMS(to)); | |
766 obj->print_on(gclog_or_tty); | |
767 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", | |
768 cv_obj, cv_field); | |
769 gclog_or_tty->print_cr("----------"); | |
770 gclog_or_tty->flush(); | |
771 _failures = true; | |
772 if (!failed) _n_failures++; | |
773 } | |
774 } | |
775 } | |
776 } | |
777 } | |
778 }; | |
811 | 779 |
342 | 780 // This really ought to be commoned up into OffsetTableContigSpace somehow. |
781 // We would need a mechanism to make that code skip dead objects. | |
782 | |
6008 | 783 void HeapRegion::verify(VerifyOption vo, |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
784 bool* failures) const { |
342 | 785 G1CollectedHeap* g1 = G1CollectedHeap::heap(); |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
786 *failures = false; |
342 | 787 HeapWord* p = bottom(); |
788 HeapWord* prev_p = NULL; | |
3772
6747fd0512e0
7004681: G1: Extend marking verification to Full GCs
johnc
parents:
3766
diff
changeset
|
789 VerifyLiveClosure vl_cl(g1, vo); |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
790 bool is_humongous = isHumongous(); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
791 bool do_bot_verify = !is_young(); |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
792 size_t object_num = 0; |
342 | 793 while (p < top()) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
794 oop obj = oop(p); |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
795 size_t obj_size = block_size(p); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
796 object_num += 1; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
797 |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
798 if (is_humongous != g1->isHumongous(obj_size) && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
799 !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
|
800 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
|
801 SIZE_FORMAT" words) in a %shumongous region", |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
802 p, g1->isHumongous(obj_size) ? "" : "non-", |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
803 obj_size, is_humongous ? "" : "non-"); |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
804 *failures = true; |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
805 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
806 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
807 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
808 // 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
|
809 // appropriate message. |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
810 if (do_bot_verify && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
811 !g1->is_obj_dead(obj, this) && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
812 !_offsets.verify_for_object(p, obj_size)) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
813 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
814 return; |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
815 } |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
816 |
3772
6747fd0512e0
7004681: G1: Extend marking verification to Full GCs
johnc
parents:
3766
diff
changeset
|
817 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
|
818 if (obj->is_oop()) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6611
diff
changeset
|
819 Klass* klass = obj->klass(); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
820 bool is_metaspace_object = Metaspace::contains(klass) || |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
821 (vo == VerifyOption_G1UsePrevMarking && |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
822 ClassLoaderDataGraph::unload_list_contains(klass)); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20276
diff
changeset
|
823 if (!is_metaspace_object) { |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
824 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
|
825 "not metadata", klass, (void *)obj); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
826 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
827 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
828 } else if (!klass->is_klass()) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
829 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
|
830 "not a klass", klass, (void *)obj); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
831 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
832 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
833 } else { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
834 vl_cl.set_containing_obj(obj); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6611
diff
changeset
|
835 obj->oop_iterate_no_header(&vl_cl); |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
836 if (vl_cl.failures()) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
837 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
838 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
839 if (G1MaxVerifyFailures >= 0 && |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
840 vl_cl.n_failures() >= G1MaxVerifyFailures) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
841 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
842 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
843 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
844 } else { |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
12233
diff
changeset
|
845 gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj); |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
846 *failures = true; |
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
847 return; |
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
848 } |
342 | 849 } |
850 prev_p = p; | |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
851 p += obj_size; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
852 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
853 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
854 if (p != top()) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
855 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
|
856 "does not match top "PTR_FORMAT, p, top()); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
857 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
858 return; |
342 | 859 } |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
860 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
861 HeapWord* the_end = end(); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
862 assert(p == top(), "it should still hold"); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
863 // 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
|
864 // 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
|
865 // 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
|
866 if (p < the_end) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
867 // Look up top |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
868 HeapWord* addr_1 = p; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
869 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
|
870 if (b_start_1 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
871 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
|
872 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
873 addr_1, b_start_1, p); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
874 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
875 return; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
876 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
877 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
878 // Look up top + 1 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
879 HeapWord* addr_2 = p + 1; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
880 if (addr_2 < the_end) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
881 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
|
882 if (b_start_2 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
883 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
|
884 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
885 addr_2, b_start_2, p); |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
886 *failures = true; |
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
887 return; |
2133
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
888 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
889 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
890 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
891 // Look up an address between top and end |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
892 size_t diff = pointer_delta(the_end, p) / 2; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
893 HeapWord* addr_3 = p + diff; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
894 if (addr_3 < the_end) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
895 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
|
896 if (b_start_3 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
897 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
|
898 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
899 addr_3, b_start_3, p); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
900 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
901 return; |
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 } |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
904 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
905 // Loook up end - 1 |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
906 HeapWord* addr_4 = the_end - 1; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
907 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
|
908 if (b_start_4 != p) { |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
909 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
|
910 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
911 addr_4, b_start_4, p); |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
912 *failures = true; |
2250ee17e258
7007068: G1: refine the BOT during evac failure handling
tonyp
parents:
1972
diff
changeset
|
913 return; |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
914 } |
342 | 915 } |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
916 |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
917 if (is_humongous && object_num > 1) { |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
918 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
|
919 "but has "SIZE_FORMAT", objects", |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
920 bottom(), end(), object_num); |
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1705
diff
changeset
|
921 *failures = true; |
1020
ff2402f6a50b
6882730: G1: parallel heap verification messes up region dump
tonyp
parents:
942
diff
changeset
|
922 return; |
342 | 923 } |
12080 | 924 |
925 verify_strong_code_roots(vo, failures); | |
926 } | |
927 | |
928 void HeapRegion::verify() const { | |
929 bool dummy = false; | |
930 verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy); | |
342 | 931 } |
932 | |
933 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go | |
934 // away eventually. | |
935 | |
356 | 936 void G1OffsetTableContigSpace::clear(bool mangle_space) { |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
937 set_top(bottom()); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
938 _scan_top = bottom(); |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
939 CompactibleSpace::clear(mangle_space); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
940 reset_bot(); |
342 | 941 } |
942 | |
943 void G1OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) { | |
944 Space::set_bottom(new_bottom); | |
945 _offsets.set_bottom(new_bottom); | |
946 } | |
947 | |
948 void G1OffsetTableContigSpace::set_end(HeapWord* new_end) { | |
949 Space::set_end(new_end); | |
950 _offsets.resize(new_end - bottom()); | |
951 } | |
952 | |
953 void G1OffsetTableContigSpace::print() const { | |
954 print_short(); | |
955 gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " | |
956 INTPTR_FORMAT ", " INTPTR_FORMAT ")", | |
957 bottom(), top(), _offsets.threshold(), end()); | |
958 } | |
959 | |
960 HeapWord* G1OffsetTableContigSpace::initialize_threshold() { | |
961 return _offsets.initialize_threshold(); | |
962 } | |
963 | |
964 HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start, | |
965 HeapWord* end) { | |
966 _offsets.alloc_block(start, end); | |
967 return _offsets.threshold(); | |
968 } | |
969 | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
970 HeapWord* G1OffsetTableContigSpace::scan_top() const { |
342 | 971 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
|
972 HeapWord* local_top = top(); |
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
973 OrderAccess::loadload(); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
974 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
|
975 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
|
976 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
|
977 return local_top; |
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
978 } else { |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
979 return _scan_top; |
20652
e8bf410d5e23
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
mgerdin
parents:
20542
diff
changeset
|
980 } |
342 | 981 } |
982 | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
983 void G1OffsetTableContigSpace::record_timestamp() { |
342 | 984 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
985 unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp(); | |
986 | |
987 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
|
988 // 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
|
989 // 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
|
990 |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
991 // 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
|
992 // 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
|
993 HeapWord* st = _scan_top; |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
994 guarantee(st == _bottom || st == _top, "invariant"); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
995 |
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
|
996 _gc_time_stamp = curr_gc_time_stamp; |
342 | 997 } |
998 } | |
999 | |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1000 void G1OffsetTableContigSpace::record_retained_region() { |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1001 // 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
|
1002 // scan this region. |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1003 _scan_top = top(); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1004 } |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1005 |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1006 void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1007 object_iterate(blk); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1008 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1009 |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1010 void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1011 HeapWord* p = bottom(); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1012 while (p < top()) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1013 if (block_is_obj(p)) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1014 blk->do_object(oop(p)); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1015 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1016 p += block_size(p); |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1017 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1018 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1019 |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1020 #define block_is_always_obj(q) true |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1021 void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) { |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1022 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
|
1023 } |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1024 #undef block_is_always_obj |
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1025 |
342 | 1026 G1OffsetTableContigSpace:: |
1027 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, | |
6754
8fbf05030e24
7016955: G1: remove the is_zeroed parameter from the HeapRegion constructor
johnc
parents:
6725
diff
changeset
|
1028 MemRegion mr) : |
342 | 1029 _offsets(sharedOffsetArray, mr), |
1030 _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true), | |
1031 _gc_time_stamp(0) | |
1032 { | |
1033 _offsets.set_space(this); | |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1034 } |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1035 |
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1036 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
|
1037 CompactibleSpace::initialize(mr, clear_space, mangle_space); |
20276
1526a938e670
8047818: G1 HeapRegions can no longer be ContiguousSpaces
mgerdin
parents:
20274
diff
changeset
|
1038 _top = bottom(); |
22897
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1039 _scan_top = bottom(); |
80ac3ee51955
8065358: Refactor G1s usage of save_marks and reduce related races
mgerdin
parents:
20652
diff
changeset
|
1040 set_saved_mark_word(NULL); |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1041 reset_bot(); |
342 | 1042 } |
20336
6701abbc4441
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
20295
diff
changeset
|
1043 |