Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 1718:bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
Summary: as the title says, sometimes we are allocating humongous objects in young regions and we shouldn't.
Reviewed-by: ysr, johnc
author | tonyp |
---|---|
date | Tue, 17 Aug 2010 14:40:00 -0400 |
parents | 5f429ee79634 |
children | 8b10f48633dc |
rev | line source |
---|---|
342 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1394
diff
changeset
|
2 * Copyright (c) 2001, 2010, 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:
1394
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1394
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:
1394
diff
changeset
|
21 * questions. |
342 | 22 * |
23 */ | |
24 | |
25 // A "G1CollectedHeap" is an implementation of a java heap for HotSpot. | |
26 // It uses the "Garbage First" heap organization and algorithm, which | |
27 // may combine concurrent marking with parallel, incremental compaction of | |
28 // heap subsets that will yield large amounts of garbage. | |
29 | |
30 class HeapRegion; | |
31 class HeapRegionSeq; | |
32 class PermanentGenerationSpec; | |
33 class GenerationSpec; | |
34 class OopsInHeapRegionClosure; | |
35 class G1ScanHeapEvacClosure; | |
36 class ObjectClosure; | |
37 class SpaceClosure; | |
38 class CompactibleSpaceClosure; | |
39 class Space; | |
40 class G1CollectorPolicy; | |
41 class GenRemSet; | |
42 class G1RemSet; | |
43 class HeapRegionRemSetIterator; | |
44 class ConcurrentMark; | |
45 class ConcurrentMarkThread; | |
46 class ConcurrentG1Refine; | |
47 class ConcurrentZFThread; | |
48 | |
1709 | 49 typedef OverflowTaskQueue<StarTask> RefToScanQueue; |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1261
diff
changeset
|
50 typedef GenericTaskQueueSet<RefToScanQueue> RefToScanQueueSet; |
342 | 51 |
807
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
796
diff
changeset
|
52 typedef int RegionIdx_t; // needs to hold [ 0..max_regions() ) |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
796
diff
changeset
|
53 typedef int CardIdx_t; // needs to hold [ 0..CardsPerRegion ) |
d44bdab1c03d
6843694: G1: assert(index < _vs.committed_size(),"bad index"), g1BlockOffsetTable.inline.hpp:55
johnc
parents:
796
diff
changeset
|
54 |
342 | 55 enum G1GCThreadGroups { |
56 G1CRGroup = 0, | |
57 G1ZFGroup = 1, | |
58 G1CMGroup = 2, | |
59 G1CLGroup = 3 | |
60 }; | |
61 | |
62 enum GCAllocPurpose { | |
63 GCAllocForTenured, | |
64 GCAllocForSurvived, | |
65 GCAllocPurposeCount | |
66 }; | |
67 | |
68 class YoungList : public CHeapObj { | |
69 private: | |
70 G1CollectedHeap* _g1h; | |
71 | |
72 HeapRegion* _head; | |
73 | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
74 HeapRegion* _survivor_head; |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
75 HeapRegion* _survivor_tail; |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
76 |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
77 HeapRegion* _curr; |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
78 |
342 | 79 size_t _length; |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
80 size_t _survivor_length; |
342 | 81 |
82 size_t _last_sampled_rs_lengths; | |
83 size_t _sampled_rs_lengths; | |
84 | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
85 void empty_list(HeapRegion* list); |
342 | 86 |
87 public: | |
88 YoungList(G1CollectedHeap* g1h); | |
89 | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
90 void push_region(HeapRegion* hr); |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
91 void add_survivor_region(HeapRegion* hr); |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
92 |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
93 void empty_list(); |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
94 bool is_empty() { return _length == 0; } |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
95 size_t length() { return _length; } |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
96 size_t survivor_length() { return _survivor_length; } |
342 | 97 |
98 void rs_length_sampling_init(); | |
99 bool rs_length_sampling_more(); | |
100 void rs_length_sampling_next(); | |
101 | |
102 void reset_sampled_info() { | |
103 _last_sampled_rs_lengths = 0; | |
104 } | |
105 size_t sampled_rs_lengths() { return _last_sampled_rs_lengths; } | |
106 | |
107 // for development purposes | |
108 void reset_auxilary_lists(); | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
109 void clear() { _head = NULL; _length = 0; } |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
110 |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
111 void clear_survivors() { |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
112 _survivor_head = NULL; |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
113 _survivor_tail = NULL; |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
114 _survivor_length = 0; |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
115 } |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
116 |
342 | 117 HeapRegion* first_region() { return _head; } |
118 HeapRegion* first_survivor_region() { return _survivor_head; } | |
545 | 119 HeapRegion* last_survivor_region() { return _survivor_tail; } |
342 | 120 |
121 // debugging | |
122 bool check_list_well_formed(); | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
123 bool check_list_empty(bool check_sample = true); |
342 | 124 void print(); |
125 }; | |
126 | |
127 class RefineCardTableEntryClosure; | |
128 class G1CollectedHeap : public SharedHeap { | |
129 friend class VM_G1CollectForAllocation; | |
130 friend class VM_GenCollectForPermanentAllocation; | |
131 friend class VM_G1CollectFull; | |
132 friend class VM_G1IncCollectionPause; | |
133 friend class VMStructs; | |
134 | |
135 // Closures used in implementation. | |
136 friend class G1ParCopyHelper; | |
137 friend class G1IsAliveClosure; | |
138 friend class G1EvacuateFollowersClosure; | |
139 friend class G1ParScanThreadState; | |
140 friend class G1ParScanClosureSuper; | |
141 friend class G1ParEvacuateFollowersClosure; | |
142 friend class G1ParTask; | |
143 friend class G1FreeGarbageRegionClosure; | |
144 friend class RefineCardTableEntryClosure; | |
145 friend class G1PrepareCompactClosure; | |
146 friend class RegionSorter; | |
147 friend class CountRCClosure; | |
148 friend class EvacPopObjClosure; | |
796
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
149 friend class G1ParCleanupCTTask; |
342 | 150 |
151 // Other related classes. | |
152 friend class G1MarkSweep; | |
153 | |
154 private: | |
155 // The one and only G1CollectedHeap, so static functions can find it. | |
156 static G1CollectedHeap* _g1h; | |
157 | |
942
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
941
diff
changeset
|
158 static size_t _humongous_object_threshold_in_words; |
2c79770d1f6e
6819085: G1: use larger and/or user settable region size
tonyp
parents:
941
diff
changeset
|
159 |
342 | 160 // Storage for the G1 heap (excludes the permanent generation). |
161 VirtualSpace _g1_storage; | |
162 MemRegion _g1_reserved; | |
163 | |
164 // The part of _g1_storage that is currently committed. | |
165 MemRegion _g1_committed; | |
166 | |
167 // The maximum part of _g1_storage that has ever been committed. | |
168 MemRegion _g1_max_committed; | |
169 | |
170 // The number of regions that are completely free. | |
171 size_t _free_regions; | |
172 | |
173 // The number of regions we could create by expansion. | |
174 size_t _expansion_regions; | |
175 | |
176 // Return the number of free regions in the heap (by direct counting.) | |
177 size_t count_free_regions(); | |
178 // Return the number of free regions on the free and unclean lists. | |
179 size_t count_free_regions_list(); | |
180 | |
181 // The block offset table for the G1 heap. | |
182 G1BlockOffsetSharedArray* _bot_shared; | |
183 | |
184 // Move all of the regions off the free lists, then rebuild those free | |
185 // lists, before and after full GC. | |
186 void tear_down_region_lists(); | |
187 void rebuild_region_lists(); | |
188 // This sets all non-empty regions to need zero-fill (which they will if | |
189 // they are empty after full collection.) | |
190 void set_used_regions_to_need_zero_fill(); | |
191 | |
192 // The sequence of all heap regions in the heap. | |
193 HeapRegionSeq* _hrs; | |
194 | |
195 // The region from which normal-sized objects are currently being | |
196 // allocated. May be NULL. | |
197 HeapRegion* _cur_alloc_region; | |
198 | |
199 // Postcondition: cur_alloc_region == NULL. | |
200 void abandon_cur_alloc_region(); | |
636 | 201 void abandon_gc_alloc_regions(); |
342 | 202 |
203 // The to-space memory regions into which objects are being copied during | |
204 // a GC. | |
205 HeapRegion* _gc_alloc_regions[GCAllocPurposeCount]; | |
545 | 206 size_t _gc_alloc_region_counts[GCAllocPurposeCount]; |
636 | 207 // These are the regions, one per GCAllocPurpose, that are half-full |
208 // at the end of a collection and that we want to reuse during the | |
209 // next collection. | |
210 HeapRegion* _retained_gc_alloc_regions[GCAllocPurposeCount]; | |
211 // This specifies whether we will keep the last half-full region at | |
212 // the end of a collection so that it can be reused during the next | |
213 // collection (this is specified per GCAllocPurpose) | |
214 bool _retain_gc_alloc_region[GCAllocPurposeCount]; | |
342 | 215 |
216 // A list of the regions that have been set to be alloc regions in the | |
217 // current collection. | |
218 HeapRegion* _gc_alloc_region_list; | |
219 | |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
220 // Determines PLAB size for a particular allocation purpose. |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
221 static size_t desired_plab_sz(GCAllocPurpose purpose); |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
222 |
342 | 223 // When called by par thread, require par_alloc_during_gc_lock() to be held. |
224 void push_gc_alloc_region(HeapRegion* hr); | |
225 | |
226 // This should only be called single-threaded. Undeclares all GC alloc | |
227 // regions. | |
228 void forget_alloc_region_list(); | |
229 | |
230 // Should be used to set an alloc region, because there's other | |
231 // associated bookkeeping. | |
232 void set_gc_alloc_region(int purpose, HeapRegion* r); | |
233 | |
234 // Check well-formedness of alloc region list. | |
235 bool check_gc_alloc_regions(); | |
236 | |
237 // Outside of GC pauses, the number of bytes used in all regions other | |
238 // than the current allocation region. | |
239 size_t _summary_bytes_used; | |
240 | |
526 | 241 // This is used for a quick test on whether a reference points into |
242 // the collection set or not. Basically, we have an array, with one | |
243 // byte per region, and that byte denotes whether the corresponding | |
244 // region is in the collection set or not. The entry corresponding | |
245 // the bottom of the heap, i.e., region 0, is pointed to by | |
246 // _in_cset_fast_test_base. The _in_cset_fast_test field has been | |
247 // biased so that it actually points to address 0 of the address | |
248 // space, to make the test as fast as possible (we can simply shift | |
249 // the address to address into it, instead of having to subtract the | |
250 // bottom of the heap from the address before shifting it; basically | |
251 // it works in the same way the card table works). | |
252 bool* _in_cset_fast_test; | |
253 | |
254 // The allocated array used for the fast test on whether a reference | |
255 // points into the collection set or not. This field is also used to | |
256 // free the array. | |
257 bool* _in_cset_fast_test_base; | |
258 | |
259 // The length of the _in_cset_fast_test_base array. | |
260 size_t _in_cset_fast_test_length; | |
261 | |
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
|
262 volatile unsigned _gc_time_stamp; |
342 | 263 |
264 size_t* _surviving_young_words; | |
265 | |
266 void setup_surviving_young_words(); | |
267 void update_surviving_young_words(size_t* surv_young_words); | |
268 void cleanup_surviving_young_words(); | |
269 | |
1656
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
270 // It decides whether an explicit GC should start a concurrent cycle |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
271 // instead of doing a STW GC. Currently, a concurrent cycle is |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
272 // explicitly started if: |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
273 // (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
274 // (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent. |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
275 bool should_do_concurrent_full_gc(GCCause::Cause cause); |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
276 |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
277 // Keeps track of how many "full collections" (i.e., Full GCs or |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
278 // concurrent cycles) we have completed. The number of them we have |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
279 // started is maintained in _total_full_collections in CollectedHeap. |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
280 volatile unsigned int _full_collections_completed; |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
281 |
342 | 282 protected: |
283 | |
284 // Returns "true" iff none of the gc alloc regions have any allocations | |
285 // since the last call to "save_marks". | |
286 bool all_alloc_regions_no_allocs_since_save_marks(); | |
545 | 287 // Perform finalization stuff on all allocation regions. |
288 void retire_all_alloc_regions(); | |
342 | 289 |
290 // The number of regions allocated to hold humongous objects. | |
291 int _num_humongous_regions; | |
292 YoungList* _young_list; | |
293 | |
294 // The current policy object for the collector. | |
295 G1CollectorPolicy* _g1_policy; | |
296 | |
297 // Parallel allocation lock to protect the current allocation region. | |
298 Mutex _par_alloc_during_gc_lock; | |
299 Mutex* par_alloc_during_gc_lock() { return &_par_alloc_during_gc_lock; } | |
300 | |
301 // If possible/desirable, allocate a new HeapRegion for normal object | |
302 // allocation sufficient for an allocation of the given "word_size". | |
303 // If "do_expand" is true, will attempt to expand the heap if necessary | |
304 // to to satisfy the request. If "zero_filled" is true, requires a | |
305 // zero-filled region. | |
306 // (Returning NULL will trigger a GC.) | |
307 virtual HeapRegion* newAllocRegion_work(size_t word_size, | |
308 bool do_expand, | |
309 bool zero_filled); | |
310 | |
311 virtual HeapRegion* newAllocRegion(size_t word_size, | |
312 bool zero_filled = true) { | |
313 return newAllocRegion_work(word_size, false, zero_filled); | |
314 } | |
315 virtual HeapRegion* newAllocRegionWithExpansion(int purpose, | |
316 size_t word_size, | |
317 bool zero_filled = true); | |
318 | |
319 // Attempt to allocate an object of the given (very large) "word_size". | |
320 // Returns "NULL" on failure. | |
321 virtual HeapWord* humongousObjAllocate(size_t word_size); | |
322 | |
323 // If possible, allocate a block of the given word_size, else return "NULL". | |
324 // Returning NULL will trigger GC or heap expansion. | |
325 // These two methods have rather awkward pre- and | |
326 // post-conditions. If they are called outside a safepoint, then | |
327 // they assume that the caller is holding the heap lock. Upon return | |
328 // they release the heap lock, if they are returning a non-NULL | |
329 // value. attempt_allocation_slow() also dirties the cards of a | |
330 // newly-allocated young region after it releases the heap | |
331 // lock. This change in interface was the neatest way to achieve | |
332 // this card dirtying without affecting mem_allocate(), which is a | |
333 // more frequently called method. We tried two or three different | |
334 // approaches, but they were even more hacky. | |
335 HeapWord* attempt_allocation(size_t word_size, | |
336 bool permit_collection_pause = true); | |
337 | |
338 HeapWord* attempt_allocation_slow(size_t word_size, | |
339 bool permit_collection_pause = true); | |
340 | |
341 // Allocate blocks during garbage collection. Will ensure an | |
342 // allocation region, either by picking one or expanding the | |
343 // heap, and then allocate a block of the given size. The block | |
344 // may not be a humongous - it must fit into a single heap region. | |
345 HeapWord* allocate_during_gc(GCAllocPurpose purpose, size_t word_size); | |
346 HeapWord* par_allocate_during_gc(GCAllocPurpose purpose, size_t word_size); | |
347 | |
348 HeapWord* allocate_during_gc_slow(GCAllocPurpose purpose, | |
349 HeapRegion* alloc_region, | |
350 bool par, | |
351 size_t word_size); | |
352 | |
353 // Ensure that no further allocations can happen in "r", bearing in mind | |
354 // that parallel threads might be attempting allocations. | |
355 void par_allocate_remaining_space(HeapRegion* r); | |
356 | |
545 | 357 // Retires an allocation region when it is full or at the end of a |
358 // GC pause. | |
359 void retire_alloc_region(HeapRegion* alloc_region, bool par); | |
360 | |
1656
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
361 // - if explicit_gc is true, the GC is for a System.gc() or a heap |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
362 // inspection request and should collect the entire heap |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
363 // - if clear_all_soft_refs is true, all soft references are cleared |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
364 // during the GC |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
365 // - if explicit_gc is false, word_size describes the allocation that |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
366 // the GC should attempt (at least) to satisfy |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
367 void do_collection(bool explicit_gc, |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
368 bool clear_all_soft_refs, |
342 | 369 size_t word_size); |
370 | |
371 // Callback from VM_G1CollectFull operation. | |
372 // Perform a full collection. | |
373 void do_full_collection(bool clear_all_soft_refs); | |
374 | |
375 // Resize the heap if necessary after a full collection. If this is | |
376 // after a collect-for allocation, "word_size" is the allocation size, | |
377 // and will be considered part of the used portion of the heap. | |
378 void resize_if_necessary_after_full_collection(size_t word_size); | |
379 | |
380 // Callback from VM_G1CollectForAllocation operation. | |
381 // This function does everything necessary/possible to satisfy a | |
382 // failed allocation request (including collection, expansion, etc.) | |
383 HeapWord* satisfy_failed_allocation(size_t word_size); | |
384 | |
385 // Attempting to expand the heap sufficiently | |
386 // to support an allocation of the given "word_size". If | |
387 // successful, perform the allocation and return the address of the | |
388 // allocated block, or else "NULL". | |
389 virtual HeapWord* expand_and_allocate(size_t word_size); | |
390 | |
391 public: | |
392 // Expand the garbage-first heap by at least the given size (in bytes!). | |
393 // (Rounds up to a HeapRegion boundary.) | |
394 virtual void expand(size_t expand_bytes); | |
395 | |
396 // Do anything common to GC's. | |
397 virtual void gc_prologue(bool full); | |
398 virtual void gc_epilogue(bool full); | |
399 | |
526 | 400 // We register a region with the fast "in collection set" test. We |
401 // simply set to true the array slot corresponding to this region. | |
402 void register_region_with_in_cset_fast_test(HeapRegion* r) { | |
403 assert(_in_cset_fast_test_base != NULL, "sanity"); | |
404 assert(r->in_collection_set(), "invariant"); | |
405 int index = r->hrs_index(); | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
406 assert(0 <= index && (size_t) index < _in_cset_fast_test_length, "invariant"); |
526 | 407 assert(!_in_cset_fast_test_base[index], "invariant"); |
408 _in_cset_fast_test_base[index] = true; | |
409 } | |
410 | |
411 // This is a fast test on whether a reference points into the | |
412 // collection set or not. It does not assume that the reference | |
413 // points into the heap; if it doesn't, it will return false. | |
414 bool in_cset_fast_test(oop obj) { | |
415 assert(_in_cset_fast_test != NULL, "sanity"); | |
416 if (_g1_committed.contains((HeapWord*) obj)) { | |
417 // no need to subtract the bottom of the heap from obj, | |
418 // _in_cset_fast_test is biased | |
419 size_t index = ((size_t) obj) >> HeapRegion::LogOfHRGrainBytes; | |
420 bool ret = _in_cset_fast_test[index]; | |
421 // let's make sure the result is consistent with what the slower | |
422 // test returns | |
423 assert( ret || !obj_in_cs(obj), "sanity"); | |
424 assert(!ret || obj_in_cs(obj), "sanity"); | |
425 return ret; | |
426 } else { | |
427 return false; | |
428 } | |
429 } | |
430 | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
431 void clear_cset_fast_test() { |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
432 assert(_in_cset_fast_test_base != NULL, "sanity"); |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
433 memset(_in_cset_fast_test_base, false, |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
434 _in_cset_fast_test_length * sizeof(bool)); |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
435 } |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
436 |
1656
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
437 // This is called at the end of either a concurrent cycle or a Full |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
438 // GC to update the number of full collections completed. Those two |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
439 // can happen in a nested fashion, i.e., we start a concurrent |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
440 // cycle, a Full GC happens half-way through it which ends first, |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
441 // and then the cycle notices that a Full GC happened and ends |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
442 // too. The outer parameter is a boolean to help us do a bit tighter |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
443 // consistency checking in the method. If outer is false, the caller |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
444 // is the inner caller in the nesting (i.e., the Full GC). If outer |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
445 // is true, the caller is the outer caller in this nesting (i.e., |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
446 // the concurrent cycle). Further nesting is not currently |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
447 // supported. The end of the this call also notifies the |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
448 // FullGCCount_lock in case a Java thread is waiting for a full GC |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
449 // to happen (e.g., it called System.gc() with |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
450 // +ExplicitGCInvokesConcurrent). |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
451 void increment_full_collections_completed(bool outer); |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
452 |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
453 unsigned int full_collections_completed() { |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
454 return _full_collections_completed; |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
455 } |
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
456 |
342 | 457 protected: |
458 | |
459 // Shrink the garbage-first heap by at most the given size (in bytes!). | |
460 // (Rounds down to a HeapRegion boundary.) | |
461 virtual void shrink(size_t expand_bytes); | |
462 void shrink_helper(size_t expand_bytes); | |
463 | |
1709 | 464 #if TASKQUEUE_STATS |
465 static void print_taskqueue_stats_hdr(outputStream* const st = gclog_or_tty); | |
466 void print_taskqueue_stats(outputStream* const st = gclog_or_tty) const; | |
467 void reset_taskqueue_stats(); | |
468 #endif // TASKQUEUE_STATS | |
469 | |
342 | 470 // Do an incremental collection: identify a collection set, and evacuate |
471 // its live objects elsewhere. | |
472 virtual void do_collection_pause(); | |
473 | |
474 // The guts of the incremental collection pause, executed by the vm | |
677 | 475 // thread. |
1656
4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
tonyp
parents:
1611
diff
changeset
|
476 virtual void do_collection_pause_at_safepoint(double target_pause_time_ms); |
342 | 477 |
478 // Actually do the work of evacuating the collection set. | |
479 virtual void evacuate_collection_set(); | |
480 | |
481 // If this is an appropriate right time, do a collection pause. | |
482 // The "word_size" argument, if non-zero, indicates the size of an | |
483 // allocation request that is prompting this query. | |
484 void do_collection_pause_if_appropriate(size_t word_size); | |
485 | |
486 // The g1 remembered set of the heap. | |
487 G1RemSet* _g1_rem_set; | |
488 // And it's mod ref barrier set, used to track updates for the above. | |
489 ModRefBarrierSet* _mr_bs; | |
490 | |
616
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
491 // A set of cards that cover the objects for which the Rsets should be updated |
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
492 // concurrently after the collection. |
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
493 DirtyCardQueueSet _dirty_card_queue_set; |
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
494 |
342 | 495 // The Heap Region Rem Set Iterator. |
496 HeapRegionRemSetIterator** _rem_set_iterator; | |
497 | |
498 // The closure used to refine a single card. | |
499 RefineCardTableEntryClosure* _refine_cte_cl; | |
500 | |
501 // A function to check the consistency of dirty card logs. | |
502 void check_ct_logs_at_safepoint(); | |
503 | |
1705 | 504 // A DirtyCardQueueSet that is used to hold cards that contain |
505 // references into the current collection set. This is used to | |
506 // update the remembered sets of the regions in the collection | |
507 // set in the event of an evacuation failure. | |
508 DirtyCardQueueSet _into_cset_dirty_card_queue_set; | |
509 | |
342 | 510 // After a collection pause, make the regions in the CS into free |
511 // regions. | |
512 void free_collection_set(HeapRegion* cs_head); | |
513 | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
514 // Abandon the current collection set without recording policy |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
515 // statistics or updating free lists. |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
516 void abandon_collection_set(HeapRegion* cs_head); |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
517 |
342 | 518 // Applies "scan_non_heap_roots" to roots outside the heap, |
519 // "scan_rs" to roots inside the heap (having done "set_region" to | |
520 // indicate the region in which the root resides), and does "scan_perm" | |
521 // (setting the generation to the perm generation.) If "scan_rs" is | |
522 // NULL, then this step is skipped. The "worker_i" | |
523 // param is for use with parallel roots processing, and should be | |
524 // the "i" of the calling parallel worker thread's work(i) function. | |
525 // In the sequential case this param will be ignored. | |
526 void g1_process_strong_roots(bool collecting_perm_gen, | |
527 SharedHeap::ScanningOption so, | |
528 OopClosure* scan_non_heap_roots, | |
529 OopsInHeapRegionClosure* scan_rs, | |
530 OopsInGenClosure* scan_perm, | |
531 int worker_i); | |
532 | |
533 // Apply "blk" to all the weak roots of the system. These include | |
534 // JNI weak roots, the code cache, system dictionary, symbol table, | |
535 // string table, and referents of reachable weak refs. | |
536 void g1_process_weak_roots(OopClosure* root_closure, | |
537 OopClosure* non_root_closure); | |
538 | |
539 // Invoke "save_marks" on all heap regions. | |
540 void save_marks(); | |
541 | |
542 // Free a heap region. | |
543 void free_region(HeapRegion* hr); | |
544 // A component of "free_region", exposed for 'batching'. | |
545 // All the params after "hr" are out params: the used bytes of the freed | |
546 // region(s), the number of H regions cleared, the number of regions | |
547 // freed, and pointers to the head and tail of a list of freed contig | |
548 // regions, linked throught the "next_on_unclean_list" field. | |
549 void free_region_work(HeapRegion* hr, | |
550 size_t& pre_used, | |
551 size_t& cleared_h, | |
552 size_t& freed_regions, | |
553 UncleanRegionList* list, | |
554 bool par = false); | |
555 | |
556 | |
557 // The concurrent marker (and the thread it runs in.) | |
558 ConcurrentMark* _cm; | |
559 ConcurrentMarkThread* _cmThread; | |
560 bool _mark_in_progress; | |
561 | |
562 // The concurrent refiner. | |
563 ConcurrentG1Refine* _cg1r; | |
564 | |
565 // The concurrent zero-fill thread. | |
566 ConcurrentZFThread* _czft; | |
567 | |
568 // The parallel task queues | |
569 RefToScanQueueSet *_task_queues; | |
570 | |
571 // True iff a evacuation has failed in the current collection. | |
572 bool _evacuation_failed; | |
573 | |
574 // Set the attribute indicating whether evacuation has failed in the | |
575 // current collection. | |
576 void set_evacuation_failed(bool b) { _evacuation_failed = b; } | |
577 | |
578 // Failed evacuations cause some logical from-space objects to have | |
579 // forwarding pointers to themselves. Reset them. | |
580 void remove_self_forwarding_pointers(); | |
581 | |
582 // When one is non-null, so is the other. Together, they each pair is | |
583 // an object with a preserved mark, and its mark value. | |
584 GrowableArray<oop>* _objs_with_preserved_marks; | |
585 GrowableArray<markOop>* _preserved_marks_of_objs; | |
586 | |
587 // Preserve the mark of "obj", if necessary, in preparation for its mark | |
588 // word being overwritten with a self-forwarding-pointer. | |
589 void preserve_mark_if_necessary(oop obj, markOop m); | |
590 | |
591 // The stack of evac-failure objects left to be scanned. | |
592 GrowableArray<oop>* _evac_failure_scan_stack; | |
593 // The closure to apply to evac-failure objects. | |
594 | |
595 OopsInHeapRegionClosure* _evac_failure_closure; | |
596 // Set the field above. | |
597 void | |
598 set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_closure) { | |
599 _evac_failure_closure = evac_failure_closure; | |
600 } | |
601 | |
602 // Push "obj" on the scan stack. | |
603 void push_on_evac_failure_scan_stack(oop obj); | |
604 // Process scan stack entries until the stack is empty. | |
605 void drain_evac_failure_scan_stack(); | |
606 // True iff an invocation of "drain_scan_stack" is in progress; to | |
607 // prevent unnecessary recursion. | |
608 bool _drain_in_progress; | |
609 | |
610 // Do any necessary initialization for evacuation-failure handling. | |
611 // "cl" is the closure that will be used to process evac-failure | |
612 // objects. | |
613 void init_for_evac_failure(OopsInHeapRegionClosure* cl); | |
614 // Do any necessary cleanup for evacuation-failure handling data | |
615 // structures. | |
616 void finalize_for_evac_failure(); | |
617 | |
618 // An attempt to evacuate "obj" has failed; take necessary steps. | |
619 void handle_evacuation_failure(oop obj); | |
620 oop handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, oop obj); | |
621 void handle_evacuation_failure_common(oop obj, markOop m); | |
622 | |
623 | |
624 // Ensure that the relevant gc_alloc regions are set. | |
625 void get_gc_alloc_regions(); | |
636 | 626 // We're done with GC alloc regions. We are going to tear down the |
627 // gc alloc list and remove the gc alloc tag from all the regions on | |
628 // that list. However, we will also retain the last (i.e., the one | |
629 // that is half-full) GC alloc region, per GCAllocPurpose, for | |
630 // possible reuse during the next collection, provided | |
631 // _retain_gc_alloc_region[] indicates that it should be the | |
632 // case. Said regions are kept in the _retained_gc_alloc_regions[] | |
633 // array. If the parameter totally is set, we will not retain any | |
634 // regions, irrespective of what _retain_gc_alloc_region[] | |
635 // indicates. | |
636 void release_gc_alloc_regions(bool totally); | |
637 #ifndef PRODUCT | |
638 // Useful for debugging. | |
639 void print_gc_alloc_regions(); | |
640 #endif // !PRODUCT | |
342 | 641 |
642 // ("Weak") Reference processing support | |
643 ReferenceProcessor* _ref_processor; | |
644 | |
645 enum G1H_process_strong_roots_tasks { | |
646 G1H_PS_mark_stack_oops_do, | |
647 G1H_PS_refProcessor_oops_do, | |
648 // Leave this one last. | |
649 G1H_PS_NumElements | |
650 }; | |
651 | |
652 SubTasksDone* _process_strong_tasks; | |
653 | |
654 // List of regions which require zero filling. | |
655 UncleanRegionList _unclean_region_list; | |
656 bool _unclean_regions_coming; | |
657 | |
658 public: | |
659 void set_refine_cte_cl_concurrency(bool concurrent); | |
660 | |
1709 | 661 RefToScanQueue *task_queue(int i) const; |
342 | 662 |
616
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
663 // A set of cards where updates happened during the GC |
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
664 DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; } |
4f360ec815ba
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
545
diff
changeset
|
665 |
1705 | 666 // A DirtyCardQueueSet that is used to hold cards that contain |
667 // references into the current collection set. This is used to | |
668 // update the remembered sets of the regions in the collection | |
669 // set in the event of an evacuation failure. | |
670 DirtyCardQueueSet& into_cset_dirty_card_queue_set() | |
671 { return _into_cset_dirty_card_queue_set; } | |
672 | |
342 | 673 // Create a G1CollectedHeap with the specified policy. |
674 // Must call the initialize method afterwards. | |
675 // May not return if something goes wrong. | |
676 G1CollectedHeap(G1CollectorPolicy* policy); | |
677 | |
678 // Initialize the G1CollectedHeap to have the initial and | |
679 // maximum sizes, permanent generation, and remembered and barrier sets | |
680 // specified by the policy object. | |
681 jint initialize(); | |
682 | |
683 void ref_processing_init(); | |
684 | |
685 void set_par_threads(int t) { | |
686 SharedHeap::set_par_threads(t); | |
687 _process_strong_tasks->set_par_threads(t); | |
688 } | |
689 | |
690 virtual CollectedHeap::Name kind() const { | |
691 return CollectedHeap::G1CollectedHeap; | |
692 } | |
693 | |
694 // The current policy object for the collector. | |
695 G1CollectorPolicy* g1_policy() const { return _g1_policy; } | |
696 | |
697 // Adaptive size policy. No such thing for g1. | |
698 virtual AdaptiveSizePolicy* size_policy() { return NULL; } | |
699 | |
700 // The rem set and barrier set. | |
701 G1RemSet* g1_rem_set() const { return _g1_rem_set; } | |
702 ModRefBarrierSet* mr_bs() const { return _mr_bs; } | |
703 | |
704 // The rem set iterator. | |
705 HeapRegionRemSetIterator* rem_set_iterator(int i) { | |
706 return _rem_set_iterator[i]; | |
707 } | |
708 | |
709 HeapRegionRemSetIterator* rem_set_iterator() { | |
710 return _rem_set_iterator[0]; | |
711 } | |
712 | |
713 unsigned get_gc_time_stamp() { | |
714 return _gc_time_stamp; | |
715 } | |
716 | |
717 void reset_gc_time_stamp() { | |
718 _gc_time_stamp = 0; | |
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
|
719 OrderAccess::fence(); |
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
|
720 } |
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
|
721 |
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
|
722 void increment_gc_time_stamp() { |
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
|
723 ++_gc_time_stamp; |
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
|
724 OrderAccess::fence(); |
342 | 725 } |
726 | |
1705 | 727 void iterate_dirty_card_closure(CardTableEntryClosure* cl, |
728 DirtyCardQueue* into_cset_dcq, | |
729 bool concurrent, int worker_i); | |
342 | 730 |
731 // The shared block offset table array. | |
732 G1BlockOffsetSharedArray* bot_shared() const { return _bot_shared; } | |
733 | |
734 // Reference Processing accessor | |
735 ReferenceProcessor* ref_processor() { return _ref_processor; } | |
736 | |
737 // Reserved (g1 only; super method includes perm), capacity and the used | |
738 // portion in bytes. | |
1092
ed52bcc32739
6880903: G1: G1 reports incorrect Runtime.maxMemory()
tonyp
parents:
1027
diff
changeset
|
739 size_t g1_reserved_obj_bytes() const { return _g1_reserved.byte_size(); } |
342 | 740 virtual size_t capacity() const; |
741 virtual size_t used() const; | |
846
42d84bbbecf4
6859911: G1: assert(Heap_lock->owner() = NULL, "Should be owned on this thread's behalf")
tonyp
parents:
845
diff
changeset
|
742 // This should be called when we're not holding the heap lock. The |
42d84bbbecf4
6859911: G1: assert(Heap_lock->owner() = NULL, "Should be owned on this thread's behalf")
tonyp
parents:
845
diff
changeset
|
743 // result might be a bit inaccurate. |
42d84bbbecf4
6859911: G1: assert(Heap_lock->owner() = NULL, "Should be owned on this thread's behalf")
tonyp
parents:
845
diff
changeset
|
744 size_t used_unlocked() const; |
342 | 745 size_t recalculate_used() const; |
746 #ifndef PRODUCT | |
747 size_t recalculate_used_regions() const; | |
748 #endif // PRODUCT | |
749 | |
750 // These virtual functions do the actual allocation. | |
751 virtual HeapWord* mem_allocate(size_t word_size, | |
752 bool is_noref, | |
753 bool is_tlab, | |
754 bool* gc_overhead_limit_was_exceeded); | |
755 | |
756 // Some heaps may offer a contiguous region for shared non-blocking | |
757 // allocation, via inlined code (by exporting the address of the top and | |
758 // end fields defining the extent of the contiguous allocation region.) | |
759 // But G1CollectedHeap doesn't yet support this. | |
760 | |
761 // Return an estimate of the maximum allocation that could be performed | |
762 // without triggering any collection or expansion activity. In a | |
763 // generational collector, for example, this is probably the largest | |
764 // allocation that could be supported (without expansion) in the youngest | |
765 // generation. It is "unsafe" because no locks are taken; the result | |
766 // should be treated as an approximation, not a guarantee, for use in | |
767 // heuristic resizing decisions. | |
768 virtual size_t unsafe_max_alloc(); | |
769 | |
770 virtual bool is_maximal_no_gc() const { | |
771 return _g1_storage.uncommitted_size() == 0; | |
772 } | |
773 | |
774 // The total number of regions in the heap. | |
775 size_t n_regions(); | |
776 | |
777 // The number of regions that are completely free. | |
778 size_t max_regions(); | |
779 | |
780 // The number of regions that are completely free. | |
781 size_t free_regions(); | |
782 | |
783 // The number of regions that are not completely free. | |
784 size_t used_regions() { return n_regions() - free_regions(); } | |
785 | |
786 // True iff the ZF thread should run. | |
787 bool should_zf(); | |
788 | |
789 // The number of regions available for "regular" expansion. | |
790 size_t expansion_regions() { return _expansion_regions; } | |
791 | |
792 #ifndef PRODUCT | |
793 bool regions_accounted_for(); | |
794 bool print_region_accounting_info(); | |
795 void print_region_counts(); | |
796 #endif | |
797 | |
798 HeapRegion* alloc_region_from_unclean_list(bool zero_filled); | |
799 HeapRegion* alloc_region_from_unclean_list_locked(bool zero_filled); | |
800 | |
801 void put_region_on_unclean_list(HeapRegion* r); | |
802 void put_region_on_unclean_list_locked(HeapRegion* r); | |
803 | |
804 void prepend_region_list_on_unclean_list(UncleanRegionList* list); | |
805 void prepend_region_list_on_unclean_list_locked(UncleanRegionList* list); | |
806 | |
807 void set_unclean_regions_coming(bool b); | |
808 void set_unclean_regions_coming_locked(bool b); | |
809 // Wait for cleanup to be complete. | |
810 void wait_for_cleanup_complete(); | |
811 // Like above, but assumes that the calling thread owns the Heap_lock. | |
812 void wait_for_cleanup_complete_locked(); | |
813 | |
814 // Return the head of the unclean list. | |
815 HeapRegion* peek_unclean_region_list_locked(); | |
816 // Remove and return the head of the unclean list. | |
817 HeapRegion* pop_unclean_region_list_locked(); | |
818 | |
819 // List of regions which are zero filled and ready for allocation. | |
820 HeapRegion* _free_region_list; | |
821 // Number of elements on the free list. | |
822 size_t _free_region_list_size; | |
823 | |
824 // If the head of the unclean list is ZeroFilled, move it to the free | |
825 // list. | |
826 bool move_cleaned_region_to_free_list_locked(); | |
827 bool move_cleaned_region_to_free_list(); | |
828 | |
829 void put_free_region_on_list_locked(HeapRegion* r); | |
830 void put_free_region_on_list(HeapRegion* r); | |
831 | |
832 // Remove and return the head element of the free list. | |
833 HeapRegion* pop_free_region_list_locked(); | |
834 | |
835 // If "zero_filled" is true, we first try the free list, then we try the | |
836 // unclean list, zero-filling the result. If "zero_filled" is false, we | |
837 // first try the unclean list, then the zero-filled list. | |
838 HeapRegion* alloc_free_region_from_lists(bool zero_filled); | |
839 | |
840 // Verify the integrity of the region lists. | |
841 void remove_allocated_regions_from_lists(); | |
842 bool verify_region_lists(); | |
843 bool verify_region_lists_locked(); | |
844 size_t unclean_region_list_length(); | |
845 size_t free_region_list_length(); | |
846 | |
847 // Perform a collection of the heap; intended for use in implementing | |
848 // "System.gc". This probably implies as full a collection as the | |
849 // "CollectedHeap" supports. | |
850 virtual void collect(GCCause::Cause cause); | |
851 | |
852 // The same as above but assume that the caller holds the Heap_lock. | |
853 void collect_locked(GCCause::Cause cause); | |
854 | |
855 // This interface assumes that it's being called by the | |
856 // vm thread. It collects the heap assuming that the | |
857 // heap lock is already held and that we are executing in | |
858 // the context of the vm thread. | |
859 virtual void collect_as_vm_thread(GCCause::Cause cause); | |
860 | |
861 // True iff a evacuation has failed in the most-recent collection. | |
862 bool evacuation_failed() { return _evacuation_failed; } | |
863 | |
864 // Free a region if it is totally full of garbage. Returns the number of | |
865 // bytes freed (0 ==> didn't free it). | |
866 size_t free_region_if_totally_empty(HeapRegion *hr); | |
867 void free_region_if_totally_empty_work(HeapRegion *hr, | |
868 size_t& pre_used, | |
869 size_t& cleared_h_regions, | |
870 size_t& freed_regions, | |
871 UncleanRegionList* list, | |
872 bool par = false); | |
873 | |
874 // If we've done free region work that yields the given changes, update | |
875 // the relevant global variables. | |
876 void finish_free_region_work(size_t pre_used, | |
877 size_t cleared_h_regions, | |
878 size_t freed_regions, | |
879 UncleanRegionList* list); | |
880 | |
881 | |
882 // Returns "TRUE" iff "p" points into the allocated area of the heap. | |
883 virtual bool is_in(const void* p) const; | |
884 | |
885 // Return "TRUE" iff the given object address is within the collection | |
886 // set. | |
887 inline bool obj_in_cs(oop obj); | |
888 | |
889 // Return "TRUE" iff the given object address is in the reserved | |
890 // region of g1 (excluding the permanent generation). | |
891 bool is_in_g1_reserved(const void* p) const { | |
892 return _g1_reserved.contains(p); | |
893 } | |
894 | |
895 // Returns a MemRegion that corresponds to the space that has been | |
896 // committed in the heap | |
897 MemRegion g1_committed() { | |
898 return _g1_committed; | |
899 } | |
900 | |
941 | 901 NOT_PRODUCT(bool is_in_closed_subset(const void* p) const;) |
342 | 902 |
903 // Dirty card table entries covering a list of young regions. | |
904 void dirtyCardsForYoungRegions(CardTableModRefBS* ct_bs, HeapRegion* list); | |
905 | |
906 // This resets the card table to all zeros. It is used after | |
907 // a collection pause which used the card table to claim cards. | |
908 void cleanUpCardTable(); | |
909 | |
910 // Iteration functions. | |
911 | |
912 // Iterate over all the ref-containing fields of all objects, calling | |
913 // "cl.do_oop" on each. | |
678 | 914 virtual void oop_iterate(OopClosure* cl) { |
915 oop_iterate(cl, true); | |
916 } | |
917 void oop_iterate(OopClosure* cl, bool do_perm); | |
342 | 918 |
919 // Same as above, restricted to a memory region. | |
678 | 920 virtual void oop_iterate(MemRegion mr, OopClosure* cl) { |
921 oop_iterate(mr, cl, true); | |
922 } | |
923 void oop_iterate(MemRegion mr, OopClosure* cl, bool do_perm); | |
342 | 924 |
925 // Iterate over all objects, calling "cl.do_object" on each. | |
678 | 926 virtual void object_iterate(ObjectClosure* cl) { |
927 object_iterate(cl, true); | |
928 } | |
929 virtual void safe_object_iterate(ObjectClosure* cl) { | |
930 object_iterate(cl, true); | |
931 } | |
932 void object_iterate(ObjectClosure* cl, bool do_perm); | |
342 | 933 |
934 // Iterate over all objects allocated since the last collection, calling | |
935 // "cl.do_object" on each. The heap must have been initialized properly | |
936 // to support this function, or else this call will fail. | |
937 virtual void object_iterate_since_last_GC(ObjectClosure* cl); | |
938 | |
939 // Iterate over all spaces in use in the heap, in ascending address order. | |
940 virtual void space_iterate(SpaceClosure* cl); | |
941 | |
942 // Iterate over heap regions, in address order, terminating the | |
943 // iteration early if the "doHeapRegion" method returns "true". | |
944 void heap_region_iterate(HeapRegionClosure* blk); | |
945 | |
946 // Iterate over heap regions starting with r (or the first region if "r" | |
947 // is NULL), in address order, terminating early if the "doHeapRegion" | |
948 // method returns "true". | |
949 void heap_region_iterate_from(HeapRegion* r, HeapRegionClosure* blk); | |
950 | |
951 // As above but starting from the region at index idx. | |
952 void heap_region_iterate_from(int idx, HeapRegionClosure* blk); | |
953 | |
954 HeapRegion* region_at(size_t idx); | |
955 | |
956 // Divide the heap region sequence into "chunks" of some size (the number | |
957 // of regions divided by the number of parallel threads times some | |
958 // overpartition factor, currently 4). Assumes that this will be called | |
959 // in parallel by ParallelGCThreads worker threads with discinct worker | |
960 // ids in the range [0..max(ParallelGCThreads-1, 1)], that all parallel | |
961 // calls will use the same "claim_value", and that that claim value is | |
962 // different from the claim_value of any heap region before the start of | |
963 // the iteration. Applies "blk->doHeapRegion" to each of the regions, by | |
964 // attempting to claim the first region in each chunk, and, if | |
965 // successful, applying the closure to each region in the chunk (and | |
966 // setting the claim value of the second and subsequent regions of the | |
967 // chunk.) For now requires that "doHeapRegion" always returns "false", | |
968 // i.e., that a closure never attempt to abort a traversal. | |
969 void heap_region_par_iterate_chunked(HeapRegionClosure* blk, | |
970 int worker, | |
971 jint claim_value); | |
972 | |
390 | 973 // It resets all the region claim values to the default. |
974 void reset_heap_region_claim_values(); | |
975 | |
355 | 976 #ifdef ASSERT |
977 bool check_heap_region_claim_values(jint claim_value); | |
978 #endif // ASSERT | |
979 | |
342 | 980 // Iterate over the regions (if any) in the current collection set. |
981 void collection_set_iterate(HeapRegionClosure* blk); | |
982 | |
983 // As above but starting from region r | |
984 void collection_set_iterate_from(HeapRegion* r, HeapRegionClosure *blk); | |
985 | |
986 // Returns the first (lowest address) compactible space in the heap. | |
987 virtual CompactibleSpace* first_compactible_space(); | |
988 | |
989 // A CollectedHeap will contain some number of spaces. This finds the | |
990 // space containing a given address, or else returns NULL. | |
991 virtual Space* space_containing(const void* addr) const; | |
992 | |
993 // A G1CollectedHeap will contain some number of heap regions. This | |
994 // finds the region containing a given address, or else returns NULL. | |
995 HeapRegion* heap_region_containing(const void* addr) const; | |
996 | |
997 // Like the above, but requires "addr" to be in the heap (to avoid a | |
998 // null-check), and unlike the above, may return an continuing humongous | |
999 // region. | |
1000 HeapRegion* heap_region_containing_raw(const void* addr) const; | |
1001 | |
1002 // A CollectedHeap is divided into a dense sequence of "blocks"; that is, | |
1003 // each address in the (reserved) heap is a member of exactly | |
1004 // one block. The defining characteristic of a block is that it is | |
1005 // possible to find its size, and thus to progress forward to the next | |
1006 // block. (Blocks may be of different sizes.) Thus, blocks may | |
1007 // represent Java objects, or they might be free blocks in a | |
1008 // free-list-based heap (or subheap), as long as the two kinds are | |
1009 // distinguishable and the size of each is determinable. | |
1010 | |
1011 // Returns the address of the start of the "block" that contains the | |
1012 // address "addr". We say "blocks" instead of "object" since some heaps | |
1013 // may not pack objects densely; a chunk may either be an object or a | |
1014 // non-object. | |
1015 virtual HeapWord* block_start(const void* addr) const; | |
1016 | |
1017 // Requires "addr" to be the start of a chunk, and returns its size. | |
1018 // "addr + size" is required to be the start of a new chunk, or the end | |
1019 // of the active area of the heap. | |
1020 virtual size_t block_size(const HeapWord* addr) const; | |
1021 | |
1022 // Requires "addr" to be the start of a block, and returns "TRUE" iff | |
1023 // the block is an object. | |
1024 virtual bool block_is_obj(const HeapWord* addr) const; | |
1025 | |
1026 // Does this heap support heap inspection? (+PrintClassHistogram) | |
1027 virtual bool supports_heap_inspection() const { return true; } | |
1028 | |
1029 // Section on thread-local allocation buffers (TLABs) | |
1030 // See CollectedHeap for semantics. | |
1031 | |
1032 virtual bool supports_tlab_allocation() const; | |
1033 virtual size_t tlab_capacity(Thread* thr) const; | |
1034 virtual size_t unsafe_max_tlab_alloc(Thread* thr) const; | |
1718
bb847e31b836
6974928: G1: sometimes humongous objects are allocated in young regions
tonyp
parents:
1709
diff
changeset
|
1035 virtual HeapWord* allocate_new_tlab(size_t word_size); |
342 | 1036 |
1037 // Can a compiler initialize a new object without store barriers? | |
1038 // This permission only extends from the creation of a new object | |
1027
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1039 // via a TLAB up to the first subsequent safepoint. If such permission |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1040 // is granted for this heap type, the compiler promises to call |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1041 // defer_store_barrier() below on any slow path allocation of |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1042 // a new object for which such initializing store barriers will |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1043 // have been elided. G1, like CMS, allows this, but should be |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1044 // ready to provide a compensating write barrier as necessary |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1045 // if that storage came out of a non-young region. The efficiency |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1046 // of this implementation depends crucially on being able to |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1047 // answer very efficiently in constant time whether a piece of |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1048 // storage in the heap comes from a young region or not. |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1049 // See ReduceInitialCardMarks. |
342 | 1050 virtual bool can_elide_tlab_store_barriers() const { |
1194
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1051 // 6920090: Temporarily disabled, because of lingering |
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1052 // instabilities related to RICM with G1. In the |
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1053 // interim, the option ReduceInitialCardMarksForG1 |
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1054 // below is left solely as a debugging device at least |
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1055 // until 6920109 fixes the instabilities. |
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1056 return ReduceInitialCardMarksForG1; |
1027
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1057 } |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1058 |
1166 | 1059 virtual bool card_mark_must_follow_store() const { |
1060 return true; | |
1061 } | |
1062 | |
1027
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1063 bool is_in_young(oop obj) { |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1064 HeapRegion* hr = heap_region_containing(obj); |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1065 return hr != NULL && hr->is_young(); |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1066 } |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1067 |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1068 // We don't need barriers for initializing stores to objects |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1069 // in the young gen: for the SATB pre-barrier, there is no |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1070 // pre-value that needs to be remembered; for the remembered-set |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1071 // update logging post-barrier, we don't maintain remembered set |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1072 // information for young gen objects. Note that non-generational |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1073 // G1 does not have any "young" objects, should not elide |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1074 // the rs logging barrier and so should always answer false below. |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1075 // However, non-generational G1 (-XX:-G1Gen) appears to have |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1076 // bit-rotted so was not tested below. |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1077 virtual bool can_elide_initializing_store_barrier(oop new_obj) { |
1194
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1078 // Re 6920090, 6920109 above. |
34fb2662f6c2
6920090: G1: Disable ReduceInitialCardMarks at least until 6920109 is fixed
ysr
parents:
1166
diff
changeset
|
1079 assert(ReduceInitialCardMarksForG1, "Else cannot be here"); |
1027
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1080 assert(G1Gen || !is_in_young(new_obj), |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1081 "Non-generational G1 should never return true below"); |
39b01ab7035a
6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning
ysr
parents:
942
diff
changeset
|
1082 return is_in_young(new_obj); |
342 | 1083 } |
1084 | |
1085 // Can a compiler elide a store barrier when it writes | |
1086 // a permanent oop into the heap? Applies when the compiler | |
1087 // is storing x to the heap, where x->is_perm() is true. | |
1088 virtual bool can_elide_permanent_oop_store_barriers() const { | |
1089 // At least until perm gen collection is also G1-ified, at | |
1090 // which point this should return false. | |
1091 return true; | |
1092 } | |
1093 | |
1094 virtual bool allocs_are_zero_filled(); | |
1095 | |
1096 // The boundary between a "large" and "small" array of primitives, in | |
1097 // words. | |
1098 virtual size_t large_typearray_limit(); | |
1099 | |
1100 // Returns "true" iff the given word_size is "very large". | |
1101 static bool isHumongous(size_t word_size) { | |
1313
664ae0c5e0e5
6755988: G1: assert(new_obj != 0 || ... "should be forwarded")
johnc
parents:
1311
diff
changeset
|
1102 // Note this has to be strictly greater-than as the TLABs |
664ae0c5e0e5
6755988: G1: assert(new_obj != 0 || ... "should be forwarded")
johnc
parents:
1311
diff
changeset
|
1103 // are capped at the humongous thresold and we want to |
664ae0c5e0e5
6755988: G1: assert(new_obj != 0 || ... "should be forwarded")
johnc
parents:
1311
diff
changeset
|
1104 // ensure that we don't try to allocate a TLAB as |
664ae0c5e0e5
6755988: G1: assert(new_obj != 0 || ... "should be forwarded")
johnc
parents:
1311
diff
changeset
|
1105 // humongous and that we don't allocate a humongous |
664ae0c5e0e5
6755988: G1: assert(new_obj != 0 || ... "should be forwarded")
johnc
parents:
1311
diff
changeset
|
1106 // object in a TLAB. |
664ae0c5e0e5
6755988: G1: assert(new_obj != 0 || ... "should be forwarded")
johnc
parents:
1311
diff
changeset
|
1107 return word_size > _humongous_object_threshold_in_words; |
342 | 1108 } |
1109 | |
1110 // Update mod union table with the set of dirty cards. | |
1111 void updateModUnion(); | |
1112 | |
1113 // Set the mod union bits corresponding to the given memRegion. Note | |
1114 // that this is always a safe operation, since it doesn't clear any | |
1115 // bits. | |
1116 void markModUnionRange(MemRegion mr); | |
1117 | |
1118 // Records the fact that a marking phase is no longer in progress. | |
1119 void set_marking_complete() { | |
1120 _mark_in_progress = false; | |
1121 } | |
1122 void set_marking_started() { | |
1123 _mark_in_progress = true; | |
1124 } | |
1125 bool mark_in_progress() { | |
1126 return _mark_in_progress; | |
1127 } | |
1128 | |
1129 // Print the maximum heap capacity. | |
1130 virtual size_t max_capacity() const; | |
1131 | |
1132 virtual jlong millis_since_last_gc(); | |
1133 | |
1134 // Perform any cleanup actions necessary before allowing a verification. | |
1135 virtual void prepare_for_verify(); | |
1136 | |
1137 // Perform verification. | |
811 | 1138 |
1139 // use_prev_marking == true -> use "prev" marking information, | |
1140 // use_prev_marking == false -> use "next" marking information | |
1141 // NOTE: Only the "prev" marking information is guaranteed to be | |
1142 // consistent most of the time, so most calls to this should use | |
1143 // use_prev_marking == true. Currently, there is only one case where | |
1144 // this is called with use_prev_marking == false, which is to verify | |
1145 // the "next" marking information at the end of remark. | |
1146 void verify(bool allow_dirty, bool silent, bool use_prev_marking); | |
1147 | |
1148 // Override; it uses the "prev" marking information | |
342 | 1149 virtual void verify(bool allow_dirty, bool silent); |
838
0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
tonyp
parents:
811
diff
changeset
|
1150 // Default behavior by calling print(tty); |
342 | 1151 virtual void print() const; |
838
0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
tonyp
parents:
811
diff
changeset
|
1152 // This calls print_on(st, PrintHeapAtGCExtended). |
342 | 1153 virtual void print_on(outputStream* st) const; |
838
0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
tonyp
parents:
811
diff
changeset
|
1154 // If extended is true, it will print out information for all |
0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
tonyp
parents:
811
diff
changeset
|
1155 // regions in the heap by calling print_on_extended(st). |
0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
tonyp
parents:
811
diff
changeset
|
1156 virtual void print_on(outputStream* st, bool extended) const; |
0316eac49d5a
6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set
tonyp
parents:
811
diff
changeset
|
1157 virtual void print_on_extended(outputStream* st) const; |
342 | 1158 |
1159 virtual void print_gc_threads_on(outputStream* st) const; | |
1160 virtual void gc_threads_do(ThreadClosure* tc) const; | |
1161 | |
1162 // Override | |
1163 void print_tracing_info() const; | |
1164 | |
1165 // If "addr" is a pointer into the (reserved?) heap, returns a positive | |
1166 // number indicating the "arena" within the heap in which "addr" falls. | |
1167 // Or else returns 0. | |
1168 virtual int addr_to_arena_id(void* addr) const; | |
1169 | |
1170 // Convenience function to be used in situations where the heap type can be | |
1171 // asserted to be this type. | |
1172 static G1CollectedHeap* heap(); | |
1173 | |
1174 void empty_young_list(); | |
1175 bool should_set_young_locked(); | |
1176 | |
1177 void set_region_short_lived_locked(HeapRegion* hr); | |
1178 // add appropriate methods for any other surv rate groups | |
1179 | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
1180 YoungList* young_list() { return _young_list; } |
342 | 1181 |
1182 // debugging | |
1183 bool check_young_list_well_formed() { | |
1184 return _young_list->check_list_well_formed(); | |
1185 } | |
1394
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
1186 |
1316cec51b4d
6819061: G1: eliminate serial Other times that are proportional to the collection set length
johnc
parents:
1391
diff
changeset
|
1187 bool check_young_list_empty(bool check_heap, |
342 | 1188 bool check_sample = true); |
1189 | |
1190 // *** Stuff related to concurrent marking. It's not clear to me that so | |
1191 // many of these need to be public. | |
1192 | |
1193 // The functions below are helper functions that a subclass of | |
1194 // "CollectedHeap" can use in the implementation of its virtual | |
1195 // functions. | |
1196 // This performs a concurrent marking of the live objects in a | |
1197 // bitmap off to the side. | |
1198 void doConcurrentMark(); | |
1199 | |
1200 // This is called from the marksweep collector which then does | |
1201 // a concurrent mark and verifies that the results agree with | |
1202 // the stop the world marking. | |
1203 void checkConcurrentMark(); | |
1204 void do_sync_mark(); | |
1205 | |
1206 bool isMarkedPrev(oop obj) const; | |
1207 bool isMarkedNext(oop obj) const; | |
1208 | |
811 | 1209 // use_prev_marking == true -> use "prev" marking information, |
1210 // use_prev_marking == false -> use "next" marking information | |
1211 bool is_obj_dead_cond(const oop obj, | |
1212 const HeapRegion* hr, | |
1213 const bool use_prev_marking) const { | |
1214 if (use_prev_marking) { | |
1215 return is_obj_dead(obj, hr); | |
1216 } else { | |
1217 return is_obj_ill(obj, hr); | |
1218 } | |
1219 } | |
1220 | |
342 | 1221 // Determine if an object is dead, given the object and also |
1222 // the region to which the object belongs. An object is dead | |
1223 // iff a) it was not allocated since the last mark and b) it | |
1224 // is not marked. | |
1225 | |
1226 bool is_obj_dead(const oop obj, const HeapRegion* hr) const { | |
1227 return | |
1228 !hr->obj_allocated_since_prev_marking(obj) && | |
1229 !isMarkedPrev(obj); | |
1230 } | |
1231 | |
1232 // This is used when copying an object to survivor space. | |
1233 // If the object is marked live, then we mark the copy live. | |
1234 // If the object is allocated since the start of this mark | |
1235 // cycle, then we mark the copy live. | |
1236 // If the object has been around since the previous mark | |
1237 // phase, and hasn't been marked yet during this phase, | |
1238 // then we don't mark it, we just wait for the | |
1239 // current marking cycle to get to it. | |
1240 | |
1241 // This function returns true when an object has been | |
1242 // around since the previous marking and hasn't yet | |
1243 // been marked during this marking. | |
1244 | |
1245 bool is_obj_ill(const oop obj, const HeapRegion* hr) const { | |
1246 return | |
1247 !hr->obj_allocated_since_next_marking(obj) && | |
1248 !isMarkedNext(obj); | |
1249 } | |
1250 | |
1251 // Determine if an object is dead, given only the object itself. | |
1252 // This will find the region to which the object belongs and | |
1253 // then call the region version of the same function. | |
1254 | |
1255 // Added if it is in permanent gen it isn't dead. | |
1256 // Added if it is NULL it isn't dead. | |
1257 | |
811 | 1258 // use_prev_marking == true -> use "prev" marking information, |
1259 // use_prev_marking == false -> use "next" marking information | |
1260 bool is_obj_dead_cond(const oop obj, | |
1261 const bool use_prev_marking) { | |
1262 if (use_prev_marking) { | |
1263 return is_obj_dead(obj); | |
1264 } else { | |
1265 return is_obj_ill(obj); | |
1266 } | |
1267 } | |
1268 | |
1269 bool is_obj_dead(const oop obj) { | |
1270 const HeapRegion* hr = heap_region_containing(obj); | |
342 | 1271 if (hr == NULL) { |
1272 if (Universe::heap()->is_in_permanent(obj)) | |
1273 return false; | |
1274 else if (obj == NULL) return false; | |
1275 else return true; | |
1276 } | |
1277 else return is_obj_dead(obj, hr); | |
1278 } | |
1279 | |
811 | 1280 bool is_obj_ill(const oop obj) { |
1281 const HeapRegion* hr = heap_region_containing(obj); | |
342 | 1282 if (hr == NULL) { |
1283 if (Universe::heap()->is_in_permanent(obj)) | |
1284 return false; | |
1285 else if (obj == NULL) return false; | |
1286 else return true; | |
1287 } | |
1288 else return is_obj_ill(obj, hr); | |
1289 } | |
1290 | |
1291 // The following is just to alert the verification code | |
1292 // that a full collection has occurred and that the | |
1293 // remembered sets are no longer up to date. | |
1294 bool _full_collection; | |
1295 void set_full_collection() { _full_collection = true;} | |
1296 void clear_full_collection() {_full_collection = false;} | |
1297 bool full_collection() {return _full_collection;} | |
1298 | |
1299 ConcurrentMark* concurrent_mark() const { return _cm; } | |
1300 ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } | |
1301 | |
796
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1302 // The dirty cards region list is used to record a subset of regions |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1303 // whose cards need clearing. The list if populated during the |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1304 // remembered set scanning and drained during the card table |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1305 // cleanup. Although the methods are reentrant, population/draining |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1306 // phases must not overlap. For synchronization purposes the last |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1307 // element on the list points to itself. |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1308 HeapRegion* _dirty_cards_region_list; |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1309 void push_dirty_cards_region(HeapRegion* hr); |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1310 HeapRegion* pop_dirty_cards_region(); |
29e7d79232b9
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
678
diff
changeset
|
1311 |
342 | 1312 public: |
1313 void stop_conc_gc_threads(); | |
1314 | |
1315 // <NEW PREDICTION> | |
1316 | |
1317 double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); | |
1318 void check_if_region_is_too_expensive(double predicted_time_ms); | |
1319 size_t pending_card_num(); | |
1320 size_t max_pending_card_num(); | |
1321 size_t cards_scanned(); | |
1322 | |
1323 // </NEW PREDICTION> | |
1324 | |
1325 protected: | |
1326 size_t _max_heap_capacity; | |
1327 | |
1328 // debug_only(static void check_for_valid_allocation_state();) | |
1329 | |
1330 public: | |
1331 // Temporary: call to mark things unimplemented for the G1 heap (e.g., | |
1332 // MemoryService). In productization, we can make this assert false | |
1333 // to catch such places (as well as searching for calls to this...) | |
1334 static void g1_unimplemented(); | |
1335 | |
1336 }; | |
1337 | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1338 #define use_local_bitmaps 1 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1339 #define verify_local_bitmaps 0 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1340 #define oop_buffer_length 256 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1341 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1342 #ifndef PRODUCT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1343 class GCLabBitMap; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1344 class GCLabBitMapClosure: public BitMapClosure { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1345 private: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1346 ConcurrentMark* _cm; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1347 GCLabBitMap* _bitmap; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1348 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1349 public: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1350 GCLabBitMapClosure(ConcurrentMark* cm, |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1351 GCLabBitMap* bitmap) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1352 _cm = cm; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1353 _bitmap = bitmap; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1354 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1355 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1356 virtual bool do_bit(size_t offset); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1357 }; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1358 #endif // !PRODUCT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1359 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1360 class GCLabBitMap: public BitMap { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1361 private: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1362 ConcurrentMark* _cm; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1363 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1364 int _shifter; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1365 size_t _bitmap_word_covers_words; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1366 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1367 // beginning of the heap |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1368 HeapWord* _heap_start; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1369 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1370 // this is the actual start of the GCLab |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1371 HeapWord* _real_start_word; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1372 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1373 // this is the actual end of the GCLab |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1374 HeapWord* _real_end_word; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1375 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1376 // this is the first word, possibly located before the actual start |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1377 // of the GCLab, that corresponds to the first bit of the bitmap |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1378 HeapWord* _start_word; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1379 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1380 // size of a GCLab in words |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1381 size_t _gclab_word_size; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1382 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1383 static int shifter() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1384 return MinObjAlignment - 1; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1385 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1386 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1387 // how many heap words does a single bitmap word corresponds to? |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1388 static size_t bitmap_word_covers_words() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1389 return BitsPerWord << shifter(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1390 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1391 |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1392 size_t gclab_word_size() const { |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1393 return _gclab_word_size; |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1394 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1395 |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1396 // Calculates actual GCLab size in words |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1397 size_t gclab_real_word_size() const { |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1398 return bitmap_size_in_bits(pointer_delta(_real_end_word, _start_word)) |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1399 / BitsPerWord; |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1400 } |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1401 |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1402 static size_t bitmap_size_in_bits(size_t gclab_word_size) { |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1403 size_t bits_in_bitmap = gclab_word_size >> shifter(); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1404 // We are going to ensure that the beginning of a word in this |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1405 // bitmap also corresponds to the beginning of a word in the |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1406 // global marking bitmap. To handle the case where a GCLab |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1407 // starts from the middle of the bitmap, we need to add enough |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1408 // space (i.e. up to a bitmap word) to ensure that we have |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1409 // enough bits in the bitmap. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1410 return bits_in_bitmap + BitsPerWord - 1; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1411 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1412 public: |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1413 GCLabBitMap(HeapWord* heap_start, size_t gclab_word_size) |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1414 : BitMap(bitmap_size_in_bits(gclab_word_size)), |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1415 _cm(G1CollectedHeap::heap()->concurrent_mark()), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1416 _shifter(shifter()), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1417 _bitmap_word_covers_words(bitmap_word_covers_words()), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1418 _heap_start(heap_start), |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1419 _gclab_word_size(gclab_word_size), |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1420 _real_start_word(NULL), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1421 _real_end_word(NULL), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1422 _start_word(NULL) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1423 { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1424 guarantee( size_in_words() >= bitmap_size_in_words(), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1425 "just making sure"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1426 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1427 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1428 inline unsigned heapWordToOffset(HeapWord* addr) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1429 unsigned offset = (unsigned) pointer_delta(addr, _start_word) >> _shifter; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1430 assert(offset < size(), "offset should be within bounds"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1431 return offset; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1432 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1433 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1434 inline HeapWord* offsetToHeapWord(size_t offset) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1435 HeapWord* addr = _start_word + (offset << _shifter); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1436 assert(_real_start_word <= addr && addr < _real_end_word, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1437 return addr; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1438 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1439 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1440 bool fields_well_formed() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1441 bool ret1 = (_real_start_word == NULL) && |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1442 (_real_end_word == NULL) && |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1443 (_start_word == NULL); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1444 if (ret1) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1445 return true; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1446 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1447 bool ret2 = _real_start_word >= _start_word && |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1448 _start_word < _real_end_word && |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1449 (_real_start_word + _gclab_word_size) == _real_end_word && |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1450 (_start_word + _gclab_word_size + _bitmap_word_covers_words) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1451 > _real_end_word; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1452 return ret2; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1453 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1454 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1455 inline bool mark(HeapWord* addr) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1456 guarantee(use_local_bitmaps, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1457 assert(fields_well_formed(), "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1458 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1459 if (addr >= _real_start_word && addr < _real_end_word) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1460 assert(!isMarked(addr), "should not have already been marked"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1461 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1462 // first mark it on the bitmap |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1463 at_put(heapWordToOffset(addr), true); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1464 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1465 return true; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1466 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1467 return false; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1468 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1469 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1470 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1471 inline bool isMarked(HeapWord* addr) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1472 guarantee(use_local_bitmaps, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1473 assert(fields_well_formed(), "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1474 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1475 return at(heapWordToOffset(addr)); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1476 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1477 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1478 void set_buffer(HeapWord* start) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1479 guarantee(use_local_bitmaps, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1480 clear(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1481 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1482 assert(start != NULL, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1483 _real_start_word = start; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1484 _real_end_word = start + _gclab_word_size; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1485 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1486 size_t diff = |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1487 pointer_delta(start, _heap_start) % _bitmap_word_covers_words; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1488 _start_word = start - diff; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1489 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1490 assert(fields_well_formed(), "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1491 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1492 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1493 #ifndef PRODUCT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1494 void verify() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1495 // verify that the marks have been propagated |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1496 GCLabBitMapClosure cl(_cm, this); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1497 iterate(&cl); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1498 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1499 #endif // PRODUCT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1500 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1501 void retire() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1502 guarantee(use_local_bitmaps, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1503 assert(fields_well_formed(), "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1504 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1505 if (_start_word != NULL) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1506 CMBitMap* mark_bitmap = _cm->nextMarkBitMap(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1507 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1508 // this means that the bitmap was set up for the GCLab |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1509 assert(_real_start_word != NULL && _real_end_word != NULL, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1510 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1511 mark_bitmap->mostly_disjoint_range_union(this, |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1512 0, // always start from the start of the bitmap |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1513 _start_word, |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1514 gclab_real_word_size()); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1515 _cm->grayRegionIfNecessary(MemRegion(_real_start_word, _real_end_word)); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1516 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1517 #ifndef PRODUCT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1518 if (use_local_bitmaps && verify_local_bitmaps) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1519 verify(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1520 #endif // PRODUCT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1521 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1522 assert(_real_start_word == NULL && _real_end_word == NULL, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1523 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1524 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1525 |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1526 size_t bitmap_size_in_words() const { |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1527 return (bitmap_size_in_bits(gclab_word_size()) + BitsPerWord - 1) / BitsPerWord; |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1528 } |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1529 |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1530 }; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1531 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1532 class G1ParGCAllocBuffer: public ParGCAllocBuffer { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1533 private: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1534 bool _retired; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1535 bool _during_marking; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1536 GCLabBitMap _bitmap; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1537 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1538 public: |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1539 G1ParGCAllocBuffer(size_t gclab_word_size) : |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1540 ParGCAllocBuffer(gclab_word_size), |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1541 _during_marking(G1CollectedHeap::heap()->mark_in_progress()), |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1542 _bitmap(G1CollectedHeap::heap()->reserved_region().start(), gclab_word_size), |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1543 _retired(false) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1544 { } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1545 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1546 inline bool mark(HeapWord* addr) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1547 guarantee(use_local_bitmaps, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1548 assert(_during_marking, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1549 return _bitmap.mark(addr); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1550 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1551 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1552 inline void set_buf(HeapWord* buf) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1553 if (use_local_bitmaps && _during_marking) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1554 _bitmap.set_buffer(buf); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1555 ParGCAllocBuffer::set_buf(buf); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1556 _retired = false; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1557 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1558 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1559 inline void retire(bool end_of_gc, bool retain) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1560 if (_retired) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1561 return; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1562 if (use_local_bitmaps && _during_marking) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1563 _bitmap.retire(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1564 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1565 ParGCAllocBuffer::retire(end_of_gc, retain); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1566 _retired = true; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1567 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1568 }; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1569 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1570 class G1ParScanThreadState : public StackObj { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1571 protected: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1572 G1CollectedHeap* _g1h; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1573 RefToScanQueue* _refs; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1574 DirtyCardQueue _dcq; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1575 CardTableModRefBS* _ct_bs; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1576 G1RemSet* _g1_rem; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1577 |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1578 G1ParGCAllocBuffer _surviving_alloc_buffer; |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1579 G1ParGCAllocBuffer _tenured_alloc_buffer; |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1580 G1ParGCAllocBuffer* _alloc_buffers[GCAllocPurposeCount]; |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1581 ageTable _age_table; |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1582 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1583 size_t _alloc_buffer_waste; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1584 size_t _undo_waste; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1585 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1586 OopsInHeapRegionClosure* _evac_failure_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1587 G1ParScanHeapEvacClosure* _evac_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1588 G1ParScanPartialArrayClosure* _partial_scan_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1589 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1590 int _hash_seed; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1591 int _queue_num; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1592 |
1611 | 1593 size_t _term_attempts; |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1594 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1595 double _start; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1596 double _start_strong_roots; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1597 double _strong_roots_time; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1598 double _start_term; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1599 double _term_time; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1600 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1601 // Map from young-age-index (0 == not young, 1 is youngest) to |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1602 // surviving words. base is what we get back from the malloc call |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1603 size_t* _surviving_young_words_base; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1604 // this points into the array, as we use the first few entries for padding |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1605 size_t* _surviving_young_words; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1606 |
1709 | 1607 #define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t)) |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1608 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1609 void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1610 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1611 void add_to_undo_waste(size_t waste) { _undo_waste += waste; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1612 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1613 DirtyCardQueue& dirty_card_queue() { return _dcq; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1614 CardTableModRefBS* ctbs() { return _ct_bs; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1615 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1616 template <class T> void immediate_rs_update(HeapRegion* from, T* p, int tid) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1617 if (!from->is_survivor()) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1618 _g1_rem->par_write_ref(from, p, tid); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1619 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1620 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1621 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1622 template <class T> void deferred_rs_update(HeapRegion* from, T* p, int tid) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1623 // If the new value of the field points to the same region or |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1624 // is the to-space, we don't need to include it in the Rset updates. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1625 if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1626 size_t card_index = ctbs()->index_for(p); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1627 // If the card hasn't been added to the buffer, do it. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1628 if (ctbs()->mark_card_deferred(card_index)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1629 dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index)); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1630 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1631 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1632 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1633 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1634 public: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1635 G1ParScanThreadState(G1CollectedHeap* g1h, int queue_num); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1636 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1637 ~G1ParScanThreadState() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1638 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1639 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1640 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1641 RefToScanQueue* refs() { return _refs; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1642 ageTable* age_table() { return &_age_table; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1643 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1644 G1ParGCAllocBuffer* alloc_buffer(GCAllocPurpose purpose) { |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1645 return _alloc_buffers[purpose]; |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1646 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1647 |
1709 | 1648 size_t alloc_buffer_waste() const { return _alloc_buffer_waste; } |
1649 size_t undo_waste() const { return _undo_waste; } | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1650 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1651 template <class T> void push_on_queue(T* ref) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1652 assert(ref != NULL, "invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1653 assert(has_partial_array_mask(ref) || |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1654 _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(ref)), "invariant"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1655 #ifdef ASSERT |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1656 if (has_partial_array_mask(ref)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1657 oop p = clear_partial_array_mask(ref); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1658 // Verify that we point into the CS |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1659 assert(_g1h->obj_in_cs(p), "Should be in CS"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1660 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1661 #endif |
1709 | 1662 refs()->push(ref); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1663 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1664 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1665 void pop_from_queue(StarTask& ref) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1666 if (refs()->pop_local(ref)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1667 assert((oop*)ref != NULL, "pop_local() returned true"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1668 assert(UseCompressedOops || !ref.is_narrow(), "Error"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1669 assert(has_partial_array_mask((oop*)ref) || |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1670 _g1h->is_in_g1_reserved(ref.is_narrow() ? oopDesc::load_decode_heap_oop((narrowOop*)ref) |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1671 : oopDesc::load_decode_heap_oop((oop*)ref)), |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1672 "invariant"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1673 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1674 StarTask null_task; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1675 ref = null_task; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1676 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1677 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1678 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1679 void pop_from_overflow_queue(StarTask& ref) { |
1709 | 1680 StarTask new_ref; |
1681 refs()->pop_overflow(new_ref); | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1682 assert((oop*)new_ref != NULL, "pop() from a local non-empty stack"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1683 assert(UseCompressedOops || !new_ref.is_narrow(), "Error"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1684 assert(has_partial_array_mask((oop*)new_ref) || |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1685 _g1h->is_in_g1_reserved(new_ref.is_narrow() ? oopDesc::load_decode_heap_oop((narrowOop*)new_ref) |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1686 : oopDesc::load_decode_heap_oop((oop*)new_ref)), |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1687 "invariant"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1688 ref = new_ref; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1689 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1690 |
1709 | 1691 int refs_to_scan() { return refs()->size(); } |
1692 int overflowed_refs_to_scan() { return refs()->overflow_stack()->length(); } | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1693 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1694 template <class T> void update_rs(HeapRegion* from, T* p, int tid) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1695 if (G1DeferredRSUpdate) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1696 deferred_rs_update(from, p, tid); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1697 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1698 immediate_rs_update(from, p, tid); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1699 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1700 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1701 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1702 HeapWord* allocate_slow(GCAllocPurpose purpose, size_t word_sz) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1703 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1704 HeapWord* obj = NULL; |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1705 size_t gclab_word_size = _g1h->desired_plab_sz(purpose); |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1706 if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) { |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1707 G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose); |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1708 assert(gclab_word_size == alloc_buf->word_sz(), |
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1709 "dynamic resizing is not supported"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1710 add_to_alloc_buffer_waste(alloc_buf->words_remaining()); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1711 alloc_buf->retire(false, false); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1712 |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1713 HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1714 if (buf == NULL) return NULL; // Let caller handle allocation failure. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1715 // Otherwise. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1716 alloc_buf->set_buf(buf); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1717 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1718 obj = alloc_buf->allocate(word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1719 assert(obj != NULL, "buffer was definitely big enough..."); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1720 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1721 obj = _g1h->par_allocate_during_gc(purpose, word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1722 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1723 return obj; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1724 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1725 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1726 HeapWord* allocate(GCAllocPurpose purpose, size_t word_sz) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1727 HeapWord* obj = alloc_buffer(purpose)->allocate(word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1728 if (obj != NULL) return obj; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1729 return allocate_slow(purpose, word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1730 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1731 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1732 void undo_allocation(GCAllocPurpose purpose, HeapWord* obj, size_t word_sz) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1733 if (alloc_buffer(purpose)->contains(obj)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1734 assert(alloc_buffer(purpose)->contains(obj + word_sz - 1), |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1735 "should contain whole object"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1736 alloc_buffer(purpose)->undo_allocation(obj, word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1737 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1738 CollectedHeap::fill_with_object(obj, word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1739 add_to_undo_waste(word_sz); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1740 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1741 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1742 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1743 void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1744 _evac_failure_cl = evac_failure_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1745 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1746 OopsInHeapRegionClosure* evac_failure_closure() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1747 return _evac_failure_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1748 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1749 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1750 void set_evac_closure(G1ParScanHeapEvacClosure* evac_cl) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1751 _evac_cl = evac_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1752 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1753 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1754 void set_partial_scan_closure(G1ParScanPartialArrayClosure* partial_scan_cl) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1755 _partial_scan_cl = partial_scan_cl; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1756 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1757 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1758 int* hash_seed() { return &_hash_seed; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1759 int queue_num() { return _queue_num; } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1760 |
1709 | 1761 size_t term_attempts() const { return _term_attempts; } |
1611 | 1762 void note_term_attempt() { _term_attempts++; } |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1763 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1764 void start_strong_roots() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1765 _start_strong_roots = os::elapsedTime(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1766 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1767 void end_strong_roots() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1768 _strong_roots_time += (os::elapsedTime() - _start_strong_roots); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1769 } |
1709 | 1770 double strong_roots_time() const { return _strong_roots_time; } |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1771 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1772 void start_term_time() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1773 note_term_attempt(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1774 _start_term = os::elapsedTime(); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1775 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1776 void end_term_time() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1777 _term_time += (os::elapsedTime() - _start_term); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1778 } |
1709 | 1779 double term_time() const { return _term_time; } |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1780 |
1709 | 1781 double elapsed_time() const { |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1782 return os::elapsedTime() - _start; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1783 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1784 |
1709 | 1785 static void |
1786 print_termination_stats_hdr(outputStream* const st = gclog_or_tty); | |
1787 void | |
1788 print_termination_stats(int i, outputStream* const st = gclog_or_tty) const; | |
1789 | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1790 size_t* surviving_young_words() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1791 // We add on to hide entry 0 which accumulates surviving words for |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1792 // age -1 regions (i.e. non-young ones) |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1793 return _surviving_young_words; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1794 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1795 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1796 void retire_alloc_buffers() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1797 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1798 size_t waste = _alloc_buffers[ap]->words_remaining(); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1799 add_to_alloc_buffer_waste(waste); |
1391
79e419e5ea3b
6942253: G1: replace G1ParallelGCAllocBufferSize with YoungPLABSize and OldPLABSize
apetrusenko
parents:
1313
diff
changeset
|
1800 _alloc_buffers[ap]->retire(true, false); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1801 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1802 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1803 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1804 private: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1805 template <class T> void deal_with_reference(T* ref_to_scan) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1806 if (has_partial_array_mask(ref_to_scan)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1807 _partial_scan_cl->do_oop_nv(ref_to_scan); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1808 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1809 // Note: we can use "raw" versions of "region_containing" because |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1810 // "obj_to_scan" is definitely in the heap, and is not in a |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1811 // humongous region. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1812 HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1813 _evac_cl->set_region(r); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1814 _evac_cl->do_oop_nv(ref_to_scan); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1815 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1816 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1817 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1818 public: |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1819 void trim_queue() { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1820 // I've replicated the loop twice, first to drain the overflow |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1821 // queue, second to drain the task queue. This is better than |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1822 // having a single loop, which checks both conditions and, inside |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1823 // it, either pops the overflow queue or the task queue, as each |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1824 // loop is tighter. Also, the decision to drain the overflow queue |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1825 // first is not arbitrary, as the overflow queue is not visible |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1826 // to the other workers, whereas the task queue is. So, we want to |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1827 // drain the "invisible" entries first, while allowing the other |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1828 // workers to potentially steal the "visible" entries. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1829 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1830 while (refs_to_scan() > 0 || overflowed_refs_to_scan() > 0) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1831 while (overflowed_refs_to_scan() > 0) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1832 StarTask ref_to_scan; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1833 assert((oop*)ref_to_scan == NULL, "Constructed above"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1834 pop_from_overflow_queue(ref_to_scan); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1835 // We shouldn't have pushed it on the queue if it was not |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1836 // pointing into the CSet. |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1837 assert((oop*)ref_to_scan != NULL, "Follows from inner loop invariant"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1838 if (ref_to_scan.is_narrow()) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1839 assert(UseCompressedOops, "Error"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1840 narrowOop* p = (narrowOop*)ref_to_scan; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1841 assert(!has_partial_array_mask(p) && |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1842 _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1843 deal_with_reference(p); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1844 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1845 oop* p = (oop*)ref_to_scan; |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1846 assert((has_partial_array_mask(p) && _g1h->is_in_g1_reserved(clear_partial_array_mask(p))) || |
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1847 _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1848 deal_with_reference(p); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1849 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1850 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1851 |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1852 while (refs_to_scan() > 0) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1853 StarTask ref_to_scan; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1854 assert((oop*)ref_to_scan == NULL, "Constructed above"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1855 pop_from_queue(ref_to_scan); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1856 if ((oop*)ref_to_scan != NULL) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1857 if (ref_to_scan.is_narrow()) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1858 assert(UseCompressedOops, "Error"); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1859 narrowOop* p = (narrowOop*)ref_to_scan; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1860 assert(!has_partial_array_mask(p) && |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1861 _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1862 deal_with_reference(p); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1863 } else { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1864 oop* p = (oop*)ref_to_scan; |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1865 assert((has_partial_array_mask(p) && _g1h->obj_in_cs(clear_partial_array_mask(p))) || |
1261
0414c1049f15
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
1194
diff
changeset
|
1866 _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "sanity"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1867 deal_with_reference(p); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1868 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1869 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1870 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1871 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1872 } |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
838
diff
changeset
|
1873 }; |