Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @ 18886:9afe8fbe088c
Add -G:[-/+]PrintIdealGraph option.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 19 Jan 2015 18:00:28 +0100 |
parents | 52b4284cb496 |
children | 7848fc12602b |
rev | line source |
---|---|
0 | 1 /* |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
14223
diff
changeset
|
2 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. |
0 | 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:
845
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
845
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:
845
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "memory/allocation.inline.hpp" | |
27 #include "memory/cardTableModRefBS.hpp" | |
28 #include "memory/cardTableRS.hpp" | |
29 #include "memory/sharedHeap.hpp" | |
30 #include "memory/space.inline.hpp" | |
31 #include "memory/universe.hpp" | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
32 #include "oops/oop.inline.hpp" |
1972 | 33 #include "runtime/java.hpp" |
34 #include "runtime/mutexLocker.hpp" | |
35 #include "runtime/virtualspace.hpp" | |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
36 #include "runtime/vmThread.hpp" |
0 | 37 |
17937
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
14223
diff
changeset
|
38 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
14223
diff
changeset
|
39 |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
40 void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
41 OopsInGenClosure* cl, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
42 CardTableRS* ct, |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
43 int n_threads) { |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
44 assert(n_threads > 0, "Error: expected n_threads > 0"); |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
45 assert((n_threads == 1 && ParallelGCThreads == 0) || |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
46 n_threads <= (int)ParallelGCThreads, |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
47 "# worker threads != # requested!"); |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
48 assert(!Thread::current()->is_VM_thread() || (n_threads == 1), "There is only 1 VM thread"); |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
49 assert(UseDynamicNumberOfGCThreads || |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
50 !FLAG_IS_DEFAULT(ParallelGCThreads) || |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
51 n_threads == (int)ParallelGCThreads, |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
52 "# worker threads != # requested!"); |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
53 // Make sure the LNC array is valid for the space. |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
54 jbyte** lowest_non_clean; |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
55 uintptr_t lowest_non_clean_base_chunk_index; |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
56 size_t lowest_non_clean_chunk_size; |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
57 get_LNC_array_for_space(sp, lowest_non_clean, |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
58 lowest_non_clean_base_chunk_index, |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
59 lowest_non_clean_chunk_size); |
0 | 60 |
4728
441e946dc1af
7121618: Change type of number of GC workers to unsigned int.
jmasa
parents:
4095
diff
changeset
|
61 uint n_strides = n_threads * ParGCStridesPerThread; |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
62 SequentialSubTasksDone* pst = sp->par_seq_tasks(); |
4095
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
63 // Sets the condition for completion of the subtask (how many threads |
bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
3860
diff
changeset
|
64 // need to finish in order to be done). |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
65 pst->set_n_threads(n_threads); |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
66 pst->set_n_tasks(n_strides); |
0 | 67 |
4728
441e946dc1af
7121618: Change type of number of GC workers to unsigned int.
jmasa
parents:
4095
diff
changeset
|
68 uint stride = 0; |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
69 while (!pst->is_task_claimed(/* reference */ stride)) { |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
70 process_stride(sp, mr, stride, n_strides, cl, ct, |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
71 lowest_non_clean, |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
72 lowest_non_clean_base_chunk_index, |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
73 lowest_non_clean_chunk_size); |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
74 } |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
75 if (pst->all_tasks_completed()) { |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
76 // Clear lowest_non_clean array for next time. |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
77 intptr_t first_chunk_index = addr_to_chunk_index(mr.start()); |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
78 uintptr_t last_chunk_index = addr_to_chunk_index(mr.last()); |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
79 for (uintptr_t ch = first_chunk_index; ch <= last_chunk_index; ch++) { |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
80 intptr_t ind = ch - lowest_non_clean_base_chunk_index; |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
81 assert(0 <= ind && ind < (intptr_t)lowest_non_clean_chunk_size, |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
82 "Bounds error"); |
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
83 lowest_non_clean[ind] = NULL; |
0 | 84 } |
85 } | |
86 } | |
87 | |
88 void | |
89 CardTableModRefBS:: | |
90 process_stride(Space* sp, | |
91 MemRegion used, | |
92 jint stride, int n_strides, | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
93 OopsInGenClosure* cl, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
94 CardTableRS* ct, |
0 | 95 jbyte** lowest_non_clean, |
96 uintptr_t lowest_non_clean_base_chunk_index, | |
97 size_t lowest_non_clean_chunk_size) { | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
98 // We go from higher to lower addresses here; it wouldn't help that much |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
99 // because of the strided parallelism pattern used here. |
0 | 100 |
101 // Find the first card address of the first chunk in the stride that is | |
102 // at least "bottom" of the used region. | |
103 jbyte* start_card = byte_for(used.start()); | |
104 jbyte* end_card = byte_after(used.last()); | |
105 uintptr_t start_chunk = addr_to_chunk_index(used.start()); | |
106 uintptr_t start_chunk_stride_num = start_chunk % n_strides; | |
107 jbyte* chunk_card_start; | |
108 | |
109 if ((uintptr_t)stride >= start_chunk_stride_num) { | |
110 chunk_card_start = (jbyte*)(start_card + | |
111 (stride - start_chunk_stride_num) * | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
112 ParGCCardsPerStrideChunk); |
0 | 113 } else { |
114 // Go ahead to the next chunk group boundary, then to the requested stride. | |
115 chunk_card_start = (jbyte*)(start_card + | |
116 (n_strides - start_chunk_stride_num + stride) * | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
117 ParGCCardsPerStrideChunk); |
0 | 118 } |
119 | |
120 while (chunk_card_start < end_card) { | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
121 // Even though we go from lower to higher addresses below, the |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
122 // strided parallelism can interleave the actual processing of the |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
123 // dirty pages in various ways. For a specific chunk within this |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
124 // stride, we take care to avoid double scanning or missing a card |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
125 // by suitably initializing the "min_done" field in process_chunk_boundaries() |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
126 // below, together with the dirty region extension accomplished in |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
127 // DirtyCardToOopClosure::do_MemRegion(). |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
128 jbyte* chunk_card_end = chunk_card_start + ParGCCardsPerStrideChunk; |
0 | 129 // Invariant: chunk_mr should be fully contained within the "used" region. |
130 MemRegion chunk_mr = MemRegion(addr_for(chunk_card_start), | |
131 chunk_card_end >= end_card ? | |
132 used.end() : addr_for(chunk_card_end)); | |
133 assert(chunk_mr.word_size() > 0, "[chunk_card_start > used_end)"); | |
134 assert(used.contains(chunk_mr), "chunk_mr should be subset of used"); | |
135 | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
136 DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
137 cl->gen_boundary()); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
138 ClearNoncleanCardWrapper clear_cl(dcto_cl, ct); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
139 |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
140 |
0 | 141 // Process the chunk. |
142 process_chunk_boundaries(sp, | |
143 dcto_cl, | |
144 chunk_mr, | |
145 used, | |
146 lowest_non_clean, | |
147 lowest_non_clean_base_chunk_index, | |
148 lowest_non_clean_chunk_size); | |
149 | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
150 // We want the LNC array updates above in process_chunk_boundaries |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
151 // to be visible before any of the card table value changes as a |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
152 // result of the dirty card iteration below. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
153 OrderAccess::storestore(); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
154 |
3287
c48ad6ab8bdf
7037276: Unnecessary double traversal of dirty card windows
ysr
parents:
3256
diff
changeset
|
155 // We do not call the non_clean_card_iterate_serial() version because |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
156 // we want to clear the cards: clear_cl here does the work of finding |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
157 // contiguous dirty ranges of cards to process and clear. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
158 clear_cl.do_MemRegion(chunk_mr); |
0 | 159 |
160 // Find the next chunk of the stride. | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
161 chunk_card_start += ParGCCardsPerStrideChunk * n_strides; |
0 | 162 } |
163 } | |
164 | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
165 |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
166 // If you want a talkative process_chunk_boundaries, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
167 // then #define NOISY(x) x |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
168 #ifdef NOISY |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
169 #error "Encountered a global preprocessor flag, NOISY, which might clash with local definition to follow" |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
170 #else |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
171 #define NOISY(x) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
172 #endif |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
173 |
0 | 174 void |
175 CardTableModRefBS:: | |
176 process_chunk_boundaries(Space* sp, | |
177 DirtyCardToOopClosure* dcto_cl, | |
178 MemRegion chunk_mr, | |
179 MemRegion used, | |
180 jbyte** lowest_non_clean, | |
181 uintptr_t lowest_non_clean_base_chunk_index, | |
182 size_t lowest_non_clean_chunk_size) | |
183 { | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
184 // We must worry about non-array objects that cross chunk boundaries, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
185 // because such objects are both precisely and imprecisely marked: |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
186 // .. if the head of such an object is dirty, the entire object |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
187 // needs to be scanned, under the interpretation that this |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
188 // was an imprecise mark |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
189 // .. if the head of such an object is not dirty, we can assume |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
190 // precise marking and it's efficient to scan just the dirty |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
191 // cards. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
192 // In either case, each scanned reference must be scanned precisely |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
193 // once so as to avoid cloning of a young referent. For efficiency, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
194 // our closures depend on this property and do not protect against |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
195 // double scans. |
0 | 196 |
197 uintptr_t cur_chunk_index = addr_to_chunk_index(chunk_mr.start()); | |
198 cur_chunk_index = cur_chunk_index - lowest_non_clean_base_chunk_index; | |
199 | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
200 NOISY(tty->print_cr("===========================================================================");) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
201 NOISY(tty->print_cr(" process_chunk_boundary: Called with [" PTR_FORMAT "," PTR_FORMAT ")", |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
202 chunk_mr.start(), chunk_mr.end());) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
203 |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
204 // First, set "our" lowest_non_clean entry, which would be |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
205 // used by the thread scanning an adjoining left chunk with |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
206 // a non-array object straddling the mutual boundary. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
207 // Find the object that spans our boundary, if one exists. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
208 // first_block is the block possibly straddling our left boundary. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
209 HeapWord* first_block = sp->block_start(chunk_mr.start()); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
210 assert((chunk_mr.start() != used.start()) || (first_block == chunk_mr.start()), |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
211 "First chunk should always have a co-initial block"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
212 // Does the block straddle the chunk's left boundary, and is it |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
213 // a non-array object? |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
214 if (first_block < chunk_mr.start() // first block straddles left bdry |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
215 && sp->block_is_obj(first_block) // first block is an object |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
216 && !(oop(first_block)->is_objArray() // first block is not an array (arrays are precisely dirtied) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
217 || oop(first_block)->is_typeArray())) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
218 // Find our least non-clean card, so that a left neighbour |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
219 // does not scan an object straddling the mutual boundary |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
220 // too far to the right, and attempt to scan a portion of |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
221 // that object twice. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
222 jbyte* first_dirty_card = NULL; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
223 jbyte* last_card_of_first_obj = |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
224 byte_for(first_block + sp->block_size(first_block) - 1); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
225 jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start()); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
226 jbyte* last_card_of_cur_chunk = byte_for(chunk_mr.last()); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
227 jbyte* last_card_to_check = |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
228 (jbyte*) MIN2((intptr_t) last_card_of_cur_chunk, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
229 (intptr_t) last_card_of_first_obj); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
230 // Note that this does not need to go beyond our last card |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
231 // if our first object completely straddles this chunk. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
232 for (jbyte* cur = first_card_of_cur_chunk; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
233 cur <= last_card_to_check; cur++) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
234 jbyte val = *cur; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
235 if (card_will_be_scanned(val)) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
236 first_dirty_card = cur; break; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
237 } else { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
238 assert(!card_may_have_been_dirty(val), "Error"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
239 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
240 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
241 if (first_dirty_card != NULL) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
242 NOISY(tty->print_cr(" LNC: Found a dirty card at " PTR_FORMAT " in current chunk", |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
243 first_dirty_card);) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
244 assert(0 <= cur_chunk_index && cur_chunk_index < lowest_non_clean_chunk_size, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
245 "Bounds error."); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
246 assert(lowest_non_clean[cur_chunk_index] == NULL, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
247 "Write exactly once : value should be stable hereafter for this round"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
248 lowest_non_clean[cur_chunk_index] = first_dirty_card; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
249 } NOISY(else { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
250 tty->print_cr(" LNC: Found no dirty card in current chunk; leaving LNC entry NULL"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
251 // In the future, we could have this thread look for a non-NULL value to copy from its |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
252 // right neighbour (up to the end of the first object). |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
253 if (last_card_of_cur_chunk < last_card_of_first_obj) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
254 tty->print_cr(" LNC: BEWARE!!! first obj straddles past right end of chunk:\n" |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
255 " might be efficient to get value from right neighbour?"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
256 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
257 }) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
258 } else { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
259 // In this case we can help our neighbour by just asking them |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
260 // to stop at our first card (even though it may not be dirty). |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
261 NOISY(tty->print_cr(" LNC: first block is not a non-array object; setting LNC to first card of current chunk");) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
262 assert(lowest_non_clean[cur_chunk_index] == NULL, "Write once : value should be stable hereafter"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
263 jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start()); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
264 lowest_non_clean[cur_chunk_index] = first_card_of_cur_chunk; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
265 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
266 NOISY(tty->print_cr(" process_chunk_boundary: lowest_non_clean[" INTPTR_FORMAT "] = " PTR_FORMAT |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
267 " which corresponds to the heap address " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
268 cur_chunk_index, lowest_non_clean[cur_chunk_index], |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
269 (lowest_non_clean[cur_chunk_index] != NULL) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
270 ? addr_for(lowest_non_clean[cur_chunk_index]) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
271 : NULL);) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
272 NOISY(tty->print_cr("---------------------------------------------------------------------------");) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
273 |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
274 // Next, set our own max_to_do, which will strictly/exclusively bound |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
275 // the highest address that we will scan past the right end of our chunk. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
276 HeapWord* max_to_do = NULL; |
0 | 277 if (chunk_mr.end() < used.end()) { |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
278 // This is not the last chunk in the used region. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
279 // What is our last block? We check the first block of |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
280 // the next (right) chunk rather than strictly check our last block |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
281 // because it's potentially more efficient to do so. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
282 HeapWord* const last_block = sp->block_start(chunk_mr.end()); |
0 | 283 assert(last_block <= chunk_mr.end(), "In case this property changes."); |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
284 if ((last_block == chunk_mr.end()) // our last block does not straddle boundary |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
285 || !sp->block_is_obj(last_block) // last_block isn't an object |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
286 || oop(last_block)->is_objArray() // last_block is an array (precisely marked) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
287 || oop(last_block)->is_typeArray()) { |
0 | 288 max_to_do = chunk_mr.end(); |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
289 NOISY(tty->print_cr(" process_chunk_boundary: Last block on this card is not a non-array object;\n" |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
290 " max_to_do left at " PTR_FORMAT, max_to_do);) |
0 | 291 } else { |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
292 assert(last_block < chunk_mr.end(), "Tautology"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
293 // It is a non-array object that straddles the right boundary of this chunk. |
0 | 294 // last_obj_card is the card corresponding to the start of the last object |
295 // in the chunk. Note that the last object may not start in | |
296 // the chunk. | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
297 jbyte* const last_obj_card = byte_for(last_block); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
298 const jbyte val = *last_obj_card; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
299 if (!card_will_be_scanned(val)) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
300 assert(!card_may_have_been_dirty(val), "Error"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
301 // The card containing the head is not dirty. Any marks on |
0 | 302 // subsequent cards still in this chunk must have been made |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
303 // precisely; we can cap processing at the end of our chunk. |
0 | 304 max_to_do = chunk_mr.end(); |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
305 NOISY(tty->print_cr(" process_chunk_boundary: Head of last object on this card is not dirty;\n" |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
306 " max_to_do left at " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
307 max_to_do);) |
0 | 308 } else { |
309 // The last object must be considered dirty, and extends onto the | |
310 // following chunk. Look for a dirty card in that chunk that will | |
311 // bound our processing. | |
312 jbyte* limit_card = NULL; | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
313 const size_t last_block_size = sp->block_size(last_block); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
314 jbyte* const last_card_of_last_obj = |
0 | 315 byte_for(last_block + last_block_size - 1); |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
316 jbyte* const first_card_of_next_chunk = byte_for(chunk_mr.end()); |
0 | 317 // This search potentially goes a long distance looking |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
318 // for the next card that will be scanned, terminating |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
319 // at the end of the last_block, if no earlier dirty card |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
320 // is found. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
321 assert(byte_for(chunk_mr.end()) - byte_for(chunk_mr.start()) == ParGCCardsPerStrideChunk, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
322 "last card of next chunk may be wrong"); |
0 | 323 for (jbyte* cur = first_card_of_next_chunk; |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
324 cur <= last_card_of_last_obj; cur++) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
325 const jbyte val = *cur; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
326 if (card_will_be_scanned(val)) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
327 NOISY(tty->print_cr(" Found a non-clean card " PTR_FORMAT " with value 0x%x", |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
328 cur, (int)val);) |
0 | 329 limit_card = cur; break; |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
330 } else { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
331 assert(!card_may_have_been_dirty(val), "Error: card can't be skipped"); |
0 | 332 } |
333 } | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
334 if (limit_card != NULL) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
335 max_to_do = addr_for(limit_card); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
336 assert(limit_card != NULL && max_to_do != NULL, "Error"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
337 NOISY(tty->print_cr(" process_chunk_boundary: Found a dirty card at " PTR_FORMAT |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
338 " max_to_do set at " PTR_FORMAT " which is before end of last block in chunk: " |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
339 PTR_FORMAT " + " PTR_FORMAT " = " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
340 limit_card, max_to_do, last_block, last_block_size, (last_block+last_block_size));) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
341 } else { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
342 // The following is a pessimistic value, because it's possible |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
343 // that a dirty card on a subsequent chunk has been cleared by |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
344 // the time we get to look at it; we'll correct for that further below, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
345 // using the LNC array which records the least non-clean card |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
346 // before cards were cleared in a particular chunk. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
347 limit_card = last_card_of_last_obj; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
348 max_to_do = last_block + last_block_size; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
349 assert(limit_card != NULL && max_to_do != NULL, "Error"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
350 NOISY(tty->print_cr(" process_chunk_boundary: Found no dirty card before end of last block in chunk\n" |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
351 " Setting limit_card to " PTR_FORMAT |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
352 " and max_to_do " PTR_FORMAT " + " PTR_FORMAT " = " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
353 limit_card, last_block, last_block_size, max_to_do);) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
354 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
355 assert(0 < cur_chunk_index+1 && cur_chunk_index+1 < lowest_non_clean_chunk_size, |
0 | 356 "Bounds error."); |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
357 // It is possible that a dirty card for the last object may have been |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
358 // cleared before we had a chance to examine it. In that case, the value |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
359 // will have been logged in the LNC for that chunk. |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
360 // We need to examine as many chunks to the right as this object |
3762
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
361 // covers. However, we need to bound this checking to the largest |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
362 // entry in the LNC array: this is because the heap may expand |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
363 // after the LNC array has been created but before we reach this point, |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
364 // and the last block in our chunk may have been expanded to include |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
365 // the expansion delta (and possibly subsequently allocated from, so |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
366 // it wouldn't be sufficient to check whether that last block was |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
367 // or was not an object at this point). |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
368 uintptr_t last_chunk_index_to_check = addr_to_chunk_index(last_block + last_block_size - 1) |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
369 - lowest_non_clean_base_chunk_index; |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
370 const uintptr_t last_chunk_index = addr_to_chunk_index(used.last()) |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
371 - lowest_non_clean_base_chunk_index; |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
372 if (last_chunk_index_to_check > last_chunk_index) { |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
373 assert(last_block + last_block_size > used.end(), |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
374 err_msg("Inconsistency detected: last_block [" PTR_FORMAT "," PTR_FORMAT "]" |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
375 " does not exceed used.end() = " PTR_FORMAT "," |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
376 " yet last_chunk_index_to_check " INTPTR_FORMAT |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
377 " exceeds last_chunk_index " INTPTR_FORMAT, |
8668 | 378 last_block, last_block + last_block_size, |
379 used.end(), | |
3762
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
380 last_chunk_index_to_check, last_chunk_index)); |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
381 assert(sp->used_region().end() > used.end(), |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
382 err_msg("Expansion did not happen: " |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
383 "[" PTR_FORMAT "," PTR_FORMAT ") -> [" PTR_FORMAT "," PTR_FORMAT ")", |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
384 sp->used_region().start(), sp->used_region().end(), used.start(), used.end())); |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
385 NOISY(tty->print_cr(" process_chunk_boundary: heap expanded; explicitly bounding last_chunk");) |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
386 last_chunk_index_to_check = last_chunk_index; |
5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
ysr
parents:
3359
diff
changeset
|
387 } |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
388 for (uintptr_t lnc_index = cur_chunk_index + 1; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
389 lnc_index <= last_chunk_index_to_check; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
390 lnc_index++) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
391 jbyte* lnc_card = lowest_non_clean[lnc_index]; |
0 | 392 if (lnc_card != NULL) { |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
393 // we can stop at the first non-NULL entry we find |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
394 if (lnc_card <= limit_card) { |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
395 NOISY(tty->print_cr(" process_chunk_boundary: LNC card " PTR_FORMAT " is lower than limit_card " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
396 " max_to_do will be lowered to " PTR_FORMAT " from " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
397 lnc_card, limit_card, addr_for(lnc_card), max_to_do);) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
398 limit_card = lnc_card; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
399 max_to_do = addr_for(limit_card); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
400 assert(limit_card != NULL && max_to_do != NULL, "Error"); |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
401 } |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
402 // In any case, we break now |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
403 break; |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
404 } // else continue to look for a non-NULL entry if any |
0 | 405 } |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
406 assert(limit_card != NULL && max_to_do != NULL, "Error"); |
0 | 407 } |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
408 assert(max_to_do != NULL, "OOPS 1 !"); |
0 | 409 } |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
410 assert(max_to_do != NULL, "OOPS 2!"); |
0 | 411 } else { |
412 max_to_do = used.end(); | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
413 NOISY(tty->print_cr(" process_chunk_boundary: Last chunk of this space;\n" |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
414 " max_to_do left at " PTR_FORMAT, |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
415 max_to_do);) |
0 | 416 } |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
417 assert(max_to_do != NULL, "OOPS 3!"); |
0 | 418 // Now we can set the closure we're using so it doesn't to beyond |
419 // max_to_do. | |
420 dcto_cl->set_min_done(max_to_do); | |
421 #ifndef PRODUCT | |
422 dcto_cl->set_last_bottom(max_to_do); | |
423 #endif | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
424 NOISY(tty->print_cr("===========================================================================\n");) |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
425 } |
0 | 426 |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
427 #undef NOISY |
0 | 428 |
429 void | |
430 CardTableModRefBS:: | |
431 get_LNC_array_for_space(Space* sp, | |
432 jbyte**& lowest_non_clean, | |
433 uintptr_t& lowest_non_clean_base_chunk_index, | |
434 size_t& lowest_non_clean_chunk_size) { | |
435 | |
436 int i = find_covering_region_containing(sp->bottom()); | |
437 MemRegion covered = _covered[i]; | |
438 size_t n_chunks = chunks_to_cover(covered); | |
439 | |
440 // Only the first thread to obtain the lock will resize the | |
441 // LNC array for the covered region. Any later expansion can't affect | |
442 // the used_at_save_marks region. | |
443 // (I observed a bug in which the first thread to execute this would | |
3357
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
444 // resize, and then it would cause "expand_and_allocate" that would |
fc2b798ab316
6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
ysr
parents:
3287
diff
changeset
|
445 // increase the number of chunks in the covered region. Then a second |
0 | 446 // thread would come and execute this, see that the size didn't match, |
447 // and free and allocate again. So the first thread would be using a | |
448 // freed "_lowest_non_clean" array.) | |
449 | |
450 // Do a dirty read here. If we pass the conditional then take the rare | |
451 // event lock and do the read again in case some other thread had already | |
452 // succeeded and done the resize. | |
453 int cur_collection = Universe::heap()->total_collections(); | |
454 if (_last_LNC_resizing_collection[i] != cur_collection) { | |
455 MutexLocker x(ParGCRareEvent_lock); | |
456 if (_last_LNC_resizing_collection[i] != cur_collection) { | |
457 if (_lowest_non_clean[i] == NULL || | |
458 n_chunks != _lowest_non_clean_chunk_size[i]) { | |
459 | |
460 // Should we delete the old? | |
461 if (_lowest_non_clean[i] != NULL) { | |
462 assert(n_chunks != _lowest_non_clean_chunk_size[i], | |
463 "logical consequence"); | |
6197 | 464 FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i], mtGC); |
0 | 465 _lowest_non_clean[i] = NULL; |
466 } | |
467 // Now allocate a new one if necessary. | |
468 if (_lowest_non_clean[i] == NULL) { | |
6197 | 469 _lowest_non_clean[i] = NEW_C_HEAP_ARRAY(CardPtr, n_chunks, mtGC); |
0 | 470 _lowest_non_clean_chunk_size[i] = n_chunks; |
471 _lowest_non_clean_base_chunk_index[i] = addr_to_chunk_index(covered.start()); | |
472 for (int j = 0; j < (int)n_chunks; j++) | |
473 _lowest_non_clean[i][j] = NULL; | |
474 } | |
475 } | |
476 _last_LNC_resizing_collection[i] = cur_collection; | |
477 } | |
478 } | |
479 // In any case, now do the initialization. | |
480 lowest_non_clean = _lowest_non_clean[i]; | |
481 lowest_non_clean_base_chunk_index = _lowest_non_clean_base_chunk_index[i]; | |
482 lowest_non_clean_chunk_size = _lowest_non_clean_chunk_size[i]; | |
483 } |