annotate src/share/vm/memory/specialized_oop_closures.hpp @ 17524:89152779163c

Merge with jdk8-b132
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 11:59:32 +0200
parents 4ca6dc0799b6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17524
89152779163c Merge with jdk8-b132
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
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: 342
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "runtime/atomic.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
29 #include "utilities/macros.hpp"
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
30 #if INCLUDE_ALL_GCS
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
32 #endif // INCLUDE_ALL_GCS
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // The following OopClosure types get specialized versions of
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // "oop_oop_iterate" that invoke the closures' do_oop methods
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // non-virtually, using a mechanism defined in this file. Extend these
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // macros in the obvious way to add specializations for new closures.
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // Forward declarations.
a61af66fc99e Initial load
duke
parents:
diff changeset
40 class OopClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 class OopsInGenClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // DefNew
a61af66fc99e Initial load
duke
parents:
diff changeset
43 class ScanClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class FastScanClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 class FilteringClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // ParNew
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class ParScanWithBarrierClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 class ParScanWithoutBarrierClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // CMS
a61af66fc99e Initial load
duke
parents:
diff changeset
50 class MarkRefsIntoAndScanClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 class Par_MarkRefsIntoAndScanClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 class PushAndMarkClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 class Par_PushAndMarkClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 class PushOrMarkClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 class Par_PushOrMarkClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class CMSKeepAliveClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 class CMSInnerParMarkAndPushClosure;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
58 // Misc
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
59 class NoHeaderExtendedOopClosure;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // This macro applies an argument macro to all OopClosures for which we
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // want specialized bodies of "oop_oop_iterate". The arguments to "f" are:
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // "f(closureType, non_virtual)"
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // where "closureType" is the name of the particular subclass of OopClosure,
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // and "non_virtual" will be the string "_nv" if the closure type should
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // have its "do_oop" method invoked non-virtually, or else the
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // string "_v". ("OopClosure" itself will be the only class in the latter
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // category.)
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // This is split into several because of a Visual C++ 6.0 compiler bug
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // where very long macros cause the compiler to crash
a61af66fc99e Initial load
duke
parents:
diff changeset
72
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
73 // Some other heap might define further specialized closures.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
74 #ifndef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
75 #define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
76 /* None */
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
77 #endif
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
78
0
a61af66fc99e Initial load
duke
parents:
diff changeset
79 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
80 f(ScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
81 f(FastScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
82 f(FilteringClosure,_nv)
a61af66fc99e Initial load
duke
parents:
diff changeset
83
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
84 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
86 f(ParScanWithBarrierClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
87 f(ParScanWithoutBarrierClosure,_nv)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
88 #else // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
90 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(f) \
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
93 f(NoHeaderExtendedOopClosure,_nv) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
94 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
95 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)
a61af66fc99e Initial load
duke
parents:
diff changeset
96
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
97 #if INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
98 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
99 f(MarkRefsIntoAndScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
100 f(Par_MarkRefsIntoAndScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
101 f(PushAndMarkClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
102 f(Par_PushAndMarkClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
103 f(PushOrMarkClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
104 f(Par_PushOrMarkClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
105 f(CMSKeepAliveClosure,_nv) \
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
106 f(CMSInnerParMarkAndPushClosure,_nv) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
107 FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
108 #else // INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
109 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
110 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
112
0
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // We separate these out, because sometime the general one has
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // a different definition from the specialized ones, and sometimes it
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // doesn't.
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 #define ALL_OOP_OOP_ITERATE_CLOSURES_1(f) \
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
118 f(ExtendedOopClosure,_v) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
119 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(f)
a61af66fc99e Initial load
duke
parents:
diff changeset
120
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
121 #define ALL_OOP_OOP_ITERATE_CLOSURES_2(f) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
122 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
123
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
124 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // This macro applies an argument macro to all OopClosures for which we
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // want specialized bodies of a family of methods related to
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // "par_oop_iterate". The arguments to f are the same as above.
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // The "root_class" is the most general class to define; this may be
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // "OopClosure" in some applications and "OopsInGenClosure" in others.
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #define SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
132 f(MarkRefsIntoAndScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
133 f(PushAndMarkClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
134 f(Par_MarkRefsIntoAndScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
135 f(Par_PushAndMarkClosure,_nv)
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 #define ALL_PAR_OOP_ITERATE_CLOSURES(f) \
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
138 f(ExtendedOopClosure,_v) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139 SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
140 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // This macro applies an argument macro to all OopClosures for which we
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // want specialized bodies of a family of methods related to
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // "oops_since_save_marks_do". The arguments to f are the same as above.
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // The "root_class" is the most general class to define; this may be
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // "OopClosure" in some applications and "OopsInGenClosure" in others.
a61af66fc99e Initial load
duke
parents:
diff changeset
147
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
148
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
149 // Some other heap might define further specialized closures.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
150 #ifndef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
151 #define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
152 /* None */
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
153 #endif
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
154
0
a61af66fc99e Initial load
duke
parents:
diff changeset
155 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
156 f(ScanClosure,_nv) \
a61af66fc99e Initial load
duke
parents:
diff changeset
157 f(FastScanClosure,_nv)
a61af66fc99e Initial load
duke
parents:
diff changeset
158
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
159 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
160 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
161 f(ParScanWithBarrierClosure,_nv) \
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
162 f(ParScanWithoutBarrierClosure,_nv) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
163 FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
164 #else // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
165 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6831
diff changeset
166 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
169 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
170 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f)
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
173 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(f)
a61af66fc99e Initial load
duke
parents:
diff changeset
174
a61af66fc99e Initial load
duke
parents:
diff changeset
175 // We separate these out, because sometime the general one has
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // a different definition from the specialized ones, and sometimes it
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // doesn't.
a61af66fc99e Initial load
duke
parents:
diff changeset
178 // NOTE: One of the valid criticisms of this
a61af66fc99e Initial load
duke
parents:
diff changeset
179 // specialize-oop_oop_iterate-for-specific-closures idiom is that it is
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // easy to have a silent performance bug: if you fail to de-virtualize,
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // things still work, just slower. The "SpecializationStats" mode is
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // intended to at least make such a failure easy to detect.
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // *Not* using the ALL_SINCE_SAVE_MARKS_CLOSURES(f) macro defined
a61af66fc99e Initial load
duke
parents:
diff changeset
184 // below means that *only* closures for which oop_oop_iterate specializations
a61af66fc99e Initial load
duke
parents:
diff changeset
185 // exist above may be applied to "oops_since_save_marks". That is,
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // this form of the performance bug is caught statically. When you add
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // a definition for the general type, this property goes away.
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // Make sure you test with SpecializationStats to find such bugs
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // when introducing a new closure where you don't want virtual dispatch.
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 #define ALL_SINCE_SAVE_MARKS_CLOSURES(f) \
a61af66fc99e Initial load
duke
parents:
diff changeset
192 f(OopsInGenClosure,_v) \
a61af66fc99e Initial load
duke
parents:
diff changeset
193 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // For keeping stats on effectiveness.
a61af66fc99e Initial load
duke
parents:
diff changeset
196 #define ENABLE_SPECIALIZATION_STATS 0
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 class SpecializationStats {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
201 enum Kind {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
202 ik, // InstanceKlass
6735
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
203 irk, // InstanceRefKlass
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6735
diff changeset
204 oa, // ObjArrayKlass
0
a61af66fc99e Initial load
duke
parents:
diff changeset
205 NUM_Kinds
a61af66fc99e Initial load
duke
parents:
diff changeset
206 };
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 #if ENABLE_SPECIALIZATION_STATS
a61af66fc99e Initial load
duke
parents:
diff changeset
209 private:
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
210 static bool _init;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
211 static bool _wrapped;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
212 static jint _numCallsAll;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
213
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
214 static jint _numCallsTotal[NUM_Kinds];
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
215 static jint _numCalls_nv[NUM_Kinds];
0
a61af66fc99e Initial load
duke
parents:
diff changeset
216
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
217 static jint _numDoOopCallsTotal[NUM_Kinds];
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
218 static jint _numDoOopCalls_nv[NUM_Kinds];
0
a61af66fc99e Initial load
duke
parents:
diff changeset
219 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
220 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
221 static void clear() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 static inline void record_call() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
224 static inline void record_iterate_call_v(Kind k) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
225 static inline void record_iterate_call_nv(Kind k) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
226 static inline void record_do_oop_call_v(Kind k) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
227 static inline void record_do_oop_call_nv(Kind k) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 static void print() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
230 };
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
233 #if ENABLE_SPECIALIZATION_STATS
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 inline void SpecializationStats::record_call() {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
236 Atomic::inc(&_numCallsAll);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
237 }
a61af66fc99e Initial load
duke
parents:
diff changeset
238 inline void SpecializationStats::record_iterate_call_v(Kind k) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
239 Atomic::inc(&_numCallsTotal[k]);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 inline void SpecializationStats::record_iterate_call_nv(Kind k) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
242 Atomic::inc(&_numCallsTotal[k]);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
243 Atomic::inc(&_numCalls_nv[k]);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 inline void SpecializationStats::record_do_oop_call_v(Kind k) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
247 Atomic::inc(&_numDoOopCallsTotal[k]);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 inline void SpecializationStats::record_do_oop_call_nv(Kind k) {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
250 Atomic::inc(&_numDoOopCallsTotal[k]);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
251 Atomic::inc(&_numDoOopCalls_nv[k]);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254 #else // !ENABLE_SPECIALIZATION_STATS
a61af66fc99e Initial load
duke
parents:
diff changeset
255
a61af66fc99e Initial load
duke
parents:
diff changeset
256 inline void SpecializationStats::record_call() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
257 inline void SpecializationStats::record_iterate_call_v(Kind k) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
258 inline void SpecializationStats::record_iterate_call_nv(Kind k) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
259 inline void SpecializationStats::record_do_oop_call_v(Kind k) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
260 inline void SpecializationStats::record_do_oop_call_nv(Kind k) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
261 inline void SpecializationStats::clear() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
262 inline void SpecializationStats::print() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 #endif // ENABLE_SPECIALIZATION_STATS
a61af66fc99e Initial load
duke
parents:
diff changeset
265 #endif // !PRODUCT
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
266
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
267 #endif // SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP