annotate src/share/vm/code/dependencies.hpp @ 21828:7622232b7efa

Merge
author asaha
date Wed, 17 Dec 2014 09:10:57 -0800
parents d5b74c583ec1 c4f1e23c4139
children 12dcf5ba8b34
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
20785
9906d432d6db 8064524: Compiler code generation improvements
drchase
parents: 6725
diff changeset
2 * Copyright (c) 2005, 2014, 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: 1123
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1123
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: 1123
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_CODE_DEPENDENCIES_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_CODE_DEPENDENCIES_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
28 #include "ci/ciCallSite.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "ci/ciKlass.hpp"
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
30 #include "ci/ciMethodHandle.hpp"
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
31 #include "classfile/systemDictionary.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "code/compressedStream.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "code/nmethod.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "utilities/growableArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35
0
a61af66fc99e Initial load
duke
parents:
diff changeset
36 //** Dependencies represent assertions (approximate invariants) within
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
37 // the runtime system, e.g. class hierarchy changes. An example is an
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
38 // assertion that a given method is not overridden; another example is
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
39 // that a type has only one concrete subtype. Compiled code which
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
40 // relies on such assertions must be discarded if they are overturned
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
41 // by changes in the runtime system. We can think of these assertions
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
42 // as approximate invariants, because we expect them to be overturned
0
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // very infrequently. We are willing to perform expensive recovery
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // operations when they are overturned. The benefit, of course, is
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // performing optimistic optimizations (!) on the object code.
a61af66fc99e Initial load
duke
parents:
diff changeset
46 //
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // Changes in the class hierarchy due to dynamic linking or
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // class evolution can violate dependencies. There is enough
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // indexing between classes and nmethods to make dependency
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // checking reasonably efficient.
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 class ciEnv;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 class nmethod;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 class OopRecorder;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 class xmlStream;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class CompileLog;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 class DepChange;
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
58 class KlassDepChange;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
59 class CallSiteDepChange;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
60 class No_Safepoint_Verifier;
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 class Dependencies: public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Note: In the comments on dependency types, most uses of the terms
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // subtype and supertype are used in a "non-strict" or "inclusive"
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // sense, and are starred to remind the reader of this fact.
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Strict uses of the terms use the word "proper".
a61af66fc99e Initial load
duke
parents:
diff changeset
68 //
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // Specifically, every class is its own subtype* and supertype*.
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // (This trick is easier than continually saying things like "Y is a
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // subtype of X or X itself".)
a61af66fc99e Initial load
duke
parents:
diff changeset
72 //
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Sometimes we write X > Y to mean X is a proper supertype of Y.
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // The notation X > {Y, Z} means X has proper subtypes Y, Z.
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // The notation X.m > Y means that Y inherits m from X, while
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // X.m > Y.m means Y overrides X.m. A star denotes abstractness,
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // as *I > A, meaning (abstract) interface I is a super type of A,
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // or A.*m > B.m, meaning B.m implements abstract method A.m.
a61af66fc99e Initial load
duke
parents:
diff changeset
79 //
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // In this module, the terms "subtype" and "supertype" refer to
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // Java-level reference type conversions, as detected by
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // "instanceof" and performed by "checkcast" operations. The method
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // Klass::is_subtype_of tests these relations. Note that "subtype"
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // is richer than "subclass" (as tested by Klass::is_subclass_of),
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // since it takes account of relations involving interface and array
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // types.
a61af66fc99e Initial load
duke
parents:
diff changeset
87 //
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // To avoid needless complexity, dependencies involving array types
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // are not accepted. If you need to make an assertion about an
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // array type, make the assertion about its corresponding element
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // types. Any assertion that might change about an array type can
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // be converted to an assertion about its element type.
a61af66fc99e Initial load
duke
parents:
diff changeset
93 //
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // Most dependencies are evaluated over a "context type" CX, which
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // stands for the set Subtypes(CX) of every Java type that is a subtype*
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // of CX. When the system loads a new class or interface N, it is
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // responsible for re-evaluating changed dependencies whose context
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // type now includes N, that is, all super types of N.
a61af66fc99e Initial load
duke
parents:
diff changeset
99 //
a61af66fc99e Initial load
duke
parents:
diff changeset
100 enum DepType {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 end_marker = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // An 'evol' dependency simply notes that the contents of the
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // method were used. If it evolves (is replaced), the nmethod
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // must be recompiled. No other dependencies are implied.
a61af66fc99e Initial load
duke
parents:
diff changeset
106 evol_method,
a61af66fc99e Initial load
duke
parents:
diff changeset
107 FIRST_TYPE = evol_method,
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // A context type CX is a leaf it if has no proper subtype.
a61af66fc99e Initial load
duke
parents:
diff changeset
110 leaf_type,
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // An abstract class CX has exactly one concrete subtype CC.
a61af66fc99e Initial load
duke
parents:
diff changeset
113 abstract_with_unique_concrete_subtype,
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // The type CX is purely abstract, with no concrete subtype* at all.
a61af66fc99e Initial load
duke
parents:
diff changeset
116 abstract_with_no_concrete_subtype,
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // The concrete CX is free of concrete proper subtypes.
a61af66fc99e Initial load
duke
parents:
diff changeset
119 concrete_with_no_concrete_subtype,
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Given a method M1 and a context class CX, the set MM(CX, M1) of
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // "concrete matching methods" in CX of M1 is the set of every
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // concrete M2 for which it is possible to create an invokevirtual
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // or invokeinterface call site that can reach either M1 or M2.
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // That is, M1 and M2 share a name, signature, and vtable index.
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // We wish to notice when the set MM(CX, M1) is just {M1}, or
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // perhaps a set of two {M1,M2}, and issue dependencies on this.
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // The set MM(CX, M1) can be computed by starting with any matching
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // concrete M2 that is inherited into CX, and then walking the
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // subtypes* of CX looking for concrete definitions.
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // The parameters to this dependency are the method M1 and the
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // context class CX. M1 must be either inherited in CX or defined
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // in a subtype* of CX. It asserts that MM(CX, M1) is no greater
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // than {M1}.
a61af66fc99e Initial load
duke
parents:
diff changeset
137 unique_concrete_method, // one unique concrete method under CX
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // An "exclusive" assertion concerns two methods or subtypes, and
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // declares that there are at most two (or perhaps later N>2)
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // specific items that jointly satisfy the restriction.
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // We list all items explicitly rather than just giving their
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // count, for robustness in the face of complex schema changes.
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // A context class CX (which may be either abstract or concrete)
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // has two exclusive concrete subtypes* C1, C2 if every concrete
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // subtype* of CX is either C1 or C2. Note that if neither C1 or C2
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // are equal to CX, then CX itself must be abstract. But it is
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // also possible (for example) that C1 is CX (a concrete class)
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // and C2 is a proper subtype of C1.
a61af66fc99e Initial load
duke
parents:
diff changeset
151 abstract_with_exclusive_concrete_subtypes_2,
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // This dependency asserts that MM(CX, M1) is no greater than {M1,M2}.
a61af66fc99e Initial load
duke
parents:
diff changeset
154 exclusive_concrete_methods_2,
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // This dependency asserts that no instances of class or it's
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // subclasses require finalization registration.
a61af66fc99e Initial load
duke
parents:
diff changeset
158 no_finalizable_subclasses,
a61af66fc99e Initial load
duke
parents:
diff changeset
159
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
160 // This dependency asserts when the CallSite.target value changed.
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
161 call_site_target_value,
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
162
0
a61af66fc99e Initial load
duke
parents:
diff changeset
163 TYPE_LIMIT
a61af66fc99e Initial load
duke
parents:
diff changeset
164 };
a61af66fc99e Initial load
duke
parents:
diff changeset
165 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
166 LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT))
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 // handy categorizations of dependency types:
3894
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
169 all_types = ((1 << TYPE_LIMIT) - 1) & ((-1) << FIRST_TYPE),
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
170
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
171 non_klass_types = (1 << call_site_target_value),
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
172 klass_types = all_types & ~non_klass_types,
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
173
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
174 non_ctxk_types = (1 << evol_method),
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
175 implicit_ctxk_types = (1 << call_site_target_value),
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
176 explicit_ctxk_types = all_types & ~(non_ctxk_types | implicit_ctxk_types),
0
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 max_arg_count = 3, // current maximum number of arguments (incl. ctxk)
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // A "context type" is a class or interface that
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // provides context for evaluating a dependency.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // When present, it is one of the arguments (dep_context_arg).
a61af66fc99e Initial load
duke
parents:
diff changeset
183 //
a61af66fc99e Initial load
duke
parents:
diff changeset
184 // If a dependency does not have a context type, there is a
a61af66fc99e Initial load
duke
parents:
diff changeset
185 // default context, depending on the type of the dependency.
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // This bit signals that a default context has been compressed away.
a61af66fc99e Initial load
duke
parents:
diff changeset
187 default_context_type_bit = (1<<LG2_TYPE_LIMIT)
a61af66fc99e Initial load
duke
parents:
diff changeset
188 };
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 static const char* dep_name(DepType dept);
a61af66fc99e Initial load
duke
parents:
diff changeset
191 static int dep_args(DepType dept);
3894
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
192
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
193 static bool is_klass_type( DepType dept) { return dept_in_mask(dept, klass_types ); }
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
194
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
195 static bool has_explicit_context_arg(DepType dept) { return dept_in_mask(dept, explicit_ctxk_types); }
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
196 static bool has_implicit_context_arg(DepType dept) { return dept_in_mask(dept, implicit_ctxk_types); }
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
197
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
198 static int dep_context_arg(DepType dept) { return has_explicit_context_arg(dept) ? 0 : -1; }
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
199 static int dep_implicit_context_arg(DepType dept) { return has_implicit_context_arg(dept) ? 0 : -1; }
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
200
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
201 static void check_valid_dependency_type(DepType dept);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
204 // State for writing a new set of dependencies:
a61af66fc99e Initial load
duke
parents:
diff changeset
205 GrowableArray<int>* _dep_seen; // (seen[h->ident] & (1<<dept))
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
206 GrowableArray<ciBaseObject*>* _deps[TYPE_LIMIT];
0
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 static const char* _dep_name[TYPE_LIMIT];
a61af66fc99e Initial load
duke
parents:
diff changeset
209 static int _dep_args[TYPE_LIMIT];
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 static bool dept_in_mask(DepType dept, int mask) {
a61af66fc99e Initial load
duke
parents:
diff changeset
212 return (int)dept >= 0 && dept < TYPE_LIMIT && ((1<<dept) & mask) != 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
213 }
a61af66fc99e Initial load
duke
parents:
diff changeset
214
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
215 bool note_dep_seen(int dept, ciBaseObject* x) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
216 assert(dept < BitsPerInt, "oob");
a61af66fc99e Initial load
duke
parents:
diff changeset
217 int x_id = x->ident();
a61af66fc99e Initial load
duke
parents:
diff changeset
218 assert(_dep_seen != NULL, "deps must be writable");
a61af66fc99e Initial load
duke
parents:
diff changeset
219 int seen = _dep_seen->at_grow(x_id, 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 _dep_seen->at_put(x_id, seen | (1<<dept));
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // return true if we've already seen dept/x
a61af66fc99e Initial load
duke
parents:
diff changeset
222 return (seen & (1<<dept)) != 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
225 bool maybe_merge_ctxk(GrowableArray<ciBaseObject*>* deps,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
226 int ctxk_i, ciKlass* ctxk);
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 void sort_all_deps();
a61af66fc99e Initial load
duke
parents:
diff changeset
229 size_t estimate_size_in_bytes();
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // Initialize _deps, etc.
a61af66fc99e Initial load
duke
parents:
diff changeset
232 void initialize(ciEnv* env);
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // State for making a new set of dependencies:
a61af66fc99e Initial load
duke
parents:
diff changeset
235 OopRecorder* _oop_recorder;
a61af66fc99e Initial load
duke
parents:
diff changeset
236
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // Logging support
a61af66fc99e Initial load
duke
parents:
diff changeset
238 CompileLog* _log;
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 address _content_bytes; // everything but the oop references, encoded
a61af66fc99e Initial load
duke
parents:
diff changeset
241 size_t _size_in_bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // Make a new empty dependencies set.
a61af66fc99e Initial load
duke
parents:
diff changeset
245 Dependencies(ciEnv* env) {
a61af66fc99e Initial load
duke
parents:
diff changeset
246 initialize(env);
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // Check for a valid context type.
a61af66fc99e Initial load
duke
parents:
diff changeset
251 // Enforce the restriction against array types.
a61af66fc99e Initial load
duke
parents:
diff changeset
252 static void check_ctxk(ciKlass* ctxk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
253 assert(ctxk->is_instance_klass(), "java types only");
a61af66fc99e Initial load
duke
parents:
diff changeset
254 }
a61af66fc99e Initial load
duke
parents:
diff changeset
255 static void check_ctxk_concrete(ciKlass* ctxk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 assert(is_concrete_klass(ctxk->as_instance_klass()), "must be concrete");
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 static void check_ctxk_abstract(ciKlass* ctxk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 check_ctxk(ctxk);
a61af66fc99e Initial load
duke
parents:
diff changeset
260 assert(!is_concrete_klass(ctxk->as_instance_klass()), "must be abstract");
a61af66fc99e Initial load
duke
parents:
diff changeset
261 }
a61af66fc99e Initial load
duke
parents:
diff changeset
262
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
263 void assert_common_1(DepType dept, ciBaseObject* x);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
264 void assert_common_2(DepType dept, ciBaseObject* x0, ciBaseObject* x1);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
265 void assert_common_3(DepType dept, ciKlass* ctxk, ciBaseObject* x1, ciBaseObject* x2);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
268 // Adding assertions to a new dependency set at compile time:
a61af66fc99e Initial load
duke
parents:
diff changeset
269 void assert_evol_method(ciMethod* m);
a61af66fc99e Initial load
duke
parents:
diff changeset
270 void assert_leaf_type(ciKlass* ctxk);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 void assert_abstract_with_unique_concrete_subtype(ciKlass* ctxk, ciKlass* conck);
a61af66fc99e Initial load
duke
parents:
diff changeset
272 void assert_abstract_with_no_concrete_subtype(ciKlass* ctxk);
a61af66fc99e Initial load
duke
parents:
diff changeset
273 void assert_concrete_with_no_concrete_subtype(ciKlass* ctxk);
a61af66fc99e Initial load
duke
parents:
diff changeset
274 void assert_unique_concrete_method(ciKlass* ctxk, ciMethod* uniqm);
a61af66fc99e Initial load
duke
parents:
diff changeset
275 void assert_abstract_with_exclusive_concrete_subtypes(ciKlass* ctxk, ciKlass* k1, ciKlass* k2);
a61af66fc99e Initial load
duke
parents:
diff changeset
276 void assert_exclusive_concrete_methods(ciKlass* ctxk, ciMethod* m1, ciMethod* m2);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 void assert_has_no_finalizable_subclasses(ciKlass* ctxk);
3894
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
278 void assert_call_site_target_value(ciCallSite* call_site, ciMethodHandle* method_handle);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
279
a61af66fc99e Initial load
duke
parents:
diff changeset
280 // Define whether a given method or type is concrete.
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // These methods define the term "concrete" as used in this module.
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // For this module, an "abstract" class is one which is non-concrete.
a61af66fc99e Initial load
duke
parents:
diff changeset
283 //
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // Future optimizations may allow some classes to remain
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // non-concrete until their first instantiation, and allow some
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // methods to remain non-concrete until their first invocation.
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // In that case, there would be a middle ground between concrete
a61af66fc99e Initial load
duke
parents:
diff changeset
288 // and abstract (as defined by the Java language and VM).
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
289 static bool is_concrete_klass(Klass* k); // k is instantiable
20785
9906d432d6db 8064524: Compiler code generation improvements
drchase
parents: 6725
diff changeset
290 static bool is_concrete_method(Method* m, Klass* k); // m is invocable
0
a61af66fc99e Initial load
duke
parents:
diff changeset
291 static Klass* find_finalizable_subclass(Klass* k);
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 // These versions of the concreteness queries work through the CI.
a61af66fc99e Initial load
duke
parents:
diff changeset
294 // The CI versions are allowed to skew sometimes from the VM
a61af66fc99e Initial load
duke
parents:
diff changeset
295 // (oop-based) versions. The cost of such a difference is a
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // (safely) aborted compilation, or a deoptimization, or a missed
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // optimization opportunity.
a61af66fc99e Initial load
duke
parents:
diff changeset
298 //
a61af66fc99e Initial load
duke
parents:
diff changeset
299 // In order to prevent spurious assertions, query results must
a61af66fc99e Initial load
duke
parents:
diff changeset
300 // remain stable within any single ciEnv instance. (I.e., they must
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // not go back into the VM to get their value; they must cache the
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // bit in the CI, either eagerly or lazily.)
a61af66fc99e Initial load
duke
parents:
diff changeset
303 static bool is_concrete_klass(ciInstanceKlass* k); // k appears instantiable
a61af66fc99e Initial load
duke
parents:
diff changeset
304 static bool has_finalizable_subclass(ciInstanceKlass* k);
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // As a general rule, it is OK to compile under the assumption that
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // a given type or method is concrete, even if it at some future
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // point becomes abstract. So dependency checking is one-sided, in
a61af66fc99e Initial load
duke
parents:
diff changeset
309 // that it permits supposedly concrete classes or methods to turn up
a61af66fc99e Initial load
duke
parents:
diff changeset
310 // as really abstract. (This shouldn't happen, except during class
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // evolution, but that's the logic of the checking.) However, if a
a61af66fc99e Initial load
duke
parents:
diff changeset
312 // supposedly abstract class or method suddenly becomes concrete, a
a61af66fc99e Initial load
duke
parents:
diff changeset
313 // dependency on it must fail.
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 // Checking old assertions at run-time (in the VM only):
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
316 static Klass* check_evol_method(Method* m);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
317 static Klass* check_leaf_type(Klass* ctxk);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
318 static Klass* check_abstract_with_unique_concrete_subtype(Klass* ctxk, Klass* conck,
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
319 KlassDepChange* changes = NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
320 static Klass* check_abstract_with_no_concrete_subtype(Klass* ctxk,
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
321 KlassDepChange* changes = NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
322 static Klass* check_concrete_with_no_concrete_subtype(Klass* ctxk,
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
323 KlassDepChange* changes = NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
324 static Klass* check_unique_concrete_method(Klass* ctxk, Method* uniqm,
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
325 KlassDepChange* changes = NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
326 static Klass* check_abstract_with_exclusive_concrete_subtypes(Klass* ctxk, Klass* k1, Klass* k2,
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
327 KlassDepChange* changes = NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
328 static Klass* check_exclusive_concrete_methods(Klass* ctxk, Method* m1, Method* m2,
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
329 KlassDepChange* changes = NULL);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
330 static Klass* check_has_no_finalizable_subclasses(Klass* ctxk, KlassDepChange* changes = NULL);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
331 static Klass* check_call_site_target_value(oop call_site, oop method_handle, CallSiteDepChange* changes = NULL);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
332 // A returned Klass* is NULL if the dependency assertion is still
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
333 // valid. A non-NULL Klass* is a 'witness' to the assertion
0
a61af66fc99e Initial load
duke
parents:
diff changeset
334 // failure, a point in the class hierarchy where the assertion has
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // been proven false. For example, if check_leaf_type returns
a61af66fc99e Initial load
duke
parents:
diff changeset
336 // non-NULL, the value is a subtype of the supposed leaf type. This
a61af66fc99e Initial load
duke
parents:
diff changeset
337 // witness value may be useful for logging the dependency failure.
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // Note that, when a dependency fails, there may be several possible
a61af66fc99e Initial load
duke
parents:
diff changeset
339 // witnesses to the failure. The value returned from the check_foo
a61af66fc99e Initial load
duke
parents:
diff changeset
340 // method is chosen arbitrarily.
a61af66fc99e Initial load
duke
parents:
diff changeset
341
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // The 'changes' value, if non-null, requests a limited spot-check
a61af66fc99e Initial load
duke
parents:
diff changeset
343 // near the indicated recent changes in the class hierarchy.
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // It is used by DepStream::spot_check_dependency_at.
a61af66fc99e Initial load
duke
parents:
diff changeset
345
a61af66fc99e Initial load
duke
parents:
diff changeset
346 // Detecting possible new assertions:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
347 static Klass* find_unique_concrete_subtype(Klass* ctxk);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
348 static Method* find_unique_concrete_method(Klass* ctxk, Method* m);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
349 static int find_exclusive_concrete_subtypes(Klass* ctxk, int klen, Klass* k[]);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
350
a61af66fc99e Initial load
duke
parents:
diff changeset
351 // Create the encoding which will be stored in an nmethod.
a61af66fc99e Initial load
duke
parents:
diff changeset
352 void encode_content_bytes();
a61af66fc99e Initial load
duke
parents:
diff changeset
353
a61af66fc99e Initial load
duke
parents:
diff changeset
354 address content_bytes() {
a61af66fc99e Initial load
duke
parents:
diff changeset
355 assert(_content_bytes != NULL, "encode it first");
a61af66fc99e Initial load
duke
parents:
diff changeset
356 return _content_bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
357 }
a61af66fc99e Initial load
duke
parents:
diff changeset
358 size_t size_in_bytes() {
a61af66fc99e Initial load
duke
parents:
diff changeset
359 assert(_content_bytes != NULL, "encode it first");
a61af66fc99e Initial load
duke
parents:
diff changeset
360 return _size_in_bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
361 }
a61af66fc99e Initial load
duke
parents:
diff changeset
362
a61af66fc99e Initial load
duke
parents:
diff changeset
363 OopRecorder* oop_recorder() { return _oop_recorder; }
a61af66fc99e Initial load
duke
parents:
diff changeset
364 CompileLog* log() { return _log; }
a61af66fc99e Initial load
duke
parents:
diff changeset
365
a61af66fc99e Initial load
duke
parents:
diff changeset
366 void copy_to(nmethod* nm);
a61af66fc99e Initial load
duke
parents:
diff changeset
367
a61af66fc99e Initial load
duke
parents:
diff changeset
368 void log_all_dependencies();
20316
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
369
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
370 void log_dependency(DepType dept, GrowableArray<ciBaseObject*>* args) {
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
371 ResourceMark rm;
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
372 int argslen = args->length();
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
373 write_dependency_to(log(), dept, args);
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
374 guarantee(argslen == args->length(),
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
375 "args array cannot grow inside nested ResoureMark scope");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
376 }
20316
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
377
0
a61af66fc99e Initial load
duke
parents:
diff changeset
378 void log_dependency(DepType dept,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
379 ciBaseObject* x0,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
380 ciBaseObject* x1 = NULL,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
381 ciBaseObject* x2 = NULL) {
20316
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
382 if (log() == NULL) {
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
383 return;
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
384 }
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
385 ResourceMark rm;
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
386 GrowableArray<ciBaseObject*>* ciargs =
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
387 new GrowableArray<ciBaseObject*>(dep_args(dept));
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
388 assert (x0 != NULL, "no log x0");
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
389 ciargs->push(x0);
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
390
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
391 if (x1 != NULL) {
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
392 ciargs->push(x1);
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
393 }
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
394 if (x2 != NULL) {
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
395 ciargs->push(x2);
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
396 }
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
397 assert(ciargs->length() == dep_args(dept), "");
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
398 log_dependency(dept, ciargs);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
399 }
a61af66fc99e Initial load
duke
parents:
diff changeset
400
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
401 class DepArgument : public ResourceObj {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
402 private:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
403 bool _is_oop;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
404 bool _valid;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
405 void* _value;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
406 public:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
407 DepArgument() : _is_oop(false), _value(NULL), _valid(false) {}
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
408 DepArgument(oop v): _is_oop(true), _value(v), _valid(true) {}
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
409 DepArgument(Metadata* v): _is_oop(false), _value(v), _valid(true) {}
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
410
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
411 bool is_null() const { return _value == NULL; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
412 bool is_oop() const { return _is_oop; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
413 bool is_metadata() const { return !_is_oop; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
414 bool is_klass() const { return is_metadata() && metadata_value()->is_klass(); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
415 bool is_method() const { return is_metadata() && metadata_value()->is_method(); }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
416
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
417 oop oop_value() const { assert(_is_oop && _valid, "must be"); return (oop) _value; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
418 Metadata* metadata_value() const { assert(!_is_oop && _valid, "must be"); return (Metadata*) _value; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
419 };
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
420
0
a61af66fc99e Initial load
duke
parents:
diff changeset
421 static void print_dependency(DepType dept,
20316
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
422 GrowableArray<DepArgument>* args,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
423 Klass* witness = NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
424
a61af66fc99e Initial load
duke
parents:
diff changeset
425 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
426 // helper for encoding common context types as zero:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
427 static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
428
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
429 static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
430
20316
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
431 static void write_dependency_to(CompileLog* log,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
432 DepType dept,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
433 GrowableArray<ciBaseObject*>* args,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
434 Klass* witness = NULL);
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
435 static void write_dependency_to(CompileLog* log,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
436 DepType dept,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
437 GrowableArray<DepArgument>* args,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
438 Klass* witness = NULL);
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
439 static void write_dependency_to(xmlStream* xtty,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
440 DepType dept,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
441 GrowableArray<DepArgument>* args,
3c048df3ef8b 8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents: 6725
diff changeset
442 Klass* witness = NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
443 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
444 // Use this to iterate over an nmethod's dependency set.
a61af66fc99e Initial load
duke
parents:
diff changeset
445 // Works on new and old dependency sets.
a61af66fc99e Initial load
duke
parents:
diff changeset
446 // Usage:
a61af66fc99e Initial load
duke
parents:
diff changeset
447 //
a61af66fc99e Initial load
duke
parents:
diff changeset
448 // ;
a61af66fc99e Initial load
duke
parents:
diff changeset
449 // Dependencies::DepType dept;
a61af66fc99e Initial load
duke
parents:
diff changeset
450 // for (Dependencies::DepStream deps(nm); deps.next(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
451 // ...
a61af66fc99e Initial load
duke
parents:
diff changeset
452 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
453 //
a61af66fc99e Initial load
duke
parents:
diff changeset
454 // The caller must be in the VM, since oops are not wrapped in handles.
a61af66fc99e Initial load
duke
parents:
diff changeset
455 class DepStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
456 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
457 nmethod* _code; // null if in a compiler thread
a61af66fc99e Initial load
duke
parents:
diff changeset
458 Dependencies* _deps; // null if not in a compiler thread
a61af66fc99e Initial load
duke
parents:
diff changeset
459 CompressedReadStream _bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
460 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
461 size_t _byte_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
462 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
463
a61af66fc99e Initial load
duke
parents:
diff changeset
464 // iteration variables:
a61af66fc99e Initial load
duke
parents:
diff changeset
465 DepType _type;
a61af66fc99e Initial load
duke
parents:
diff changeset
466 int _xi[max_arg_count+1];
a61af66fc99e Initial load
duke
parents:
diff changeset
467
a61af66fc99e Initial load
duke
parents:
diff changeset
468 void initial_asserts(size_t byte_limit) NOT_DEBUG({});
a61af66fc99e Initial load
duke
parents:
diff changeset
469
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
470 inline Metadata* recorded_metadata_at(int i);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
471 inline oop recorded_oop_at(int i);
a61af66fc99e Initial load
duke
parents:
diff changeset
472
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
473 Klass* check_klass_dependency(KlassDepChange* changes);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
474 Klass* check_call_site_dependency(CallSiteDepChange* changes);
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
475
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
476 void trace_and_log_witness(Klass* witness);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
477
a61af66fc99e Initial load
duke
parents:
diff changeset
478 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
479 DepStream(Dependencies* deps)
a61af66fc99e Initial load
duke
parents:
diff changeset
480 : _deps(deps),
a61af66fc99e Initial load
duke
parents:
diff changeset
481 _code(NULL),
a61af66fc99e Initial load
duke
parents:
diff changeset
482 _bytes(deps->content_bytes())
a61af66fc99e Initial load
duke
parents:
diff changeset
483 {
a61af66fc99e Initial load
duke
parents:
diff changeset
484 initial_asserts(deps->size_in_bytes());
a61af66fc99e Initial load
duke
parents:
diff changeset
485 }
a61af66fc99e Initial load
duke
parents:
diff changeset
486 DepStream(nmethod* code)
a61af66fc99e Initial load
duke
parents:
diff changeset
487 : _deps(NULL),
a61af66fc99e Initial load
duke
parents:
diff changeset
488 _code(code),
a61af66fc99e Initial load
duke
parents:
diff changeset
489 _bytes(code->dependencies_begin())
a61af66fc99e Initial load
duke
parents:
diff changeset
490 {
a61af66fc99e Initial load
duke
parents:
diff changeset
491 initial_asserts(code->dependencies_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
492 }
a61af66fc99e Initial load
duke
parents:
diff changeset
493
a61af66fc99e Initial load
duke
parents:
diff changeset
494 bool next();
a61af66fc99e Initial load
duke
parents:
diff changeset
495
a61af66fc99e Initial load
duke
parents:
diff changeset
496 DepType type() { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
497 int argument_count() { return dep_args(type()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
498 int argument_index(int i) { assert(0 <= i && i < argument_count(), "oob");
a61af66fc99e Initial load
duke
parents:
diff changeset
499 return _xi[i]; }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
500 Metadata* argument(int i); // => recorded_oop_at(argument_index(i))
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
501 oop argument_oop(int i); // => recorded_oop_at(argument_index(i))
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
502 Klass* context_type();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
503
3894
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
504 bool is_klass_type() { return Dependencies::is_klass_type(type()); }
b27c72d69fd1 7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents: 3852
diff changeset
505
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
506 Method* method_argument(int i) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
507 Metadata* x = argument(i);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
508 assert(x->is_method(), "type");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
509 return (Method*) x;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
510 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
511 Klass* type_argument(int i) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
512 Metadata* x = argument(i);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
513 assert(x->is_klass(), "type");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
514 return (Klass*) x;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
515 }
a61af66fc99e Initial load
duke
parents:
diff changeset
516
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
517 // The point of the whole exercise: Is this dep still OK?
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
518 Klass* check_dependency() {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
519 Klass* result = check_klass_dependency(NULL);
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
520 if (result != NULL) return result;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
521 return check_call_site_dependency(NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
522 }
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
523
0
a61af66fc99e Initial load
duke
parents:
diff changeset
524 // A lighter version: Checks only around recent changes in a class
a61af66fc99e Initial load
duke
parents:
diff changeset
525 // hierarchy. (See Universe::flush_dependents_on.)
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
526 Klass* spot_check_dependency_at(DepChange& changes);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
527
a61af66fc99e Initial load
duke
parents:
diff changeset
528 // Log the current dependency to xtty or compilation log.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
529 void log_dependency(Klass* witness = NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
530
a61af66fc99e Initial load
duke
parents:
diff changeset
531 // Print the current dependency to tty.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
532 void print_dependency(Klass* witness = NULL, bool verbose = false);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
533 };
a61af66fc99e Initial load
duke
parents:
diff changeset
534 friend class Dependencies::DepStream;
a61af66fc99e Initial load
duke
parents:
diff changeset
535
a61af66fc99e Initial load
duke
parents:
diff changeset
536 static void print_statistics() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
537 };
a61af66fc99e Initial load
duke
parents:
diff changeset
538
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
539
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
540 // Every particular DepChange is a sub-class of this class.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
541 class DepChange : public StackObj {
1123
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
542 public:
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
543 // What kind of DepChange is this?
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
544 virtual bool is_klass_change() const { return false; }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
545 virtual bool is_call_site_change() const { return false; }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
546
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
547 // Subclass casting with assertions.
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
548 KlassDepChange* as_klass_change() {
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
549 assert(is_klass_change(), "bad cast");
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
550 return (KlassDepChange*) this;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
551 }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
552 CallSiteDepChange* as_call_site_change() {
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
553 assert(is_call_site_change(), "bad cast");
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
554 return (CallSiteDepChange*) this;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
555 }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
556
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
557 void print();
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
558
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
559 public:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
560 enum ChangeType {
a61af66fc99e Initial load
duke
parents:
diff changeset
561 NO_CHANGE = 0, // an uninvolved klass
a61af66fc99e Initial load
duke
parents:
diff changeset
562 Change_new_type, // a newly loaded type
a61af66fc99e Initial load
duke
parents:
diff changeset
563 Change_new_sub, // a super with a new subtype
a61af66fc99e Initial load
duke
parents:
diff changeset
564 Change_new_impl, // an interface with a new implementation
a61af66fc99e Initial load
duke
parents:
diff changeset
565 CHANGE_LIMIT,
a61af66fc99e Initial load
duke
parents:
diff changeset
566 Start_Klass = CHANGE_LIMIT // internal indicator for ContextStream
a61af66fc99e Initial load
duke
parents:
diff changeset
567 };
a61af66fc99e Initial load
duke
parents:
diff changeset
568
a61af66fc99e Initial load
duke
parents:
diff changeset
569 // Usage:
a61af66fc99e Initial load
duke
parents:
diff changeset
570 // for (DepChange::ContextStream str(changes); str.next(); ) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
571 // Klass* k = str.klass();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
572 // switch (str.change_type()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
573 // ...
a61af66fc99e Initial load
duke
parents:
diff changeset
574 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
575 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
576 class ContextStream : public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
577 private:
1123
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
578 DepChange& _changes;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
579 friend class DepChange;
a61af66fc99e Initial load
duke
parents:
diff changeset
580
a61af66fc99e Initial load
duke
parents:
diff changeset
581 // iteration variables:
1123
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
582 ChangeType _change_type;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
583 Klass* _klass;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
584 Array<Klass*>* _ti_base; // i.e., transitive_interfaces
1123
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
585 int _ti_index;
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
586 int _ti_limit;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
587
a61af66fc99e Initial load
duke
parents:
diff changeset
588 // start at the beginning:
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
589 void start();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
590
1123
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
591 public:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
592 ContextStream(DepChange& changes)
a61af66fc99e Initial load
duke
parents:
diff changeset
593 : _changes(changes)
a61af66fc99e Initial load
duke
parents:
diff changeset
594 { start(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
595
a61af66fc99e Initial load
duke
parents:
diff changeset
596 ContextStream(DepChange& changes, No_Safepoint_Verifier& nsv)
a61af66fc99e Initial load
duke
parents:
diff changeset
597 : _changes(changes)
a61af66fc99e Initial load
duke
parents:
diff changeset
598 // the nsv argument makes it safe to hold oops like _klass
a61af66fc99e Initial load
duke
parents:
diff changeset
599 { start(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
600
a61af66fc99e Initial load
duke
parents:
diff changeset
601 bool next();
a61af66fc99e Initial load
duke
parents:
diff changeset
602
1123
167c2986d91b 6843629: Make current hotspot build part of jdk5 control build
phh
parents: 0
diff changeset
603 ChangeType change_type() { return _change_type; }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
604 Klass* klass() { return _klass; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
605 };
a61af66fc99e Initial load
duke
parents:
diff changeset
606 friend class DepChange::ContextStream;
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
607 };
0
a61af66fc99e Initial load
duke
parents:
diff changeset
608
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
609
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
610 // A class hierarchy change coming through the VM (under the Compile_lock).
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
611 // The change is structured as a single new type with any number of supers
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
612 // and implemented interface types. Other than the new type, any of the
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
613 // super types can be context types for a relevant dependency, which the
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
614 // new type could invalidate.
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
615 class KlassDepChange : public DepChange {
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
616 private:
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
617 // each change set is rooted in exactly one new type (at present):
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
618 KlassHandle _new_type;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
619
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
620 void initialize();
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
621
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
622 public:
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
623 // notes the new type, marks it and all its super-types
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
624 KlassDepChange(KlassHandle new_type)
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
625 : _new_type(new_type)
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
626 {
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
627 initialize();
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
628 }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
629
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
630 // cleans up the marks
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
631 ~KlassDepChange();
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
632
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
633 // What kind of DepChange is this?
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
634 virtual bool is_klass_change() const { return true; }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
635
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
636 Klass* new_type() { return _new_type(); }
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
637
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
638 // involves_context(k) is true if k is new_type or any of the super types
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3894
diff changeset
639 bool involves_context(Klass* k);
3852
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
640 };
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
641
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
642
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
643 // A CallSite has changed its target.
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
644 class CallSiteDepChange : public DepChange {
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
645 private:
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
646 Handle _call_site;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
647 Handle _method_handle;
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
648
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
649 public:
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
650 CallSiteDepChange(Handle call_site, Handle method_handle)
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
651 : _call_site(call_site),
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
652 _method_handle(method_handle)
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
653 {
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
654 assert(_call_site() ->is_a(SystemDictionary::CallSite_klass()), "must be");
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
655 assert(_method_handle()->is_a(SystemDictionary::MethodHandle_klass()), "must be");
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
656 }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
657
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
658 // What kind of DepChange is this?
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
659 virtual bool is_call_site_change() const { return true; }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
660
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
661 oop call_site() const { return _call_site(); }
fdb992d83a87 7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents: 1972
diff changeset
662 oop method_handle() const { return _method_handle(); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
663 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
664
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
665 #endif // SHARE_VM_CODE_DEPENDENCIES_HPP