Mercurial > hg > truffle
annotate src/share/vm/oops/instanceRefKlass.cpp @ 14649:f6301b007a16
6498581: ThreadInterruptTest3 produces wrong output on Windows
Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set.
Reviewed-by: acorn, kvn
Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author | minqi |
---|---|
date | Wed, 26 Feb 2014 15:20:41 -0800 |
parents | 190899198332 |
children | 78bbf4d43a14 |
rev | line source |
---|---|
0 | 1 /* |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1144
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1144
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:
1144
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | |
27 #include "classfile/systemDictionary.hpp" | |
28 #include "gc_implementation/shared/markSweep.inline.hpp" | |
29 #include "gc_interface/collectedHeap.hpp" | |
30 #include "gc_interface/collectedHeap.inline.hpp" | |
31 #include "memory/genCollectedHeap.hpp" | |
32 #include "memory/genOopClosures.inline.hpp" | |
33 #include "oops/instanceRefKlass.hpp" | |
34 #include "oops/oop.inline.hpp" | |
35 #include "utilities/preserveException.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
36 #include "utilities/macros.hpp" |
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
37 #if INCLUDE_ALL_GCS |
1972 | 38 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
39 #include "gc_implementation/g1/g1OopClosures.inline.hpp" | |
40 #include "gc_implementation/g1/g1RemSet.inline.hpp" | |
41 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" | |
42 #include "gc_implementation/parNew/parOopClosures.inline.hpp" | |
43 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" | |
44 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" | |
45 #include "oops/oop.pcgc.inline.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
46 #endif // INCLUDE_ALL_GCS |
0 | 47 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
48 template <class T> |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
49 void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
50 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
51 T heap_oop = oopDesc::load_heap_oop(referent_addr); |
0 | 52 debug_only( |
53 if(TraceReferenceGC && PrintGCDetails) { | |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
54 gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj); |
0 | 55 } |
56 ) | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
57 if (!oopDesc::is_null(heap_oop)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
58 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); |
0 | 59 if (!referent->is_gc_marked() && |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
60 MarkSweep::ref_processor()->discover_reference(obj, ref->reference_type())) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
61 // reference was discovered, referent will be traversed later |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
62 ref->InstanceKlass::oop_follow_contents(obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
63 debug_only( |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
64 if(TraceReferenceGC && PrintGCDetails) { |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
65 gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, (void *)obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
66 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
67 ) |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
68 return; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
69 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
70 // treat referent as normal oop |
0 | 71 debug_only( |
72 if(TraceReferenceGC && PrintGCDetails) { | |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
73 gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, (void *)obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
74 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
75 ) |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
76 MarkSweep::mark_and_push(referent_addr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
77 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
78 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
79 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
80 if (ReferenceProcessor::pending_list_uses_discovered_field()) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
81 // Treat discovered as normal oop, if ref is not "active", |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
82 // i.e. if next is non-NULL. |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
83 T next_oop = oopDesc::load_heap_oop(next_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
84 if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active" |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
85 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
86 debug_only( |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
87 if(TraceReferenceGC && PrintGCDetails) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
88 gclog_or_tty->print_cr(" Process discovered as normal " |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
89 INTPTR_FORMAT, discovered_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
90 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
91 ) |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
92 MarkSweep::mark_and_push(discovered_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
93 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
94 } else { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
95 #ifdef ASSERT |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
96 // In the case of older JDKs which do not use the discovered |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
97 // field for the pending list, an inactive ref (next != NULL) |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
98 // must always have a NULL discovered field. |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
99 oop next = oopDesc::load_decode_heap_oop(next_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
100 oop discovered = java_lang_ref_Reference::discovered(obj); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
101 assert(oopDesc::is_null(next) || oopDesc::is_null(discovered), |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
102 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", |
3929
f94227b6117b
7090259: Fix hotspot sources to build with old compilers
kvn
parents:
3917
diff
changeset
|
103 (oopDesc*)obj)); |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
104 #endif |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
105 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
106 // treat next as normal oop. next is a link in the reference queue. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
107 debug_only( |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
108 if(TraceReferenceGC && PrintGCDetails) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
109 gclog_or_tty->print_cr(" Process next as normal " INTPTR_FORMAT, next_addr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
110 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
111 ) |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
112 MarkSweep::mark_and_push(next_addr); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
113 ref->InstanceKlass::oop_follow_contents(obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
114 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
115 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
116 void InstanceRefKlass::oop_follow_contents(oop obj) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
117 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
118 specialized_oop_follow_contents<narrowOop>(this, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
119 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
120 specialized_oop_follow_contents<oop>(this, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
121 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
122 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
123 |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
124 #if INCLUDE_ALL_GCS |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
125 template <class T> |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
126 void specialized_oop_follow_contents(InstanceRefKlass* ref, |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
948
diff
changeset
|
127 ParCompactionManager* cm, |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
948
diff
changeset
|
128 oop obj) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
129 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
130 T heap_oop = oopDesc::load_heap_oop(referent_addr); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
131 debug_only( |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
132 if(TraceReferenceGC && PrintGCDetails) { |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
133 gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
134 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
135 ) |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
136 if (!oopDesc::is_null(heap_oop)) { |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
137 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
138 if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) && |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
139 PSParallelCompact::ref_processor()-> |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
140 discover_reference(obj, ref->reference_type())) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
141 // reference already enqueued, referent will be traversed later |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
142 ref->InstanceKlass::oop_follow_contents(cm, obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
143 debug_only( |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
144 if(TraceReferenceGC && PrintGCDetails) { |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
145 gclog_or_tty->print_cr(" Non NULL enqueued " INTPTR_FORMAT, (void *)obj); |
0 | 146 } |
147 ) | |
148 return; | |
149 } else { | |
150 // treat referent as normal oop | |
151 debug_only( | |
152 if(TraceReferenceGC && PrintGCDetails) { | |
12316
190899198332
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
8001
diff
changeset
|
153 gclog_or_tty->print_cr(" Non NULL normal " INTPTR_FORMAT, (void *)obj); |
0 | 154 } |
155 ) | |
156 PSParallelCompact::mark_and_push(cm, referent_addr); | |
157 } | |
158 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
159 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
160 if (ReferenceProcessor::pending_list_uses_discovered_field()) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
161 // Treat discovered as normal oop, if ref is not "active", |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
162 // i.e. if next is non-NULL. |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
163 T next_oop = oopDesc::load_heap_oop(next_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
164 if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active" |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
165 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
166 debug_only( |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
167 if(TraceReferenceGC && PrintGCDetails) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
168 gclog_or_tty->print_cr(" Process discovered as normal " |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
169 INTPTR_FORMAT, discovered_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
170 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
171 ) |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
172 PSParallelCompact::mark_and_push(cm, discovered_addr); |
0 | 173 } |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
174 } else { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
175 #ifdef ASSERT |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
176 // In the case of older JDKs which do not use the discovered |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
177 // field for the pending list, an inactive ref (next != NULL) |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
178 // must always have a NULL discovered field. |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
179 T next = oopDesc::load_heap_oop(next_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
180 oop discovered = java_lang_ref_Reference::discovered(obj); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
181 assert(oopDesc::is_null(next) || oopDesc::is_null(discovered), |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
182 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", |
3929
f94227b6117b
7090259: Fix hotspot sources to build with old compilers
kvn
parents:
3917
diff
changeset
|
183 (oopDesc*)obj)); |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
184 #endif |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
185 } |
0 | 186 PSParallelCompact::mark_and_push(cm, next_addr); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
187 ref->InstanceKlass::oop_follow_contents(cm, obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
188 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
189 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
190 void InstanceRefKlass::oop_follow_contents(ParCompactionManager* cm, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
191 oop obj) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
192 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
193 specialized_oop_follow_contents<narrowOop>(this, cm, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
194 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
195 specialized_oop_follow_contents<oop>(this, cm, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
196 } |
0 | 197 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
198 #endif // INCLUDE_ALL_GCS |
0 | 199 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
200 #ifdef ASSERT |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
201 template <class T> void trace_reference_gc(const char *s, oop obj, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
202 T* referent_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
203 T* next_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
204 T* discovered_addr) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
205 if(TraceReferenceGC && PrintGCDetails) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
206 gclog_or_tty->print_cr("%s obj " INTPTR_FORMAT, s, (address)obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
207 gclog_or_tty->print_cr(" referent_addr/* " INTPTR_FORMAT " / " |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
208 INTPTR_FORMAT, referent_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
209 referent_addr ? |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
210 (address)oopDesc::load_decode_heap_oop(referent_addr) : NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
211 gclog_or_tty->print_cr(" next_addr/* " INTPTR_FORMAT " / " |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
212 INTPTR_FORMAT, next_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
213 next_addr ? (address)oopDesc::load_decode_heap_oop(next_addr) : NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
214 gclog_or_tty->print_cr(" discovered_addr/* " INTPTR_FORMAT " / " |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
215 INTPTR_FORMAT, discovered_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
216 discovered_addr ? |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
217 (address)oopDesc::load_decode_heap_oop(discovered_addr) : NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
218 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
219 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
220 #endif |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
221 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
222 template <class T> void specialized_oop_adjust_pointers(InstanceRefKlass *ref, oop obj) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
223 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
224 MarkSweep::adjust_pointer(referent_addr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
225 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
226 MarkSweep::adjust_pointer(next_addr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
227 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
228 MarkSweep::adjust_pointer(discovered_addr); |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
229 debug_only(trace_reference_gc("InstanceRefKlass::oop_adjust_pointers", obj, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
230 referent_addr, next_addr, discovered_addr);) |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
231 } |
0 | 232 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
233 int InstanceRefKlass::oop_adjust_pointers(oop obj) { |
0 | 234 int size = size_helper(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
235 InstanceKlass::oop_adjust_pointers(obj); |
0 | 236 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
237 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
238 specialized_oop_adjust_pointers<narrowOop>(this, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
239 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
240 specialized_oop_adjust_pointers<oop>(this, obj); |
0 | 241 } |
242 return size; | |
243 } | |
244 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
245 #define InstanceRefKlass_SPECIALIZED_OOP_ITERATE(T, nv_suffix, contains) \ |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
246 T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); \ |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
247 if (closure->apply_to_weak_ref_discovered_field()) { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
248 closure->do_oop##nv_suffix(disc_addr); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
249 } \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
250 \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
251 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); \ |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
252 T heap_oop = oopDesc::load_heap_oop(referent_addr); \ |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
253 ReferenceProcessor* rp = closure->_ref_processor; \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
254 if (!oopDesc::is_null(heap_oop)) { \ |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
356
diff
changeset
|
255 oop referent = oopDesc::decode_heap_oop_not_null(heap_oop); \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
256 if (!referent->is_gc_marked() && (rp != NULL) && \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
257 rp->discover_reference(obj, reference_type())) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
258 return size; \ |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
259 } else if (contains(referent_addr)) { \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
260 /* treat referent as normal oop */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
261 SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
262 closure->do_oop##nv_suffix(referent_addr); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
263 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
264 } \ |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
265 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
266 if (ReferenceProcessor::pending_list_uses_discovered_field()) { \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
267 T next_oop = oopDesc::load_heap_oop(next_addr); \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
268 /* Treat discovered as normal oop, if ref is not "active" (next non-NULL) */\ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
269 if (!oopDesc::is_null(next_oop) && contains(disc_addr)) { \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
270 /* i.e. ref is not "active" */ \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
271 debug_only( \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
272 if(TraceReferenceGC && PrintGCDetails) { \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
273 gclog_or_tty->print_cr(" Process discovered as normal " \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
274 INTPTR_FORMAT, disc_addr); \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
275 } \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
276 ) \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
277 SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
278 closure->do_oop##nv_suffix(disc_addr); \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
279 } \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
280 } else { \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
281 /* In the case of older JDKs which do not use the discovered field for */ \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
282 /* the pending list, an inactive ref (next != NULL) must always have a */ \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
283 /* NULL discovered field. */ \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
284 debug_only( \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
285 T next_oop = oopDesc::load_heap_oop(next_addr); \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
286 T disc_oop = oopDesc::load_heap_oop(disc_addr); \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
287 assert(oopDesc::is_null(next_oop) || oopDesc::is_null(disc_oop), \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
288 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL" \ |
3929
f94227b6117b
7090259: Fix hotspot sources to build with old compilers
kvn
parents:
3917
diff
changeset
|
289 "discovered field", (oopDesc*)obj)); \ |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
290 ) \ |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
291 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
292 /* treat next as normal oop */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
293 if (contains(next_addr)) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
294 SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
295 closure->do_oop##nv_suffix(next_addr); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
296 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
297 return size; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 template <class T> bool contains(T *t) { return true; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
301 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
302 // Macro to define InstanceRefKlass::oop_oop_iterate for virtual/nonvirtual for |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
303 // all closures. Macros calling macros above for each oop size. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
304 |
0 | 305 #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ |
306 \ | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
307 int InstanceRefKlass:: \ |
0 | 308 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ |
309 /* Get size before changing pointers */ \ | |
310 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ | |
311 \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
312 int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ |
0 | 313 \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
314 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
315 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
316 } else { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
317 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ |
0 | 318 } \ |
319 } | |
320 | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
321 #if INCLUDE_ALL_GCS |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
322 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
323 \ |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
324 int InstanceRefKlass:: \ |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
325 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
326 /* Get size before changing pointers */ \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
327 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
328 \ |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
329 int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
330 \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
331 if (UseCompressedOops) { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
332 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
333 } else { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
334 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
335 } \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
336 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
337 #endif // INCLUDE_ALL_GCS |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
338 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
339 |
0 | 340 #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ |
341 \ | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
342 int InstanceRefKlass:: \ |
0 | 343 oop_oop_iterate##nv_suffix##_m(oop obj, \ |
344 OopClosureType* closure, \ | |
345 MemRegion mr) { \ | |
346 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ | |
347 \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
348 int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
349 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
350 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
351 } else { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
352 InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, mr.contains); \ |
0 | 353 } \ |
354 } | |
355 | |
356 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
357 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
358 #if INCLUDE_ALL_GCS |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
359 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
360 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
361 #endif // INCLUDE_ALL_GCS |
0 | 362 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
363 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) |
0 | 364 |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
365 #if INCLUDE_ALL_GCS |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
366 template <class T> |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
367 void specialized_oop_push_contents(InstanceRefKlass *ref, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
368 PSPromotionManager* pm, oop obj) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
369 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
370 if (PSScavenge::should_scavenge(referent_addr)) { |
0 | 371 ReferenceProcessor* rp = PSScavenge::reference_processor(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
372 if (rp->discover_reference(obj, ref->reference_type())) { |
0 | 373 // reference already enqueued, referent and next will be traversed later |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
374 ref->InstanceKlass::oop_push_contents(pm, obj); |
0 | 375 return; |
376 } else { | |
377 // treat referent as normal oop | |
378 pm->claim_or_forward_depth(referent_addr); | |
379 } | |
380 } | |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
381 // Treat discovered as normal oop, if ref is not "active", |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
382 // i.e. if next is non-NULL. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
383 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
384 if (ReferenceProcessor::pending_list_uses_discovered_field()) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
385 T next_oop = oopDesc::load_heap_oop(next_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
386 if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active" |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
387 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
388 debug_only( |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
389 if(TraceReferenceGC && PrintGCDetails) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
390 gclog_or_tty->print_cr(" Process discovered as normal " |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
391 INTPTR_FORMAT, discovered_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
392 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
393 ) |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
394 if (PSScavenge::should_scavenge(discovered_addr)) { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
395 pm->claim_or_forward_depth(discovered_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
396 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
397 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
398 } else { |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
399 #ifdef ASSERT |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
400 // In the case of older JDKs which do not use the discovered |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
401 // field for the pending list, an inactive ref (next != NULL) |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
402 // must always have a NULL discovered field. |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
403 oop next = oopDesc::load_decode_heap_oop(next_addr); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
404 oop discovered = java_lang_ref_Reference::discovered(obj); |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
405 assert(oopDesc::is_null(next) || oopDesc::is_null(discovered), |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
406 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", |
3929
f94227b6117b
7090259: Fix hotspot sources to build with old compilers
kvn
parents:
3917
diff
changeset
|
407 (oopDesc*)obj)); |
3917
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
408 #endif |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
409 } |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
410 |
eca1193ca245
4965777: GC changes to support use of discovered field for pending references
ysr
parents:
3377
diff
changeset
|
411 // Treat next as normal oop; next is a link in the reference queue. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
412 if (PSScavenge::should_scavenge(next_addr)) { |
0 | 413 pm->claim_or_forward_depth(next_addr); |
414 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
415 ref->InstanceKlass::oop_push_contents(pm, obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
416 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
417 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
418 void InstanceRefKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
419 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
420 specialized_oop_push_contents<narrowOop>(this, pm, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
421 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
422 specialized_oop_push_contents<oop>(this, pm, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
423 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
424 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
425 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
426 template <class T> |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
427 void specialized_oop_update_pointers(InstanceRefKlass *ref, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
428 ParCompactionManager* cm, oop obj) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
429 T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
430 PSParallelCompact::adjust_pointer(referent_addr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
431 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
432 PSParallelCompact::adjust_pointer(next_addr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
433 T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
434 PSParallelCompact::adjust_pointer(discovered_addr); |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
435 debug_only(trace_reference_gc("InstanceRefKlass::oop_update_ptrs", obj, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
436 referent_addr, next_addr, discovered_addr);) |
0 | 437 } |
438 | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
439 int InstanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
440 InstanceKlass::oop_update_pointers(cm, obj); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
441 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
442 specialized_oop_update_pointers<narrowOop>(this, cm, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
443 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
444 specialized_oop_update_pointers<oop>(this, cm, obj); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
445 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
446 return size_helper(); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
447 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6735
diff
changeset
|
448 #endif // INCLUDE_ALL_GCS |
0 | 449 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
450 void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) { |
0 | 451 // Clear the nonstatic oop-map entries corresponding to referent |
452 // and nextPending field. They are treated specially by the | |
453 // garbage collector. | |
454 // The discovered field is used only by the garbage collector | |
455 // and is also treated specially. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
456 InstanceKlass* ik = InstanceKlass::cast(k); |
0 | 457 |
458 // Check that we have the right class | |
459 debug_only(static bool first_time = true); | |
1142 | 460 assert(k == SystemDictionary::Reference_klass() && first_time, |
0 | 461 "Invalid update of maps"); |
462 debug_only(first_time = false); | |
938 | 463 assert(ik->nonstatic_oop_map_count() == 1, "just checking"); |
0 | 464 |
465 OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); | |
466 | |
467 // Check that the current map is (2,4) - currently points at field with | |
468 // offset 2 (words) and has 4 map entries. | |
469 debug_only(int offset = java_lang_ref_Reference::referent_offset); | |
939
9eebd3ac74cf
6845368: large objects cause a crash or unexpected exception
jcoomes
parents:
938
diff
changeset
|
470 debug_only(unsigned int count = ((java_lang_ref_Reference::discovered_offset - |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
471 java_lang_ref_Reference::referent_offset)/heapOopSize) + 1); |
0 | 472 |
473 if (UseSharedSpaces) { | |
474 assert(map->offset() == java_lang_ref_Reference::queue_offset && | |
938 | 475 map->count() == 1, "just checking"); |
0 | 476 } else { |
938 | 477 assert(map->offset() == offset && map->count() == count, |
0 | 478 "just checking"); |
479 | |
480 // Update map to (3,1) - point to offset of 3 (words) with 1 map entry. | |
481 map->set_offset(java_lang_ref_Reference::queue_offset); | |
938 | 482 map->set_count(1); |
0 | 483 } |
484 } | |
485 | |
486 | |
487 // Verification | |
488 | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
489 void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6108
diff
changeset
|
490 InstanceKlass::oop_verify_on(obj, st); |
0 | 491 // Verify referent field |
492 oop referent = java_lang_ref_Reference::referent(obj); | |
493 | |
494 // We should make this general to all heaps | |
495 GenCollectedHeap* gch = NULL; | |
496 if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) | |
497 gch = GenCollectedHeap::heap(); | |
498 | |
499 if (referent != NULL) { | |
500 guarantee(referent->is_oop(), "referent field heap failed"); | |
501 } | |
502 // Verify next field | |
503 oop next = java_lang_ref_Reference::next(obj); | |
504 if (next != NULL) { | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
505 guarantee(next->is_oop(), "next field verify failed"); |
0 | 506 guarantee(next->is_instanceRef(), "next field verify failed"); |
507 } | |
508 } | |
509 | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
510 bool InstanceRefKlass::owns_pending_list_lock(JavaThread* thread) { |
2025
b03e6b4c7c75
7006471: fix for 6988439 crashes when pending list lock is null
coleenp
parents:
2021
diff
changeset
|
511 if (java_lang_ref_Reference::pending_list_lock() == NULL) return false; |
2021
7cf1a74771e8
6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents:
1972
diff
changeset
|
512 Handle h_lock(thread, java_lang_ref_Reference::pending_list_lock()); |
7cf1a74771e8
6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents:
1972
diff
changeset
|
513 return ObjectSynchronizer::current_thread_holds_lock(thread, h_lock); |
7cf1a74771e8
6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents:
1972
diff
changeset
|
514 } |
7cf1a74771e8
6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents:
1972
diff
changeset
|
515 |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
516 void InstanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) { |
0 | 517 // we may enter this with pending exception set |
518 PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument | |
6108
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
519 |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
520 // Create a HandleMark in case we retry a GC multiple times. |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
521 // Each time we attempt the GC, we allocate the handle below |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
522 // to hold the pending list lock. We want to free this handle. |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
523 HandleMark hm; |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
524 |
0 | 525 Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock()); |
526 ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD); | |
527 assert(ObjectSynchronizer::current_thread_holds_lock( | |
528 JavaThread::current(), h_lock), | |
529 "Locking should have succeeded"); | |
530 if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION; | |
531 } | |
532 | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
533 void InstanceRefKlass::release_and_notify_pending_list_lock( |
0 | 534 BasicLock *pending_list_basic_lock) { |
535 // we may enter this with pending exception set | |
536 PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument | |
6108
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
537 |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
538 // Create a HandleMark in case we retry a GC multiple times. |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
539 // Each time we attempt the GC, we allocate the handle below |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
540 // to hold the pending list lock. We want to free this handle. |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
541 HandleMark hm; |
c52a6a39546c
7158682: G1: Handle leak when running nsk.sysdict tests
johnc
parents:
6008
diff
changeset
|
542 |
0 | 543 Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock()); |
544 assert(ObjectSynchronizer::current_thread_holds_lock( | |
545 JavaThread::current(), h_lock), | |
546 "Lock should be held"); | |
547 // Notify waiters on pending lists lock if there is any reference. | |
548 if (java_lang_ref_Reference::pending_list() != NULL) { | |
549 ObjectSynchronizer::notifyall(h_lock, THREAD); | |
550 } | |
551 ObjectSynchronizer::fast_exit(h_lock(), pending_list_basic_lock, THREAD); | |
552 if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION; | |
553 } |