Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp @ 1960:878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
Summary: An evacuation failure while copying the roots caused an object, A, to be forwarded to itself. During the subsequent RSet updating a reference to A was processed causing the reference to be added to the RSet of A's heap region. As a result of adding to the remembered set we ran into the issue described in 6930581 - the sparse table expanded and the RSet scanning code walked the cards in one instance of RHashTable (_cur) while the occupied() counts the cards in the expanded table (_next).
Reviewed-by: tonyp, iveresov
author | johnc |
---|---|
date | Tue, 16 Nov 2010 14:07:33 -0800 |
parents | c32059ef4dc0 |
children | f95d63e2154a |
rev | line source |
---|---|
342 | 1 /* |
1705 | 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:
866
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
866
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:
866
diff
changeset
|
21 * questions. |
342 | 22 * |
23 */ | |
24 | |
25 inline size_t G1RemSet::n_workers() { | |
26 if (_g1->workers() != NULL) { | |
27 return _g1->workers()->total_workers(); | |
28 } else { | |
29 return 1; | |
30 } | |
31 } | |
32 | |
1861 | 33 template <class T> |
1960
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
34 inline void G1RemSet::write_ref(HeapRegion* from, T* p) { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
35 par_write_ref(from, p, 0); |
342 | 36 } |
37 | |
1861 | 38 template <class T> |
1960
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
39 inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, int tid) { |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
677
diff
changeset
|
40 oop obj = oopDesc::load_decode_heap_oop(p); |
342 | 41 #ifdef ASSERT |
42 // can't do because of races | |
43 // assert(obj == NULL || obj->is_oop(), "expected an oop"); | |
44 | |
45 // Do the safe subset of is_oop | |
46 if (obj != NULL) { | |
47 #ifdef CHECK_UNHANDLED_OOPS | |
48 oopDesc* o = obj.obj(); | |
49 #else | |
50 oopDesc* o = obj; | |
51 #endif // CHECK_UNHANDLED_OOPS | |
52 assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); | |
53 assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); | |
54 } | |
55 #endif // ASSERT | |
1705 | 56 |
57 assert(from == NULL || from->is_in_reserved(p), "p is not in from"); | |
58 | |
342 | 59 HeapRegion* to = _g1->heap_region_containing(obj); |
1960
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
60 if (to != NULL && from != to) { |
342 | 61 #if G1_REM_SET_LOGGING |
1960
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
62 gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS" |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
63 " for region [" PTR_FORMAT ", " PTR_FORMAT ")", |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
64 p, obj, |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
65 to->bottom(), to->end()); |
342 | 66 #endif |
1960
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
67 assert(to->rem_set() != NULL, "Need per-region 'into' remsets."); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
68 to->rem_set()->add_reference(p, tid); |
342 | 69 } |
70 } | |
626
87fa6e083d82
6760309: G1: update remembered sets during Full GCs
apetrusenko
parents:
616
diff
changeset
|
71 |
1861 | 72 template <class T> |
73 inline void UpdateRSOopClosure::do_oop_work(T* p) { | |
626
87fa6e083d82
6760309: G1: update remembered sets during Full GCs
apetrusenko
parents:
616
diff
changeset
|
74 assert(_from != NULL, "from region must be non-NULL"); |
87fa6e083d82
6760309: G1: update remembered sets during Full GCs
apetrusenko
parents:
616
diff
changeset
|
75 _rs->par_write_ref(_from, p, _worker_i); |
87fa6e083d82
6760309: G1: update remembered sets during Full GCs
apetrusenko
parents:
616
diff
changeset
|
76 } |
1705 | 77 |
1861 | 78 template <class T> |
79 inline void UpdateRSetImmediate::do_oop_work(T* p) { | |
1705 | 80 assert(_from->is_in_reserved(p), "paranoia"); |
81 T heap_oop = oopDesc::load_heap_oop(p); | |
82 if (!oopDesc::is_null(heap_oop) && !_from->is_survivor()) { | |
83 _g1_rem_set->par_write_ref(_from, p, 0); | |
84 } | |
85 } | |
86 | |
1960
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
87 template <class T> |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
88 inline void UpdateRSOrPushRefOopClosure::do_oop_work(T* p) { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
89 oop obj = oopDesc::load_decode_heap_oop(p); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
90 #ifdef ASSERT |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
91 // can't do because of races |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
92 // assert(obj == NULL || obj->is_oop(), "expected an oop"); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
93 |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
94 // Do the safe subset of is_oop |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
95 if (obj != NULL) { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
96 #ifdef CHECK_UNHANDLED_OOPS |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
97 oopDesc* o = obj.obj(); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
98 #else |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
99 oopDesc* o = obj; |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
100 #endif // CHECK_UNHANDLED_OOPS |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
101 assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
102 assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
103 } |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
104 #endif // ASSERT |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
105 |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
106 assert(_from != NULL, "from region must be non-NULL"); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
107 |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
108 HeapRegion* to = _g1->heap_region_containing(obj); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
109 if (to != NULL && _from != to) { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
110 // The _record_refs_into_cset flag is true during the RSet |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
111 // updating part of an evacuation pause. It is false at all |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
112 // other times: |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
113 // * rebuilding the rembered sets after a full GC |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
114 // * during concurrent refinement. |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
115 // * updating the remembered sets of regions in the collection |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
116 // set in the event of an evacuation failure (when deferred |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
117 // updates are enabled). |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
118 |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
119 if (_record_refs_into_cset && to->in_collection_set()) { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
120 // We are recording references that point into the collection |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
121 // set and this particular reference does exactly that... |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
122 // If the referenced object has already been forwarded |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
123 // to itself, we are handling an evacuation failure and |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
124 // we have already visited/tried to copy this object |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
125 // there is no need to retry. |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
126 if (!self_forwarded(obj)) { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
127 assert(_push_ref_cl != NULL, "should not be null"); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
128 // Push the reference in the refs queue of the G1ParScanThreadState |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
129 // instance for this worker thread. |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
130 _push_ref_cl->do_oop(p); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
131 } |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
132 |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
133 // Deferred updates to the CSet are either discarded (in the normal case), |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
134 // or processed (if an evacuation failure occurs) at the end |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
135 // of the collection. |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
136 // See G1RemSet::cleanup_after_oops_into_collection_set_do(). |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
137 } else { |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
138 // We either don't care about pushing references that point into the |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
139 // collection set (i.e. we're not during an evacuation pause) _or_ |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
140 // the reference doesn't point into the collection set. Either way |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
141 // we add the reference directly to the RSet of the region containing |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
142 // the referenced object. |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
143 _g1_rem_set->par_write_ref(_from, p, _worker_i); |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
144 } |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
145 } |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
146 } |
878b57474103
6978187: G1: assert(ParallelGCThreads> 1 || n_yielded() == _hrrs->occupied()) strikes again
johnc
parents:
1861
diff
changeset
|
147 |