Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/g1/g1EvacFailure.hpp @ 20504:6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
Summary: Remove -XX:-G1DeferredRSUpdate functionality as it is racy. During evacuation failure handling, threads where evacuation failure handling occurred may try to add remembered sets to regions which remembered sets are currently being scanned. The iterator to handle the remembered set scan does not support addition of entries during scan and so may skip valid references.
Reviewed-by: iveresov, brutisso, mgerdin
author | tschatzl |
---|---|
date | Tue, 30 Sep 2014 09:44:36 +0200 |
parents | 7baf47cb97cb |
children | 7848fc12602b |
rev | line source |
---|---|
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
1 /* |
17467
55fb97c4c58d
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
12343
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
4 * |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
8 * |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
13 * accompanied this code). |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
14 * |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
18 * |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
21 * questions. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
22 * |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
23 */ |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
24 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1EVACFAILURE_HPP |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1EVACFAILURE_HPP |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
27 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
28 #include "gc_implementation/g1/concurrentMark.inline.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
29 #include "gc_implementation/g1/dirtyCardQueue.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
30 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
31 #include "gc_implementation/g1/g1_globals.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
32 #include "gc_implementation/g1/g1OopClosures.inline.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
33 #include "gc_implementation/g1/heapRegion.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
34 #include "gc_implementation/g1/heapRegionRemSet.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
35 #include "utilities/workgroup.hpp" |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
36 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
37 // Closures and tasks associated with any self-forwarding pointers |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
38 // installed as a result of an evacuation failure. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
39 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
40 class UpdateRSetDeferred : public OopsInHeapRegionClosure { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
41 private: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
42 G1CollectedHeap* _g1; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
43 DirtyCardQueue *_dcq; |
12343 | 44 G1SATBCardTableModRefBS* _ct_bs; |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
45 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
46 public: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
47 UpdateRSetDeferred(G1CollectedHeap* g1, DirtyCardQueue* dcq) : |
12343 | 48 _g1(g1), _ct_bs(_g1->g1_barrier_set()), _dcq(dcq) {} |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
49 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
50 virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
51 virtual void do_oop( oop* p) { do_oop_work(p); } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
52 template <class T> void do_oop_work(T* p) { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
53 assert(_from->is_in_reserved(p), "paranoia"); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
54 if (!_from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
55 !_from->is_survivor()) { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
56 size_t card_index = _ct_bs->index_for(p); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
57 if (_ct_bs->mark_card_deferred(card_index)) { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
58 _dcq->enqueue((jbyte*)_ct_bs->byte_for_index(card_index)); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
59 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
60 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
61 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
62 }; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
63 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
64 class RemoveSelfForwardPtrObjClosure: public ObjectClosure { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
65 private: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
66 G1CollectedHeap* _g1; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
67 ConcurrentMark* _cm; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
68 HeapRegion* _hr; |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
69 size_t _marked_bytes; |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
70 OopsInHeapRegionClosure *_update_rset_cl; |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
71 bool _during_initial_mark; |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
72 bool _during_conc_mark; |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
73 uint _worker_id; |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
74 HeapWord* _end_of_last_gap; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
75 HeapWord* _last_gap_threshold; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
76 HeapWord* _last_obj_threshold; |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
77 |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
78 public: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
79 RemoveSelfForwardPtrObjClosure(G1CollectedHeap* g1, ConcurrentMark* cm, |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
80 HeapRegion* hr, |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
81 OopsInHeapRegionClosure* update_rset_cl, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
82 bool during_initial_mark, |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
83 bool during_conc_mark, |
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
84 uint worker_id) : |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
85 _g1(g1), _cm(cm), _hr(hr), _marked_bytes(0), |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
86 _update_rset_cl(update_rset_cl), |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
87 _during_initial_mark(during_initial_mark), |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
88 _during_conc_mark(during_conc_mark), |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
89 _worker_id(worker_id), |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
90 _end_of_last_gap(hr->bottom()), |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
91 _last_gap_threshold(hr->bottom()), |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
92 _last_obj_threshold(hr->bottom()) { } |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
93 |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
94 size_t marked_bytes() { return _marked_bytes; } |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
95 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
96 // <original comment> |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
97 // The original idea here was to coalesce evacuated and dead objects. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
98 // However that caused complications with the block offset table (BOT). |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
99 // In particular if there were two TLABs, one of them partially refined. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
100 // |----- TLAB_1--------|----TLAB_2-~~~(partially refined part)~~~| |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
101 // The BOT entries of the unrefined part of TLAB_2 point to the start |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
102 // of TLAB_2. If the last object of the TLAB_1 and the first object |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
103 // of TLAB_2 are coalesced, then the cards of the unrefined part |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
104 // would point into middle of the filler object. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
105 // The current approach is to not coalesce and leave the BOT contents intact. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
106 // </original comment> |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
107 // |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
108 // We now reset the BOT when we start the object iteration over the |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
109 // region and refine its entries for every object we come across. So |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
110 // the above comment is not really relevant and we should be able |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
111 // to coalesce dead objects if we want to. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
112 void do_object(oop obj) { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
113 HeapWord* obj_addr = (HeapWord*) obj; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
114 assert(_hr->is_in(obj_addr), "sanity"); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
115 size_t obj_size = obj->size(); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
116 HeapWord* obj_end = obj_addr + obj_size; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
117 |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
118 if (_end_of_last_gap != obj_addr) { |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
119 // there was a gap before obj_addr |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
120 _last_gap_threshold = _hr->cross_threshold(_end_of_last_gap, obj_addr); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
121 } |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
122 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
123 if (obj->is_forwarded() && obj->forwardee() == obj) { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
124 // The object failed to move. |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
125 |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
126 // We consider all objects that we find self-forwarded to be |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
127 // live. What we'll do is that we'll update the prev marking |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
128 // info so that they are all under PTAMS and explicitly marked. |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
129 if (!_cm->isPrevMarked(obj)) { |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
130 _cm->markPrev(obj); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
131 } |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
132 if (_during_initial_mark) { |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
133 // For the next marking info we'll only mark the |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
134 // self-forwarded objects explicitly if we are during |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
135 // initial-mark (since, normally, we only mark objects pointed |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
136 // to by roots if we succeed in copying them). By marking all |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
137 // self-forwarded objects we ensure that we mark any that are |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
138 // still pointed to be roots. During concurrent marking, and |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
139 // after initial-mark, we don't need to mark any objects |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
140 // explicitly and all objects in the CSet are considered |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
141 // (implicitly) live. So, we won't mark them explicitly and |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
142 // we'll leave them over NTAMS. |
4837
eff609af17d7
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
4836
diff
changeset
|
143 _cm->grayRoot(obj, obj_size, _worker_id, _hr); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
144 } |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
145 _marked_bytes += (obj_size * HeapWordSize); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
146 obj->set_mark(markOopDesc::prototype()); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
147 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
148 // While we were processing RSet buffers during the collection, |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
149 // we actually didn't scan any cards on the collection set, |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
150 // since we didn't want to update remembered sets with entries |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
151 // that point into the collection set, given that live objects |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
152 // from the collection set are about to move and such entries |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
153 // will be stale very soon. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
154 // This change also dealt with a reliability issue which |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
155 // involved scanning a card in the collection set and coming |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
156 // across an array that was being chunked and looking malformed. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
157 // The problem is that, if evacuation fails, we might have |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
158 // remembered set entries missing given that we skipped cards on |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
159 // the collection set. So, we'll recreate such entries now. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
160 obj->oop_iterate(_update_rset_cl); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
161 } else { |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
162 |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
163 // The object has been either evacuated or is dead. Fill it with a |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
164 // dummy object. |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
165 MemRegion mr(obj_addr, obj_size); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
166 CollectedHeap::fill_with_object(mr); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
167 |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
168 // must nuke all dead objects which we skipped when iterating over the region |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
169 _cm->clearRangePrevBitmap(MemRegion(_end_of_last_gap, obj_end)); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
170 } |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
171 _end_of_last_gap = obj_end; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
17467
diff
changeset
|
172 _last_obj_threshold = _hr->cross_threshold(obj_addr, obj_end); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
173 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
174 }; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
175 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
176 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
177 G1CollectedHeap* _g1h; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
178 ConcurrentMark* _cm; |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
179 uint _worker_id; |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
180 |
20504
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
181 DirtyCardQueue _dcq; |
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
182 UpdateRSetDeferred _update_rset_cl; |
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
183 |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
184 public: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
185 RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h, |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
186 uint worker_id) : |
20504
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
187 _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq), |
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
188 _worker_id(worker_id), _cm(_g1h->concurrent_mark()) { |
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
189 } |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
190 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
191 bool doHeapRegion(HeapRegion *hr) { |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
192 bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause(); |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
193 bool during_conc_mark = _g1h->mark_in_progress(); |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
194 |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
195 assert(!hr->isHumongous(), "sanity"); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
196 assert(hr->in_collection_set(), "bad CS"); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
197 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
198 if (hr->claimHeapRegion(HeapRegion::ParEvacFailureClaimValue)) { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
199 if (hr->evacuation_failed()) { |
20504
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
200 RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl, |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
201 during_initial_mark, |
4836
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
202 during_conc_mark, |
d30fa85f9994
6484965: G1: piggy-back liveness accounting phase on marking
johnc
parents:
4787
diff
changeset
|
203 _worker_id); |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
204 |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
205 hr->note_self_forwarding_removal_start(during_initial_mark, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
206 during_conc_mark); |
20291
e0954897238a
7132678: G1: verify that the marking bitmaps have no marks for objects over TAMS
brutisso
parents:
20278
diff
changeset
|
207 _g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
208 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
209 // In the common case (i.e. when there is no evacuation |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
210 // failure) we make sure that the following is done when |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
211 // the region is freed so that it is "ready-to-go" when it's |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
212 // re-allocated. However, when evacuation failure happens, a |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
213 // region will remain in the heap and might ultimately be added |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
214 // to a CSet in the future. So we have to be careful here and |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
215 // make sure the region's RSet is ready for parallel iteration |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
216 // whenever this might be required in the future. |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
217 hr->rem_set()->reset_for_par_iteration(); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
218 hr->reset_bot(); |
20504
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
219 _update_rset_cl.set_region(hr); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
220 hr->object_iterate(&rspc); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
221 |
20494 | 222 hr->rem_set()->clean_strong_code_roots(hr); |
223 | |
4787
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
224 hr->note_self_forwarding_removal_end(during_initial_mark, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
225 during_conc_mark, |
2ace1c4ee8da
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
4783
diff
changeset
|
226 rspc.marked_bytes()); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
227 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
228 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
229 return false; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
230 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
231 }; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
232 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
233 class G1ParRemoveSelfForwardPtrsTask: public AbstractGangTask { |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
234 protected: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
235 G1CollectedHeap* _g1h; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
236 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
237 public: |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
238 G1ParRemoveSelfForwardPtrsTask(G1CollectedHeap* g1h) : |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
239 AbstractGangTask("G1 Remove Self-forwarding Pointers"), |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
240 _g1h(g1h) { } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
241 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
242 void work(uint worker_id) { |
20504
6948da6d7c13
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
20494
diff
changeset
|
243 RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id); |
4783
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
244 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
245 HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
246 _g1h->collection_set_iterate_from(hr, &rsfp_cl); |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
247 } |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
248 }; |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
249 |
023652e49ac0
7121496: G1: do the per-region evacuation failure handling work in parallel
johnc
parents:
diff
changeset
|
250 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1EVACFAILURE_HPP |