Mercurial > hg > truffle
annotate src/share/vm/code/dependencies.hpp @ 14586:d2fe05d5cc96
added support for lazy computation of names for use with Debug
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 18 Mar 2014 17:15:06 +0100 |
parents | d8041d695d19 |
children | b51e29501f30 4ca6dc0799b6 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_CODE_DEPENDENCIES_HPP |
26 #define SHARE_VM_CODE_DEPENDENCIES_HPP | |
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 | 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 | 32 #include "code/compressedStream.hpp" |
33 #include "code/nmethod.hpp" | |
34 #include "utilities/growableArray.hpp" | |
14505
524b54a7f1b5
8034839: jvm hangs with gc/gctests/LoadUnloadGC test
anoll
parents:
14262
diff
changeset
|
35 #include "utilities/hashtable.hpp" |
1972 | 36 |
0 | 37 //** 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
|
38 // 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
|
39 // 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
|
40 // 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
|
41 // 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
|
42 // 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
|
43 // as approximate invariants, because we expect them to be overturned |
0 | 44 // very infrequently. We are willing to perform expensive recovery |
45 // operations when they are overturned. The benefit, of course, is | |
46 // performing optimistic optimizations (!) on the object code. | |
47 // | |
48 // Changes in the class hierarchy due to dynamic linking or | |
49 // class evolution can violate dependencies. There is enough | |
50 // indexing between classes and nmethods to make dependency | |
51 // checking reasonably efficient. | |
52 | |
53 class ciEnv; | |
54 class nmethod; | |
55 class OopRecorder; | |
56 class xmlStream; | |
57 class CompileLog; | |
58 class DepChange; | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
59 class KlassDepChange; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
60 class CallSiteDepChange; |
0 | 61 class No_Safepoint_Verifier; |
62 | |
63 class Dependencies: public ResourceObj { | |
64 public: | |
65 // Note: In the comments on dependency types, most uses of the terms | |
66 // subtype and supertype are used in a "non-strict" or "inclusive" | |
67 // sense, and are starred to remind the reader of this fact. | |
68 // Strict uses of the terms use the word "proper". | |
69 // | |
70 // Specifically, every class is its own subtype* and supertype*. | |
71 // (This trick is easier than continually saying things like "Y is a | |
72 // subtype of X or X itself".) | |
73 // | |
74 // Sometimes we write X > Y to mean X is a proper supertype of Y. | |
75 // The notation X > {Y, Z} means X has proper subtypes Y, Z. | |
76 // The notation X.m > Y means that Y inherits m from X, while | |
77 // X.m > Y.m means Y overrides X.m. A star denotes abstractness, | |
78 // as *I > A, meaning (abstract) interface I is a super type of A, | |
79 // or A.*m > B.m, meaning B.m implements abstract method A.m. | |
80 // | |
81 // In this module, the terms "subtype" and "supertype" refer to | |
82 // Java-level reference type conversions, as detected by | |
83 // "instanceof" and performed by "checkcast" operations. The method | |
84 // Klass::is_subtype_of tests these relations. Note that "subtype" | |
85 // is richer than "subclass" (as tested by Klass::is_subclass_of), | |
86 // since it takes account of relations involving interface and array | |
87 // types. | |
88 // | |
89 // To avoid needless complexity, dependencies involving array types | |
90 // are not accepted. If you need to make an assertion about an | |
91 // array type, make the assertion about its corresponding element | |
92 // types. Any assertion that might change about an array type can | |
93 // be converted to an assertion about its element type. | |
94 // | |
95 // Most dependencies are evaluated over a "context type" CX, which | |
96 // stands for the set Subtypes(CX) of every Java type that is a subtype* | |
97 // of CX. When the system loads a new class or interface N, it is | |
98 // responsible for re-evaluating changed dependencies whose context | |
99 // type now includes N, that is, all super types of N. | |
100 // | |
101 enum DepType { | |
102 end_marker = 0, | |
103 | |
104 // An 'evol' dependency simply notes that the contents of the | |
105 // method were used. If it evolves (is replaced), the nmethod | |
106 // must be recompiled. No other dependencies are implied. | |
107 evol_method, | |
108 FIRST_TYPE = evol_method, | |
109 | |
110 // A context type CX is a leaf it if has no proper subtype. | |
111 leaf_type, | |
112 | |
113 // An abstract class CX has exactly one concrete subtype CC. | |
114 abstract_with_unique_concrete_subtype, | |
115 | |
116 // The type CX is purely abstract, with no concrete subtype* at all. | |
117 abstract_with_no_concrete_subtype, | |
118 | |
119 // The concrete CX is free of concrete proper subtypes. | |
120 concrete_with_no_concrete_subtype, | |
121 | |
122 // Given a method M1 and a context class CX, the set MM(CX, M1) of | |
123 // "concrete matching methods" in CX of M1 is the set of every | |
124 // concrete M2 for which it is possible to create an invokevirtual | |
125 // or invokeinterface call site that can reach either M1 or M2. | |
126 // That is, M1 and M2 share a name, signature, and vtable index. | |
127 // We wish to notice when the set MM(CX, M1) is just {M1}, or | |
128 // perhaps a set of two {M1,M2}, and issue dependencies on this. | |
129 | |
130 // The set MM(CX, M1) can be computed by starting with any matching | |
131 // concrete M2 that is inherited into CX, and then walking the | |
132 // subtypes* of CX looking for concrete definitions. | |
133 | |
134 // The parameters to this dependency are the method M1 and the | |
135 // context class CX. M1 must be either inherited in CX or defined | |
136 // in a subtype* of CX. It asserts that MM(CX, M1) is no greater | |
137 // than {M1}. | |
138 unique_concrete_method, // one unique concrete method under CX | |
139 | |
140 // An "exclusive" assertion concerns two methods or subtypes, and | |
141 // declares that there are at most two (or perhaps later N>2) | |
142 // specific items that jointly satisfy the restriction. | |
143 // We list all items explicitly rather than just giving their | |
144 // count, for robustness in the face of complex schema changes. | |
145 | |
146 // A context class CX (which may be either abstract or concrete) | |
147 // has two exclusive concrete subtypes* C1, C2 if every concrete | |
148 // subtype* of CX is either C1 or C2. Note that if neither C1 or C2 | |
149 // are equal to CX, then CX itself must be abstract. But it is | |
150 // also possible (for example) that C1 is CX (a concrete class) | |
151 // and C2 is a proper subtype of C1. | |
152 abstract_with_exclusive_concrete_subtypes_2, | |
153 | |
154 // This dependency asserts that MM(CX, M1) is no greater than {M1,M2}. | |
155 exclusive_concrete_methods_2, | |
156 | |
157 // This dependency asserts that no instances of class or it's | |
158 // subclasses require finalization registration. | |
159 no_finalizable_subclasses, | |
160 | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
161 // 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
|
162 call_site_target_value, |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
163 |
0 | 164 TYPE_LIMIT |
165 }; | |
166 enum { | |
167 LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT)) | |
168 | |
169 // 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
|
170 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
|
171 |
b27c72d69fd1
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
3852
diff
changeset
|
172 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
|
173 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
|
174 |
b27c72d69fd1
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
3852
diff
changeset
|
175 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
|
176 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
|
177 explicit_ctxk_types = all_types & ~(non_ctxk_types | implicit_ctxk_types), |
0 | 178 |
179 max_arg_count = 3, // current maximum number of arguments (incl. ctxk) | |
180 | |
181 // A "context type" is a class or interface that | |
182 // provides context for evaluating a dependency. | |
183 // When present, it is one of the arguments (dep_context_arg). | |
184 // | |
185 // If a dependency does not have a context type, there is a | |
186 // default context, depending on the type of the dependency. | |
187 // This bit signals that a default context has been compressed away. | |
188 default_context_type_bit = (1<<LG2_TYPE_LIMIT) | |
189 }; | |
190 | |
191 static const char* dep_name(DepType dept); | |
192 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
|
193 |
b27c72d69fd1
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
3852
diff
changeset
|
194 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
|
195 |
b27c72d69fd1
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
3852
diff
changeset
|
196 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
|
197 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
|
198 |
b27c72d69fd1
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
3852
diff
changeset
|
199 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
|
200 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
|
201 |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
202 static void check_valid_dependency_type(DepType dept); |
0 | 203 |
7101
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
204 #ifdef GRAAL |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
205 // A Metadata* or object value recorded in an OopRecorder |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
206 class DepValue VALUE_OBJ_CLASS_SPEC { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
207 private: |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
208 // Unique identifier of the value within the associated OopRecorder that |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
209 // encodes both the category of the value (0: invalid, positive: metadata, negative: object) |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
210 // and the index within a category specific array (metadata: index + 1, object: -(index + 1)) |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
211 int _id; |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
212 |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
213 public: |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
214 DepValue() : _id(0) {} |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
215 DepValue(OopRecorder* rec, Metadata* metadata, DepValue* candidate = NULL) { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
216 assert(candidate == NULL || candidate->is_metadata(), "oops"); |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
217 if (candidate != NULL && candidate->as_metadata(rec) == metadata) { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
218 _id = candidate->_id; |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
219 } else { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
220 _id = rec->find_index(metadata) + 1; |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
221 } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
222 } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
223 DepValue(OopRecorder* rec, jobject obj, DepValue* candidate = NULL) { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
224 assert(candidate == NULL || candidate->is_object(), "oops"); |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
225 if (candidate != NULL && candidate->as_object(rec) == obj) { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
226 _id = candidate->_id; |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
227 } else { |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
228 _id = -(rec->find_index(obj) + 1); |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
229 } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
230 } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
231 |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
232 // Used to sort values in ascending order of index() with metadata values preceding object values |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
233 int sort_key() const { return -_id; } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
234 |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
235 bool operator == (const DepValue& other) const { return other._id == _id; } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
236 |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
237 bool is_valid() const { return _id != 0; } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
238 int index() const { assert(is_valid(), "oops"); return _id < 0 ? -(_id + 1) : _id - 1; } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
239 bool is_metadata() const { assert(is_valid(), "oops"); return _id > 0; } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
240 bool is_object() const { assert(is_valid(), "oops"); return _id < 0; } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
241 |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
242 Metadata* as_metadata(OopRecorder* rec) const { assert(is_metadata(), "oops"); return rec->metadata_at(index()); } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
243 Klass* as_klass(OopRecorder* rec) const { assert(as_metadata(rec)->is_klass(), "oops"); return (Klass*) as_metadata(rec); } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
244 Method* as_method(OopRecorder* rec) const { assert(as_metadata(rec)->is_method(), "oops"); return (Method*) as_metadata(rec); } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
245 jobject as_object(OopRecorder* rec) const { assert(is_object(), "oops"); return rec->oop_at(index()); } |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
246 }; |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
247 #endif |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
248 |
0 | 249 private: |
250 // State for writing a new set of dependencies: | |
251 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
|
252 GrowableArray<ciBaseObject*>* _deps[TYPE_LIMIT]; |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
253 #ifdef GRAAL |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
254 bool _using_dep_values; |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
255 GrowableArray<DepValue>* _dep_values[TYPE_LIMIT]; |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
256 #endif |
0 | 257 |
258 static const char* _dep_name[TYPE_LIMIT]; | |
259 static int _dep_args[TYPE_LIMIT]; | |
260 | |
261 static bool dept_in_mask(DepType dept, int mask) { | |
262 return (int)dept >= 0 && dept < TYPE_LIMIT && ((1<<dept) & mask) != 0; | |
263 } | |
264 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
265 bool note_dep_seen(int dept, ciBaseObject* x) { |
0 | 266 assert(dept < BitsPerInt, "oob"); |
267 int x_id = x->ident(); | |
268 assert(_dep_seen != NULL, "deps must be writable"); | |
269 int seen = _dep_seen->at_grow(x_id, 0); | |
270 _dep_seen->at_put(x_id, seen | (1<<dept)); | |
271 // return true if we've already seen dept/x | |
272 return (seen & (1<<dept)) != 0; | |
273 } | |
274 | |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
275 #ifdef GRAAL |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
276 bool note_dep_seen(int dept, DepValue x) { |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
277 assert(dept < BitsPerInt, "oops"); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
278 // place metadata deps at even indexes, object deps at odd indexes |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
279 int x_id = x.is_metadata() ? x.index() * 2 : (x.index() * 2) + 1; |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
280 assert(_dep_seen != NULL, "deps must be writable"); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
281 int seen = _dep_seen->at_grow(x_id, 0); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
282 _dep_seen->at_put(x_id, seen | (1<<dept)); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
283 // return true if we've already seen dept/x |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
284 return (seen & (1<<dept)) != 0; |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
285 } |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
286 #endif |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
287 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
288 bool maybe_merge_ctxk(GrowableArray<ciBaseObject*>* deps, |
0 | 289 int ctxk_i, ciKlass* ctxk); |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
290 #ifdef GRAAL |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
291 bool maybe_merge_ctxk(GrowableArray<DepValue>* deps, |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
292 int ctxk_i, DepValue ctxk); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
293 #endif |
0 | 294 |
295 void sort_all_deps(); | |
296 size_t estimate_size_in_bytes(); | |
297 | |
298 // Initialize _deps, etc. | |
299 void initialize(ciEnv* env); | |
300 | |
301 // State for making a new set of dependencies: | |
302 OopRecorder* _oop_recorder; | |
303 | |
304 // Logging support | |
305 CompileLog* _log; | |
306 | |
307 address _content_bytes; // everything but the oop references, encoded | |
308 size_t _size_in_bytes; | |
309 | |
310 public: | |
311 // Make a new empty dependencies set. | |
312 Dependencies(ciEnv* env) { | |
313 initialize(env); | |
314 } | |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
315 #ifdef GRAAL |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
316 Dependencies(Arena* arena, OopRecorder* oop_recorder); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
317 #endif // GRAAL |
0 | 318 |
319 private: | |
320 // Check for a valid context type. | |
321 // Enforce the restriction against array types. | |
322 static void check_ctxk(ciKlass* ctxk) { | |
323 assert(ctxk->is_instance_klass(), "java types only"); | |
324 } | |
325 static void check_ctxk_concrete(ciKlass* ctxk) { | |
326 assert(is_concrete_klass(ctxk->as_instance_klass()), "must be concrete"); | |
327 } | |
328 static void check_ctxk_abstract(ciKlass* ctxk) { | |
329 check_ctxk(ctxk); | |
330 assert(!is_concrete_klass(ctxk->as_instance_klass()), "must be abstract"); | |
331 } | |
332 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
333 void assert_common_1(DepType dept, ciBaseObject* x); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
334 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
|
335 void assert_common_3(DepType dept, ciKlass* ctxk, ciBaseObject* x1, ciBaseObject* x2); |
0 | 336 |
337 public: | |
338 // Adding assertions to a new dependency set at compile time: | |
339 void assert_evol_method(ciMethod* m); | |
340 void assert_leaf_type(ciKlass* ctxk); | |
341 void assert_abstract_with_unique_concrete_subtype(ciKlass* ctxk, ciKlass* conck); | |
342 void assert_abstract_with_no_concrete_subtype(ciKlass* ctxk); | |
343 void assert_concrete_with_no_concrete_subtype(ciKlass* ctxk); | |
344 void assert_unique_concrete_method(ciKlass* ctxk, ciMethod* uniqm); | |
345 void assert_abstract_with_exclusive_concrete_subtypes(ciKlass* ctxk, ciKlass* k1, ciKlass* k2); | |
346 void assert_exclusive_concrete_methods(ciKlass* ctxk, ciMethod* m1, ciMethod* m2); | |
347 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
|
348 void assert_call_site_target_value(ciCallSite* call_site, ciMethodHandle* method_handle); |
0 | 349 |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
350 #ifdef GRAAL |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
351 private: |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
352 static void check_ctxk(Klass* ctxk) { |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
353 assert(ctxk->oop_is_instance(), "java types only"); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
354 } |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
355 static void check_ctxk_abstract(Klass* ctxk) { |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
356 check_ctxk(ctxk); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
357 assert(ctxk->is_abstract(), "must be abstract"); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
358 } |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
359 void assert_common_1(DepType dept, DepValue x); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
360 void assert_common_2(DepType dept, DepValue x0, DepValue x1); |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
361 |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
362 public: |
7101
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
363 void assert_evol_method(Method* m); |
9012
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
364 void assert_has_no_finalizable_subclasses(Klass* ctxk); |
7101
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
365 void assert_leaf_type(Klass* ctxk); |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
366 void assert_unique_concrete_method(Klass* ctxk, Method* uniqm); |
0778b04fc682
better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents:
7094
diff
changeset
|
367 void assert_abstract_with_unique_concrete_subtype(Klass* ctxk, Klass* conck); |
8947
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7101
diff
changeset
|
368 void assert_call_site_target_value(oop callSite, oop methodHandle); |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
369 #endif // GRAAL |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
6725
diff
changeset
|
370 |
0 | 371 // Define whether a given method or type is concrete. |
372 // These methods define the term "concrete" as used in this module. | |
373 // For this module, an "abstract" class is one which is non-concrete. | |
374 // | |
375 // Future optimizations may allow some classes to remain | |
376 // non-concrete until their first instantiation, and allow some | |
377 // methods to remain non-concrete until their first invocation. | |
378 // In that case, there would be a middle ground between concrete | |
379 // 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
|
380 static bool is_concrete_klass(Klass* k); // k is instantiable |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
381 static bool is_concrete_method(Method* m); // m is invocable |
0 | 382 static Klass* find_finalizable_subclass(Klass* k); |
383 | |
384 // These versions of the concreteness queries work through the CI. | |
385 // The CI versions are allowed to skew sometimes from the VM | |
386 // (oop-based) versions. The cost of such a difference is a | |
387 // (safely) aborted compilation, or a deoptimization, or a missed | |
388 // optimization opportunity. | |
389 // | |
390 // In order to prevent spurious assertions, query results must | |
391 // remain stable within any single ciEnv instance. (I.e., they must | |
392 // not go back into the VM to get their value; they must cache the | |
393 // bit in the CI, either eagerly or lazily.) | |
394 static bool is_concrete_klass(ciInstanceKlass* k); // k appears instantiable | |
395 static bool is_concrete_method(ciMethod* m); // m appears invocable | |
396 static bool has_finalizable_subclass(ciInstanceKlass* k); | |
397 | |
398 // As a general rule, it is OK to compile under the assumption that | |
399 // a given type or method is concrete, even if it at some future | |
400 // point becomes abstract. So dependency checking is one-sided, in | |
401 // that it permits supposedly concrete classes or methods to turn up | |
402 // as really abstract. (This shouldn't happen, except during class | |
403 // evolution, but that's the logic of the checking.) However, if a | |
404 // supposedly abstract class or method suddenly becomes concrete, a | |
405 // dependency on it must fail. | |
406 | |
407 // 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
|
408 static Klass* check_evol_method(Method* m); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
409 static Klass* check_leaf_type(Klass* ctxk); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
410 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
|
411 KlassDepChange* changes = NULL); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
412 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
|
413 KlassDepChange* changes = NULL); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
414 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
|
415 KlassDepChange* changes = NULL); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
416 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
|
417 KlassDepChange* changes = NULL); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
418 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
|
419 KlassDepChange* changes = NULL); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
420 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
|
421 KlassDepChange* changes = NULL); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
422 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
|
423 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
|
424 // 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
|
425 // valid. A non-NULL Klass* is a 'witness' to the assertion |
0 | 426 // failure, a point in the class hierarchy where the assertion has |
427 // been proven false. For example, if check_leaf_type returns | |
428 // non-NULL, the value is a subtype of the supposed leaf type. This | |
429 // witness value may be useful for logging the dependency failure. | |
430 // Note that, when a dependency fails, there may be several possible | |
431 // witnesses to the failure. The value returned from the check_foo | |
432 // method is chosen arbitrarily. | |
433 | |
434 // The 'changes' value, if non-null, requests a limited spot-check | |
435 // near the indicated recent changes in the class hierarchy. | |
436 // It is used by DepStream::spot_check_dependency_at. | |
437 | |
438 // Detecting possible new assertions: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
439 static Klass* find_unique_concrete_subtype(Klass* ctxk); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
440 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
|
441 static int find_exclusive_concrete_subtypes(Klass* ctxk, int klen, Klass* k[]); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
442 static int find_exclusive_concrete_methods(Klass* ctxk, int mlen, Method* m[]); |
0 | 443 |
444 // Create the encoding which will be stored in an nmethod. | |
445 void encode_content_bytes(); | |
446 | |
447 address content_bytes() { | |
448 assert(_content_bytes != NULL, "encode it first"); | |
449 return _content_bytes; | |
450 } | |
451 size_t size_in_bytes() { | |
452 assert(_content_bytes != NULL, "encode it first"); | |
453 return _size_in_bytes; | |
454 } | |
455 | |
456 OopRecorder* oop_recorder() { return _oop_recorder; } | |
457 CompileLog* log() { return _log; } | |
458 | |
459 void copy_to(nmethod* nm); | |
460 | |
461 void log_all_dependencies(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
462 void log_dependency(DepType dept, int nargs, ciBaseObject* args[]) { |
0 | 463 write_dependency_to(log(), dept, nargs, args); |
464 } | |
465 void log_dependency(DepType dept, | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
466 ciBaseObject* x0, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
467 ciBaseObject* x1 = NULL, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
468 ciBaseObject* x2 = NULL) { |
0 | 469 if (log() == NULL) return; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
470 ciBaseObject* args[max_arg_count]; |
0 | 471 args[0] = x0; |
472 args[1] = x1; | |
473 args[2] = x2; | |
474 assert(2 < max_arg_count, ""); | |
475 log_dependency(dept, dep_args(dept), args); | |
476 } | |
477 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
478 class DepArgument : public ResourceObj { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
479 private: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
480 bool _is_oop; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
481 bool _valid; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
482 void* _value; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
483 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
484 DepArgument() : _is_oop(false), _value(NULL), _valid(false) {} |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
485 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
|
486 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
|
487 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
488 bool is_null() const { return _value == NULL; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
489 bool is_oop() const { return _is_oop; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
490 bool is_metadata() const { return !_is_oop; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
491 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
|
492 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
|
493 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
494 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
|
495 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
|
496 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
497 |
0 | 498 static void write_dependency_to(CompileLog* log, |
499 DepType dept, | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
500 int nargs, ciBaseObject* args[], |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
501 Klass* witness = NULL); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
502 static void write_dependency_to(CompileLog* log, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
503 DepType dept, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
504 int nargs, DepArgument args[], |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
505 Klass* witness = NULL); |
0 | 506 static void write_dependency_to(xmlStream* xtty, |
507 DepType dept, | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
508 int nargs, DepArgument args[], |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
509 Klass* witness = NULL); |
0 | 510 static void print_dependency(DepType dept, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
511 int nargs, DepArgument args[], |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
512 Klass* witness = NULL); |
0 | 513 |
514 private: | |
515 // 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
|
516 static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x); |
0 | 517 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
518 static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x); |
0 | 519 |
520 public: | |
521 // Use this to iterate over an nmethod's dependency set. | |
522 // Works on new and old dependency sets. | |
523 // Usage: | |
524 // | |
525 // ; | |
526 // Dependencies::DepType dept; | |
527 // for (Dependencies::DepStream deps(nm); deps.next(); ) { | |
528 // ... | |
529 // } | |
530 // | |
531 // The caller must be in the VM, since oops are not wrapped in handles. | |
532 class DepStream { | |
533 private: | |
534 nmethod* _code; // null if in a compiler thread | |
535 Dependencies* _deps; // null if not in a compiler thread | |
536 CompressedReadStream _bytes; | |
537 #ifdef ASSERT | |
538 size_t _byte_limit; | |
539 #endif | |
540 | |
541 // iteration variables: | |
542 DepType _type; | |
543 int _xi[max_arg_count+1]; | |
544 | |
545 void initial_asserts(size_t byte_limit) NOT_DEBUG({}); | |
546 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
547 inline Metadata* recorded_metadata_at(int i); |
0 | 548 inline oop recorded_oop_at(int i); |
549 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
550 Klass* check_klass_dependency(KlassDepChange* changes); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
551 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
|
552 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
553 void trace_and_log_witness(Klass* witness); |
0 | 554 |
555 public: | |
556 DepStream(Dependencies* deps) | |
557 : _deps(deps), | |
558 _code(NULL), | |
559 _bytes(deps->content_bytes()) | |
560 { | |
561 initial_asserts(deps->size_in_bytes()); | |
562 } | |
563 DepStream(nmethod* code) | |
564 : _deps(NULL), | |
565 _code(code), | |
566 _bytes(code->dependencies_begin()) | |
567 { | |
568 initial_asserts(code->dependencies_size()); | |
569 } | |
570 | |
571 bool next(); | |
572 | |
573 DepType type() { return _type; } | |
14262
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
574 bool has_oop_argument() { return type() == call_site_target_value; } |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
575 uintptr_t get_identifier(int i); |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
576 |
0 | 577 int argument_count() { return dep_args(type()); } |
578 int argument_index(int i) { assert(0 <= i && i < argument_count(), "oob"); | |
579 return _xi[i]; } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
580 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
|
581 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
|
582 Klass* context_type(); |
0 | 583 |
3894
b27c72d69fd1
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
3852
diff
changeset
|
584 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
|
585 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
586 Method* method_argument(int i) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
587 Metadata* x = argument(i); |
0 | 588 assert(x->is_method(), "type"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
589 return (Method*) x; |
0 | 590 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
591 Klass* type_argument(int i) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
592 Metadata* x = argument(i); |
0 | 593 assert(x->is_klass(), "type"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
594 return (Klass*) x; |
0 | 595 } |
596 | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
597 // 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
|
598 Klass* check_dependency() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
599 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
|
600 if (result != NULL) return result; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
601 return check_call_site_dependency(NULL); |
0 | 602 } |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
603 |
0 | 604 // A lighter version: Checks only around recent changes in a class |
605 // hierarchy. (See Universe::flush_dependents_on.) | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
606 Klass* spot_check_dependency_at(DepChange& changes); |
0 | 607 |
608 // 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
|
609 void log_dependency(Klass* witness = NULL); |
0 | 610 |
611 // Print the current dependency to tty. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
612 void print_dependency(Klass* witness = NULL, bool verbose = false); |
0 | 613 }; |
614 friend class Dependencies::DepStream; | |
615 | |
616 static void print_statistics() PRODUCT_RETURN; | |
617 }; | |
618 | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
619 |
14505
524b54a7f1b5
8034839: jvm hangs with gc/gctests/LoadUnloadGC test
anoll
parents:
14262
diff
changeset
|
620 class DependencySignature : public GenericHashtableEntry<DependencySignature, ResourceObj> { |
14262
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
621 private: |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
622 int _args_count; |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
623 uintptr_t _argument_hash[Dependencies::max_arg_count]; |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
624 Dependencies::DepType _type; |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
625 |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
626 public: |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
627 DependencySignature(Dependencies::DepStream& dep) { |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
628 _args_count = dep.argument_count(); |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
629 _type = dep.type(); |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
630 for (int i = 0; i < _args_count; i++) { |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
631 _argument_hash[i] = dep.get_identifier(i); |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
632 } |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
633 } |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
634 |
14505
524b54a7f1b5
8034839: jvm hangs with gc/gctests/LoadUnloadGC test
anoll
parents:
14262
diff
changeset
|
635 bool equals(DependencySignature* sig) const; |
524b54a7f1b5
8034839: jvm hangs with gc/gctests/LoadUnloadGC test
anoll
parents:
14262
diff
changeset
|
636 uintptr_t key() const { return _argument_hash[0] >> 2; } |
14262
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
637 |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
638 int args_count() const { return _args_count; } |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
639 uintptr_t arg(int idx) const { return _argument_hash[idx]; } |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
640 Dependencies::DepType type() const { return _type; } |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
641 }; |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
642 |
3aaa4b9966f6
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
6725
diff
changeset
|
643 |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
644 // Every particular DepChange is a sub-class of this class. |
0 | 645 class DepChange : public StackObj { |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
0
diff
changeset
|
646 public: |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
647 // What kind of DepChange is this? |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
648 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
|
649 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
|
650 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
651 // Subclass casting with assertions. |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
652 KlassDepChange* as_klass_change() { |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
653 assert(is_klass_change(), "bad cast"); |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
654 return (KlassDepChange*) this; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
655 } |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
656 CallSiteDepChange* as_call_site_change() { |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
657 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
|
658 return (CallSiteDepChange*) this; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
659 } |
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 void print(); |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
662 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
663 public: |
0 | 664 enum ChangeType { |
665 NO_CHANGE = 0, // an uninvolved klass | |
666 Change_new_type, // a newly loaded type | |
667 Change_new_sub, // a super with a new subtype | |
668 Change_new_impl, // an interface with a new implementation | |
669 CHANGE_LIMIT, | |
670 Start_Klass = CHANGE_LIMIT // internal indicator for ContextStream | |
671 }; | |
672 | |
673 // Usage: | |
674 // for (DepChange::ContextStream str(changes); str.next(); ) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
675 // Klass* k = str.klass(); |
0 | 676 // switch (str.change_type()) { |
677 // ... | |
678 // } | |
679 // } | |
680 class ContextStream : public StackObj { | |
681 private: | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
0
diff
changeset
|
682 DepChange& _changes; |
0 | 683 friend class DepChange; |
684 | |
685 // iteration variables: | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
0
diff
changeset
|
686 ChangeType _change_type; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
687 Klass* _klass; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
688 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
|
689 int _ti_index; |
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
0
diff
changeset
|
690 int _ti_limit; |
0 | 691 |
692 // start at the beginning: | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
693 void start(); |
0 | 694 |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
0
diff
changeset
|
695 public: |
0 | 696 ContextStream(DepChange& changes) |
697 : _changes(changes) | |
698 { start(); } | |
699 | |
700 ContextStream(DepChange& changes, No_Safepoint_Verifier& nsv) | |
701 : _changes(changes) | |
702 // the nsv argument makes it safe to hold oops like _klass | |
703 { start(); } | |
704 | |
705 bool next(); | |
706 | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
0
diff
changeset
|
707 ChangeType change_type() { return _change_type; } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
708 Klass* klass() { return _klass; } |
0 | 709 }; |
710 friend class DepChange::ContextStream; | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
711 }; |
0 | 712 |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
713 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
714 // 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
|
715 // 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
|
716 // 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
|
717 // 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
|
718 // new type could invalidate. |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
719 class KlassDepChange : public DepChange { |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
720 private: |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
721 // 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
|
722 KlassHandle _new_type; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
723 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
724 void initialize(); |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
725 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
726 public: |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
727 // 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
|
728 KlassDepChange(KlassHandle new_type) |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
729 : _new_type(new_type) |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
730 { |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
731 initialize(); |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
732 } |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
733 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
734 // cleans up the marks |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
735 ~KlassDepChange(); |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
736 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
737 // What kind of DepChange is this? |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
738 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
|
739 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3894
diff
changeset
|
740 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
|
741 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
742 // 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
|
743 bool involves_context(Klass* k); |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
744 }; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
745 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
746 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
747 // A CallSite has changed its target. |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
748 class CallSiteDepChange : public DepChange { |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
749 private: |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
750 Handle _call_site; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
751 Handle _method_handle; |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
752 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
753 public: |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
754 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
|
755 : _call_site(call_site), |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
756 _method_handle(method_handle) |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
757 { |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
758 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
|
759 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
|
760 } |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
761 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
762 // What kind of DepChange is this? |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
763 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
|
764 |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
1972
diff
changeset
|
765 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
|
766 oop method_handle() const { return _method_handle(); } |
0 | 767 }; |
1972 | 768 |
769 #endif // SHARE_VM_CODE_DEPENDENCIES_HPP |