author | dholmes |
Sat, 23 Jun 2018 01:32:41 -0400 | |
changeset 50735 | 2f2af62dfac7 |
parent 49902 | 3661f31c6df4 |
child 54721 | 3661ad97da8f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49192
6734eeef4283
8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
kbarrett
parents:
48299
diff
changeset
|
2 |
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4754
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4754
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4754
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/ciArrayKlass.hpp" |
|
27 |
#include "ci/ciEnv.hpp" |
|
28 |
#include "ci/ciKlass.hpp" |
|
29 |
#include "ci/ciMethod.hpp" |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28514
diff
changeset
|
30 |
#include "classfile/javaClasses.inline.hpp" |
7397 | 31 |
#include "code/dependencies.hpp" |
32 |
#include "compiler/compileLog.hpp" |
|
48299
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
33 |
#include "compiler/compileBroker.hpp" |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
34 |
#include "compiler/compileTask.hpp" |
37248 | 35 |
#include "memory/resourceArea.hpp" |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
49902
diff
changeset
|
36 |
#include "oops/klass.hpp" |
7397 | 37 |
#include "oops/oop.inline.hpp" |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
38 |
#include "oops/objArrayKlass.hpp" |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
39 |
#include "runtime/flags/flagSetting.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
40 |
#include "runtime/handles.hpp" |
7397 | 41 |
#include "runtime/handles.inline.hpp" |
49192
6734eeef4283
8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
kbarrett
parents:
48299
diff
changeset
|
42 |
#include "runtime/jniHandles.inline.hpp" |
24351
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
23187
diff
changeset
|
43 |
#include "runtime/thread.inline.hpp" |
7397 | 44 |
#include "utilities/copy.hpp" |
1 | 45 |
|
46 |
||
47 |
#ifdef ASSERT |
|
48 |
static bool must_be_in_vm() { |
|
49 |
Thread* thread = Thread::current(); |
|
50 |
if (thread->is_Java_thread()) |
|
51 |
return ((JavaThread*)thread)->thread_state() == _thread_in_vm; |
|
52 |
else |
|
53 |
return true; //something like this: thread->is_VM_thread(); |
|
54 |
} |
|
55 |
#endif //ASSERT |
|
56 |
||
57 |
void Dependencies::initialize(ciEnv* env) { |
|
58 |
Arena* arena = env->arena(); |
|
59 |
_oop_recorder = env->oop_recorder(); |
|
60 |
_log = env->log(); |
|
61 |
_dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0); |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
62 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
63 |
_using_dep_values = false; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
64 |
#endif |
1 | 65 |
DEBUG_ONLY(_deps[end_marker] = NULL); |
66 |
for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
67 |
_deps[i] = new(arena) GrowableArray<ciBaseObject*>(arena, 10, 0, 0); |
1 | 68 |
} |
69 |
_content_bytes = NULL; |
|
70 |
_size_in_bytes = (size_t)-1; |
|
71 |
||
72 |
assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT), "sanity"); |
|
73 |
} |
|
74 |
||
75 |
void Dependencies::assert_evol_method(ciMethod* m) { |
|
76 |
assert_common_1(evol_method, m); |
|
77 |
} |
|
78 |
||
79 |
void Dependencies::assert_leaf_type(ciKlass* ctxk) { |
|
80 |
if (ctxk->is_array_klass()) { |
|
81 |
// As a special case, support this assertion on an array type, |
|
82 |
// which reduces to an assertion on its element type. |
|
83 |
// Note that this cannot be done with assertions that |
|
84 |
// relate to concreteness or abstractness. |
|
85 |
ciType* elemt = ctxk->as_array_klass()->base_element_type(); |
|
86 |
if (!elemt->is_instance_klass()) return; // Ex: int[][] |
|
87 |
ctxk = elemt->as_instance_klass(); |
|
88 |
//if (ctxk->is_final()) return; // Ex: String[][] |
|
89 |
} |
|
90 |
check_ctxk(ctxk); |
|
91 |
assert_common_1(leaf_type, ctxk); |
|
92 |
} |
|
93 |
||
94 |
void Dependencies::assert_abstract_with_unique_concrete_subtype(ciKlass* ctxk, ciKlass* conck) { |
|
95 |
check_ctxk_abstract(ctxk); |
|
96 |
assert_common_2(abstract_with_unique_concrete_subtype, ctxk, conck); |
|
97 |
} |
|
98 |
||
99 |
void Dependencies::assert_abstract_with_no_concrete_subtype(ciKlass* ctxk) { |
|
100 |
check_ctxk_abstract(ctxk); |
|
101 |
assert_common_1(abstract_with_no_concrete_subtype, ctxk); |
|
102 |
} |
|
103 |
||
104 |
void Dependencies::assert_concrete_with_no_concrete_subtype(ciKlass* ctxk) { |
|
105 |
check_ctxk_concrete(ctxk); |
|
106 |
assert_common_1(concrete_with_no_concrete_subtype, ctxk); |
|
107 |
} |
|
108 |
||
109 |
void Dependencies::assert_unique_concrete_method(ciKlass* ctxk, ciMethod* uniqm) { |
|
110 |
check_ctxk(ctxk); |
|
111 |
assert_common_2(unique_concrete_method, ctxk, uniqm); |
|
112 |
} |
|
113 |
||
114 |
void Dependencies::assert_abstract_with_exclusive_concrete_subtypes(ciKlass* ctxk, ciKlass* k1, ciKlass* k2) { |
|
115 |
check_ctxk(ctxk); |
|
116 |
assert_common_3(abstract_with_exclusive_concrete_subtypes_2, ctxk, k1, k2); |
|
117 |
} |
|
118 |
||
119 |
void Dependencies::assert_exclusive_concrete_methods(ciKlass* ctxk, ciMethod* m1, ciMethod* m2) { |
|
120 |
check_ctxk(ctxk); |
|
121 |
assert_common_3(exclusive_concrete_methods_2, ctxk, m1, m2); |
|
122 |
} |
|
123 |
||
124 |
void Dependencies::assert_has_no_finalizable_subclasses(ciKlass* ctxk) { |
|
125 |
check_ctxk(ctxk); |
|
126 |
assert_common_1(no_finalizable_subclasses, ctxk); |
|
127 |
} |
|
128 |
||
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
129 |
void Dependencies::assert_call_site_target_value(ciCallSite* call_site, ciMethodHandle* method_handle) { |
31037
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30296
diff
changeset
|
130 |
assert_common_2(call_site_target_value, call_site, method_handle); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
131 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
132 |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
133 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
134 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
135 |
Dependencies::Dependencies(Arena* arena, OopRecorder* oop_recorder, CompileLog* log) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
136 |
_oop_recorder = oop_recorder; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
137 |
_log = log; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
138 |
_dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
139 |
_using_dep_values = true; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
140 |
DEBUG_ONLY(_dep_values[end_marker] = NULL); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
141 |
for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
142 |
_dep_values[i] = new(arena) GrowableArray<DepValue>(arena, 10, 0, DepValue()); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
143 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
144 |
_content_bytes = NULL; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
145 |
_size_in_bytes = (size_t)-1; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
146 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
147 |
assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT), "sanity"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
148 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
149 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
150 |
void Dependencies::assert_evol_method(Method* m) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
151 |
assert_common_1(evol_method, DepValue(_oop_recorder, m)); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
152 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
153 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
154 |
void Dependencies::assert_has_no_finalizable_subclasses(Klass* ctxk) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
155 |
check_ctxk(ctxk); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
156 |
assert_common_1(no_finalizable_subclasses, DepValue(_oop_recorder, ctxk)); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
157 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
158 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
159 |
void Dependencies::assert_leaf_type(Klass* ctxk) { |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
160 |
if (ctxk->is_array_klass()) { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
161 |
// As a special case, support this assertion on an array type, |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
162 |
// which reduces to an assertion on its element type. |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
163 |
// Note that this cannot be done with assertions that |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
164 |
// relate to concreteness or abstractness. |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
165 |
BasicType elemt = ArrayKlass::cast(ctxk)->element_type(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
166 |
if (is_java_primitive(elemt)) return; // Ex: int[][] |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
167 |
ctxk = ObjArrayKlass::cast(ctxk)->bottom_klass(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
168 |
//if (ctxk->is_final()) return; // Ex: String[][] |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
169 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
170 |
check_ctxk(ctxk); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
171 |
assert_common_1(leaf_type, DepValue(_oop_recorder, ctxk)); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
172 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
173 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
174 |
void Dependencies::assert_abstract_with_unique_concrete_subtype(Klass* ctxk, Klass* conck) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
175 |
check_ctxk_abstract(ctxk); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
176 |
DepValue ctxk_dv(_oop_recorder, ctxk); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
177 |
DepValue conck_dv(_oop_recorder, conck, &ctxk_dv); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
178 |
assert_common_2(abstract_with_unique_concrete_subtype, ctxk_dv, conck_dv); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
179 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
180 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
181 |
void Dependencies::assert_unique_concrete_method(Klass* ctxk, Method* uniqm) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
182 |
check_ctxk(ctxk); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
183 |
assert_common_2(unique_concrete_method, DepValue(_oop_recorder, ctxk), DepValue(_oop_recorder, uniqm)); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
184 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
185 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
186 |
void Dependencies::assert_call_site_target_value(oop call_site, oop method_handle) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
187 |
assert_common_2(call_site_target_value, DepValue(_oop_recorder, JNIHandles::make_local(call_site)), DepValue(_oop_recorder, JNIHandles::make_local(method_handle))); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
188 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
189 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
190 |
#endif // INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
191 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
192 |
|
1 | 193 |
// Helper function. If we are adding a new dep. under ctxk2, |
194 |
// try to find an old dep. under a broader* ctxk1. If there is |
|
195 |
// |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
196 |
bool Dependencies::maybe_merge_ctxk(GrowableArray<ciBaseObject*>* deps, |
1 | 197 |
int ctxk_i, ciKlass* ctxk2) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
198 |
ciKlass* ctxk1 = deps->at(ctxk_i)->as_metadata()->as_klass(); |
1 | 199 |
if (ctxk2->is_subtype_of(ctxk1)) { |
200 |
return true; // success, and no need to change |
|
201 |
} else if (ctxk1->is_subtype_of(ctxk2)) { |
|
202 |
// new context class fully subsumes previous one |
|
203 |
deps->at_put(ctxk_i, ctxk2); |
|
204 |
return true; |
|
205 |
} else { |
|
206 |
return false; |
|
207 |
} |
|
208 |
} |
|
209 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
210 |
void Dependencies::assert_common_1(DepType dept, ciBaseObject* x) { |
1 | 211 |
assert(dep_args(dept) == 1, "sanity"); |
212 |
log_dependency(dept, x); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
213 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
1 | 214 |
|
215 |
// see if the same (or a similar) dep is already recorded |
|
216 |
if (note_dep_seen(dept, x)) { |
|
217 |
assert(deps->find(x) >= 0, "sanity"); |
|
218 |
} else { |
|
219 |
deps->append(x); |
|
220 |
} |
|
221 |
} |
|
222 |
||
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
223 |
void Dependencies::assert_common_2(DepType dept, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
224 |
ciBaseObject* x0, ciBaseObject* x1) { |
1 | 225 |
assert(dep_args(dept) == 2, "sanity"); |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
226 |
log_dependency(dept, x0, x1); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
227 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
1 | 228 |
|
229 |
// see if the same (or a similar) dep is already recorded |
|
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
230 |
bool has_ctxk = has_explicit_context_arg(dept); |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
231 |
if (has_ctxk) { |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
232 |
assert(dep_context_arg(dept) == 0, "sanity"); |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
233 |
if (note_dep_seen(dept, x1)) { |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
234 |
// look in this bucket for redundant assertions |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
235 |
const int stride = 2; |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
236 |
for (int i = deps->length(); (i -= stride) >= 0; ) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
237 |
ciBaseObject* y1 = deps->at(i+1); |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
238 |
if (x1 == y1) { // same subject; check the context |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
239 |
if (maybe_merge_ctxk(deps, i+0, x0->as_metadata()->as_klass())) { |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
240 |
return; |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
241 |
} |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
242 |
} |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
243 |
} |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
244 |
} |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
245 |
} else { |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
246 |
if (note_dep_seen(dept, x0) && note_dep_seen(dept, x1)) { |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
247 |
// look in this bucket for redundant assertions |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
248 |
const int stride = 2; |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
249 |
for (int i = deps->length(); (i -= stride) >= 0; ) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
250 |
ciBaseObject* y0 = deps->at(i+0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
251 |
ciBaseObject* y1 = deps->at(i+1); |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
252 |
if (x0 == y0 && x1 == y1) { |
1 | 253 |
return; |
254 |
} |
|
255 |
} |
|
256 |
} |
|
257 |
} |
|
258 |
||
259 |
// append the assertion in the correct bucket: |
|
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
260 |
deps->append(x0); |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
261 |
deps->append(x1); |
1 | 262 |
} |
263 |
||
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
264 |
void Dependencies::assert_common_3(DepType dept, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
265 |
ciKlass* ctxk, ciBaseObject* x, ciBaseObject* x2) { |
1 | 266 |
assert(dep_context_arg(dept) == 0, "sanity"); |
267 |
assert(dep_args(dept) == 3, "sanity"); |
|
268 |
log_dependency(dept, ctxk, x, x2); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
269 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
1 | 270 |
|
271 |
// try to normalize an unordered pair: |
|
272 |
bool swap = false; |
|
273 |
switch (dept) { |
|
274 |
case abstract_with_exclusive_concrete_subtypes_2: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
275 |
swap = (x->ident() > x2->ident() && x->as_metadata()->as_klass() != ctxk); |
1 | 276 |
break; |
277 |
case exclusive_concrete_methods_2: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
278 |
swap = (x->ident() > x2->ident() && x->as_metadata()->as_method()->holder() != ctxk); |
1 | 279 |
break; |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
280 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
281 |
break; |
1 | 282 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
283 |
if (swap) { ciBaseObject* t = x; x = x2; x2 = t; } |
1 | 284 |
|
285 |
// see if the same (or a similar) dep is already recorded |
|
286 |
if (note_dep_seen(dept, x) && note_dep_seen(dept, x2)) { |
|
287 |
// look in this bucket for redundant assertions |
|
288 |
const int stride = 3; |
|
289 |
for (int i = deps->length(); (i -= stride) >= 0; ) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
290 |
ciBaseObject* y = deps->at(i+1); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
291 |
ciBaseObject* y2 = deps->at(i+2); |
1 | 292 |
if (x == y && x2 == y2) { // same subjects; check the context |
293 |
if (maybe_merge_ctxk(deps, i+0, ctxk)) { |
|
294 |
return; |
|
295 |
} |
|
296 |
} |
|
297 |
} |
|
298 |
} |
|
299 |
// append the assertion in the correct bucket: |
|
300 |
deps->append(ctxk); |
|
301 |
deps->append(x); |
|
302 |
deps->append(x2); |
|
303 |
} |
|
304 |
||
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
305 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
306 |
bool Dependencies::maybe_merge_ctxk(GrowableArray<DepValue>* deps, |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
307 |
int ctxk_i, DepValue ctxk2_dv) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
308 |
Klass* ctxk1 = deps->at(ctxk_i).as_klass(_oop_recorder); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
309 |
Klass* ctxk2 = ctxk2_dv.as_klass(_oop_recorder); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
310 |
if (ctxk2->is_subtype_of(ctxk1)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
311 |
return true; // success, and no need to change |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
312 |
} else if (ctxk1->is_subtype_of(ctxk2)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
313 |
// new context class fully subsumes previous one |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
314 |
deps->at_put(ctxk_i, ctxk2_dv); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
315 |
return true; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
316 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
317 |
return false; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
318 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
319 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
320 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
321 |
void Dependencies::assert_common_1(DepType dept, DepValue x) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
322 |
assert(dep_args(dept) == 1, "sanity"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
323 |
//log_dependency(dept, x); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
324 |
GrowableArray<DepValue>* deps = _dep_values[dept]; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
325 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
326 |
// see if the same (or a similar) dep is already recorded |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
327 |
if (note_dep_seen(dept, x)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
328 |
assert(deps->find(x) >= 0, "sanity"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
329 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
330 |
deps->append(x); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
331 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
332 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
333 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
334 |
void Dependencies::assert_common_2(DepType dept, |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
335 |
DepValue x0, DepValue x1) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
336 |
assert(dep_args(dept) == 2, "sanity"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
337 |
//log_dependency(dept, x0, x1); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
338 |
GrowableArray<DepValue>* deps = _dep_values[dept]; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
339 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
340 |
// see if the same (or a similar) dep is already recorded |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
341 |
bool has_ctxk = has_explicit_context_arg(dept); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
342 |
if (has_ctxk) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
343 |
assert(dep_context_arg(dept) == 0, "sanity"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
344 |
if (note_dep_seen(dept, x1)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
345 |
// look in this bucket for redundant assertions |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
346 |
const int stride = 2; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
347 |
for (int i = deps->length(); (i -= stride) >= 0; ) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
348 |
DepValue y1 = deps->at(i+1); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
349 |
if (x1 == y1) { // same subject; check the context |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
350 |
if (maybe_merge_ctxk(deps, i+0, x0)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
351 |
return; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
352 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
353 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
354 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
355 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
356 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
357 |
if (note_dep_seen(dept, x0) && note_dep_seen(dept, x1)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
358 |
// look in this bucket for redundant assertions |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
359 |
const int stride = 2; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
360 |
for (int i = deps->length(); (i -= stride) >= 0; ) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
361 |
DepValue y0 = deps->at(i+0); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
362 |
DepValue y1 = deps->at(i+1); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
363 |
if (x0 == y0 && x1 == y1) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
364 |
return; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
365 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
366 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
367 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
368 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
369 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
370 |
// append the assertion in the correct bucket: |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
371 |
deps->append(x0); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
372 |
deps->append(x1); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
373 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
374 |
#endif // INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
375 |
|
1 | 376 |
/// Support for encoding dependencies into an nmethod: |
377 |
||
378 |
void Dependencies::copy_to(nmethod* nm) { |
|
379 |
address beg = nm->dependencies_begin(); |
|
380 |
address end = nm->dependencies_end(); |
|
381 |
guarantee(end - beg >= (ptrdiff_t) size_in_bytes(), "bad sizing"); |
|
382 |
Copy::disjoint_words((HeapWord*) content_bytes(), |
|
383 |
(HeapWord*) beg, |
|
384 |
size_in_bytes() / sizeof(HeapWord)); |
|
385 |
assert(size_in_bytes() % sizeof(HeapWord) == 0, "copy by words"); |
|
386 |
} |
|
387 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
388 |
static int sort_dep(ciBaseObject** p1, ciBaseObject** p2, int narg) { |
1 | 389 |
for (int i = 0; i < narg; i++) { |
390 |
int diff = p1[i]->ident() - p2[i]->ident(); |
|
391 |
if (diff != 0) return diff; |
|
392 |
} |
|
393 |
return 0; |
|
394 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
395 |
static int sort_dep_arg_1(ciBaseObject** p1, ciBaseObject** p2) |
1 | 396 |
{ return sort_dep(p1, p2, 1); } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
397 |
static int sort_dep_arg_2(ciBaseObject** p1, ciBaseObject** p2) |
1 | 398 |
{ return sort_dep(p1, p2, 2); } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
399 |
static int sort_dep_arg_3(ciBaseObject** p1, ciBaseObject** p2) |
1 | 400 |
{ return sort_dep(p1, p2, 3); } |
401 |
||
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
402 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
403 |
// metadata deps are sorted before object deps |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
404 |
static int sort_dep_value(Dependencies::DepValue* p1, Dependencies::DepValue* p2, int narg) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
405 |
for (int i = 0; i < narg; i++) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
406 |
int diff = p1[i].sort_key() - p2[i].sort_key(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
407 |
if (diff != 0) return diff; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
408 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
409 |
return 0; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
410 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
411 |
static int sort_dep_value_arg_1(Dependencies::DepValue* p1, Dependencies::DepValue* p2) |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
412 |
{ return sort_dep_value(p1, p2, 1); } |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
413 |
static int sort_dep_value_arg_2(Dependencies::DepValue* p1, Dependencies::DepValue* p2) |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
414 |
{ return sort_dep_value(p1, p2, 2); } |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
415 |
static int sort_dep_value_arg_3(Dependencies::DepValue* p1, Dependencies::DepValue* p2) |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
416 |
{ return sort_dep_value(p1, p2, 3); } |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
417 |
#endif // INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
418 |
|
1 | 419 |
void Dependencies::sort_all_deps() { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
420 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
421 |
if (_using_dep_values) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
422 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
423 |
DepType dept = (DepType)deptv; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
424 |
GrowableArray<DepValue>* deps = _dep_values[dept]; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
425 |
if (deps->length() <= 1) continue; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
426 |
switch (dep_args(dept)) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
427 |
case 1: deps->sort(sort_dep_value_arg_1, 1); break; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
428 |
case 2: deps->sort(sort_dep_value_arg_2, 2); break; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
429 |
case 3: deps->sort(sort_dep_value_arg_3, 3); break; |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
430 |
default: ShouldNotReachHere(); break; |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
431 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
432 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
433 |
return; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
434 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
435 |
#endif // INCLUDE_JVMCI |
1 | 436 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
437 |
DepType dept = (DepType)deptv; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
438 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
1 | 439 |
if (deps->length() <= 1) continue; |
440 |
switch (dep_args(dept)) { |
|
441 |
case 1: deps->sort(sort_dep_arg_1, 1); break; |
|
442 |
case 2: deps->sort(sort_dep_arg_2, 2); break; |
|
443 |
case 3: deps->sort(sort_dep_arg_3, 3); break; |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
444 |
default: ShouldNotReachHere(); break; |
1 | 445 |
} |
446 |
} |
|
447 |
} |
|
448 |
||
449 |
size_t Dependencies::estimate_size_in_bytes() { |
|
450 |
size_t est_size = 100; |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
451 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
452 |
if (_using_dep_values) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
453 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
454 |
DepType dept = (DepType)deptv; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
455 |
GrowableArray<DepValue>* deps = _dep_values[dept]; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
456 |
est_size += deps->length() * 2; // tags and argument(s) |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
457 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
458 |
return est_size; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
459 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
460 |
#endif // INCLUDE_JVMCI |
1 | 461 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
462 |
DepType dept = (DepType)deptv; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
463 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
1 | 464 |
est_size += deps->length()*2; // tags and argument(s) |
465 |
} |
|
466 |
return est_size; |
|
467 |
} |
|
468 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
469 |
ciKlass* Dependencies::ctxk_encoded_as_null(DepType dept, ciBaseObject* x) { |
1 | 470 |
switch (dept) { |
471 |
case abstract_with_exclusive_concrete_subtypes_2: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
472 |
return x->as_metadata()->as_klass(); |
1 | 473 |
case unique_concrete_method: |
474 |
case exclusive_concrete_methods_2: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
475 |
return x->as_metadata()->as_method()->holder(); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
476 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
477 |
return NULL; // let NULL be NULL |
1 | 478 |
} |
479 |
} |
|
480 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
481 |
Klass* Dependencies::ctxk_encoded_as_null(DepType dept, Metadata* x) { |
1 | 482 |
assert(must_be_in_vm(), "raw oops here"); |
483 |
switch (dept) { |
|
484 |
case abstract_with_exclusive_concrete_subtypes_2: |
|
485 |
assert(x->is_klass(), "sanity"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
486 |
return (Klass*) x; |
1 | 487 |
case unique_concrete_method: |
488 |
case exclusive_concrete_methods_2: |
|
489 |
assert(x->is_method(), "sanity"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
490 |
return ((Method*)x)->method_holder(); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
491 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
492 |
return NULL; // let NULL be NULL |
1 | 493 |
} |
494 |
} |
|
495 |
||
496 |
void Dependencies::encode_content_bytes() { |
|
497 |
sort_all_deps(); |
|
498 |
||
499 |
// cast is safe, no deps can overflow INT_MAX |
|
500 |
CompressedWriteStream bytes((int)estimate_size_in_bytes()); |
|
501 |
||
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
502 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
503 |
if (_using_dep_values) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
504 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
505 |
DepType dept = (DepType)deptv; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
506 |
GrowableArray<DepValue>* deps = _dep_values[dept]; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
507 |
if (deps->length() == 0) continue; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
508 |
int stride = dep_args(dept); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
509 |
int ctxkj = dep_context_arg(dept); // -1 if no context arg |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
510 |
assert(stride > 0, "sanity"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
511 |
for (int i = 0; i < deps->length(); i += stride) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
512 |
jbyte code_byte = (jbyte)dept; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
513 |
int skipj = -1; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
514 |
if (ctxkj >= 0 && ctxkj+1 < stride) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
515 |
Klass* ctxk = deps->at(i+ctxkj+0).as_klass(_oop_recorder); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
516 |
DepValue x = deps->at(i+ctxkj+1); // following argument |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
517 |
if (ctxk == ctxk_encoded_as_null(dept, x.as_metadata(_oop_recorder))) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
518 |
skipj = ctxkj; // we win: maybe one less oop to keep track of |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
519 |
code_byte |= default_context_type_bit; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
520 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
521 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
522 |
bytes.write_byte(code_byte); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
523 |
for (int j = 0; j < stride; j++) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
524 |
if (j == skipj) continue; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
525 |
DepValue v = deps->at(i+j); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
526 |
int idx = v.index(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
527 |
bytes.write_int(idx); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
528 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
529 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
530 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
531 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
532 |
#endif // INCLUDE_JVMCI |
1 | 533 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
534 |
DepType dept = (DepType)deptv; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
535 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
1 | 536 |
if (deps->length() == 0) continue; |
537 |
int stride = dep_args(dept); |
|
538 |
int ctxkj = dep_context_arg(dept); // -1 if no context arg |
|
539 |
assert(stride > 0, "sanity"); |
|
540 |
for (int i = 0; i < deps->length(); i += stride) { |
|
541 |
jbyte code_byte = (jbyte)dept; |
|
542 |
int skipj = -1; |
|
543 |
if (ctxkj >= 0 && ctxkj+1 < stride) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
544 |
ciKlass* ctxk = deps->at(i+ctxkj+0)->as_metadata()->as_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
545 |
ciBaseObject* x = deps->at(i+ctxkj+1); // following argument |
1 | 546 |
if (ctxk == ctxk_encoded_as_null(dept, x)) { |
547 |
skipj = ctxkj; // we win: maybe one less oop to keep track of |
|
548 |
code_byte |= default_context_type_bit; |
|
549 |
} |
|
550 |
} |
|
551 |
bytes.write_byte(code_byte); |
|
552 |
for (int j = 0; j < stride; j++) { |
|
553 |
if (j == skipj) continue; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
554 |
ciBaseObject* v = deps->at(i+j); |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
555 |
int idx; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
556 |
if (v->is_object()) { |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
557 |
idx = _oop_recorder->find_index(v->as_object()->constant_encoding()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
558 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
559 |
ciMetadata* meta = v->as_metadata(); |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
560 |
idx = _oop_recorder->find_index(meta->constant_encoding()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
561 |
} |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
562 |
bytes.write_int(idx); |
1 | 563 |
} |
564 |
} |
|
565 |
} |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
566 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
567 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
568 |
#endif |
1 | 569 |
|
570 |
// write a sentinel byte to mark the end |
|
571 |
bytes.write_byte(end_marker); |
|
572 |
||
573 |
// round it out to a word boundary |
|
574 |
while (bytes.position() % sizeof(HeapWord) != 0) { |
|
575 |
bytes.write_byte(end_marker); |
|
576 |
} |
|
577 |
||
578 |
// check whether the dept byte encoding really works |
|
579 |
assert((jbyte)default_context_type_bit != 0, "byte overflow"); |
|
580 |
||
581 |
_content_bytes = bytes.buffer(); |
|
582 |
_size_in_bytes = bytes.position(); |
|
583 |
} |
|
584 |
||
585 |
||
586 |
const char* Dependencies::_dep_name[TYPE_LIMIT] = { |
|
587 |
"end_marker", |
|
588 |
"evol_method", |
|
589 |
"leaf_type", |
|
590 |
"abstract_with_unique_concrete_subtype", |
|
591 |
"abstract_with_no_concrete_subtype", |
|
592 |
"concrete_with_no_concrete_subtype", |
|
593 |
"unique_concrete_method", |
|
594 |
"abstract_with_exclusive_concrete_subtypes_2", |
|
595 |
"exclusive_concrete_methods_2", |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
596 |
"no_finalizable_subclasses", |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
597 |
"call_site_target_value" |
1 | 598 |
}; |
599 |
||
600 |
int Dependencies::_dep_args[TYPE_LIMIT] = { |
|
601 |
-1,// end_marker |
|
602 |
1, // evol_method m |
|
603 |
1, // leaf_type ctxk |
|
604 |
2, // abstract_with_unique_concrete_subtype ctxk, k |
|
605 |
1, // abstract_with_no_concrete_subtype ctxk |
|
606 |
1, // concrete_with_no_concrete_subtype ctxk |
|
607 |
2, // unique_concrete_method ctxk, m |
|
608 |
3, // unique_concrete_subtypes_2 ctxk, k1, k2 |
|
609 |
3, // unique_concrete_methods_2 ctxk, m1, m2 |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
610 |
1, // no_finalizable_subclasses ctxk |
31037
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30296
diff
changeset
|
611 |
2 // call_site_target_value call_site, method_handle |
1 | 612 |
}; |
613 |
||
614 |
const char* Dependencies::dep_name(Dependencies::DepType dept) { |
|
615 |
if (!dept_in_mask(dept, all_types)) return "?bad-dep?"; |
|
616 |
return _dep_name[dept]; |
|
617 |
} |
|
618 |
||
619 |
int Dependencies::dep_args(Dependencies::DepType dept) { |
|
620 |
if (!dept_in_mask(dept, all_types)) return -1; |
|
621 |
return _dep_args[dept]; |
|
622 |
} |
|
623 |
||
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
624 |
void Dependencies::check_valid_dependency_type(DepType dept) { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31037
diff
changeset
|
625 |
guarantee(FIRST_TYPE <= dept && dept < TYPE_LIMIT, "invalid dependency type: %d", (int) dept); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
626 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
627 |
|
48299
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
628 |
Dependencies::DepType Dependencies::validate_dependencies(CompileTask* task, bool counter_changed, char** failure_detail) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
629 |
// First, check non-klass dependencies as we might return early and |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
630 |
// not check klass dependencies if the system dictionary |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
631 |
// modification counter hasn't changed (see below). |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
632 |
for (Dependencies::DepStream deps(this); deps.next(); ) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
633 |
if (deps.is_klass_type()) continue; // skip klass dependencies |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
634 |
Klass* witness = deps.check_dependency(); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
635 |
if (witness != NULL) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
636 |
return deps.type(); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
637 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
638 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
639 |
|
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
640 |
// Klass dependencies must be checked when the system dictionary |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
641 |
// changes. If logging is enabled all violated dependences will be |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
642 |
// recorded in the log. In debug mode check dependencies even if |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
643 |
// the system dictionary hasn't changed to verify that no invalid |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
644 |
// dependencies were inserted. Any violated dependences in this |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
645 |
// case are dumped to the tty. |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
646 |
if (!counter_changed && !trueInDebug) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
647 |
return end_marker; |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
648 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
649 |
|
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
650 |
int klass_violations = 0; |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
651 |
DepType result = end_marker; |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
652 |
for (Dependencies::DepStream deps(this); deps.next(); ) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
653 |
if (!deps.is_klass_type()) continue; // skip non-klass dependencies |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
654 |
Klass* witness = deps.check_dependency(); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
655 |
if (witness != NULL) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
656 |
if (klass_violations == 0) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
657 |
result = deps.type(); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
658 |
if (failure_detail != NULL && klass_violations == 0) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
659 |
// Use a fixed size buffer to prevent the string stream from |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
660 |
// resizing in the context of an inner resource mark. |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
661 |
char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
662 |
stringStream st(buffer, O_BUFLEN); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
663 |
deps.print_dependency(witness, true, &st); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
664 |
*failure_detail = st.as_string(); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
665 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
666 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
667 |
klass_violations++; |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
668 |
if (!counter_changed) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
669 |
// Dependence failed but counter didn't change. Log a message |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
670 |
// describing what failed and allow the assert at the end to |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
671 |
// trigger. |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
672 |
deps.print_dependency(witness); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
673 |
} else if (xtty == NULL) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
674 |
// If we're not logging then a single violation is sufficient, |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
675 |
// otherwise we want to log all the dependences which were |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
676 |
// violated. |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
677 |
break; |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
678 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
679 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
680 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
681 |
|
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
682 |
if (klass_violations != 0) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
683 |
#ifdef ASSERT |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
684 |
if (task != NULL && !counter_changed && !PrintCompilation) { |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
685 |
// Print out the compile task that failed |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
686 |
task->print_tty(); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
687 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
688 |
#endif |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
689 |
assert(counter_changed, "failed dependencies, but counter didn't change"); |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
690 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
691 |
return result; |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
692 |
} |
e8f5fc8f5f67
8191052: [Graal] java/lang/invoke/CallSiteTest.java intermittently fails with "Failed dependency of type call_site_target_value" when running with Graal as JIT
never
parents:
47216
diff
changeset
|
693 |
|
1 | 694 |
// for the sake of the compiler log, print out current dependencies: |
695 |
void Dependencies::log_all_dependencies() { |
|
696 |
if (log() == NULL) return; |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
697 |
ResourceMark rm; |
1 | 698 |
for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) { |
699 |
DepType dept = (DepType)deptv; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
700 |
GrowableArray<ciBaseObject*>* deps = _deps[dept]; |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
701 |
int deplen = deps->length(); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
702 |
if (deplen == 0) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
703 |
continue; |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
704 |
} |
1 | 705 |
int stride = dep_args(dept); |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
706 |
GrowableArray<ciBaseObject*>* ciargs = new GrowableArray<ciBaseObject*>(stride); |
1 | 707 |
for (int i = 0; i < deps->length(); i += stride) { |
708 |
for (int j = 0; j < stride; j++) { |
|
709 |
// flush out the identities before printing |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
710 |
ciargs->push(deps->at(i+j)); |
1 | 711 |
} |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
712 |
write_dependency_to(log(), dept, ciargs); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
713 |
ciargs->clear(); |
1 | 714 |
} |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
715 |
guarantee(deplen == deps->length(), "deps array cannot grow inside nested ResoureMark scope"); |
1 | 716 |
} |
717 |
} |
|
718 |
||
719 |
void Dependencies::write_dependency_to(CompileLog* log, |
|
720 |
DepType dept, |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
721 |
GrowableArray<DepArgument>* args, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
722 |
Klass* witness) { |
1 | 723 |
if (log == NULL) { |
724 |
return; |
|
725 |
} |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
726 |
ResourceMark rm; |
1 | 727 |
ciEnv* env = ciEnv::current(); |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
728 |
GrowableArray<ciBaseObject*>* ciargs = new GrowableArray<ciBaseObject*>(args->length()); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
729 |
for (GrowableArrayIterator<DepArgument> it = args->begin(); it != args->end(); ++it) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
730 |
DepArgument arg = *it; |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
731 |
if (arg.is_oop()) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
732 |
ciargs->push(env->get_object(arg.oop_value())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
733 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
734 |
ciargs->push(env->get_metadata(arg.metadata_value())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
735 |
} |
1 | 736 |
} |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
737 |
int argslen = ciargs->length(); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
738 |
Dependencies::write_dependency_to(log, dept, ciargs, witness); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
739 |
guarantee(argslen == ciargs->length(), "ciargs array cannot grow inside nested ResoureMark scope"); |
1 | 740 |
} |
741 |
||
742 |
void Dependencies::write_dependency_to(CompileLog* log, |
|
743 |
DepType dept, |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
744 |
GrowableArray<ciBaseObject*>* args, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
745 |
Klass* witness) { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
746 |
if (log == NULL) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
747 |
return; |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
748 |
} |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
749 |
ResourceMark rm; |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
750 |
GrowableArray<int>* argids = new GrowableArray<int>(args->length()); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
751 |
for (GrowableArrayIterator<ciBaseObject*> it = args->begin(); it != args->end(); ++it) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
752 |
ciBaseObject* obj = *it; |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
753 |
if (obj->is_object()) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
754 |
argids->push(log->identify(obj->as_object())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
755 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
756 |
argids->push(log->identify(obj->as_metadata())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
757 |
} |
1 | 758 |
} |
759 |
if (witness != NULL) { |
|
760 |
log->begin_elem("dependency_failed"); |
|
761 |
} else { |
|
762 |
log->begin_elem("dependency"); |
|
763 |
} |
|
764 |
log->print(" type='%s'", dep_name(dept)); |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
765 |
const int ctxkj = dep_context_arg(dept); // -1 if no context arg |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
766 |
if (ctxkj >= 0 && ctxkj < argids->length()) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
767 |
log->print(" ctxk='%d'", argids->at(ctxkj)); |
1 | 768 |
} |
769 |
// write remaining arguments, if any. |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
770 |
for (int j = 0; j < argids->length(); j++) { |
1 | 771 |
if (j == ctxkj) continue; // already logged |
772 |
if (j == 1) { |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
773 |
log->print( " x='%d'", argids->at(j)); |
1 | 774 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
775 |
log->print(" x%d='%d'", j, argids->at(j)); |
1 | 776 |
} |
777 |
} |
|
778 |
if (witness != NULL) { |
|
779 |
log->object("witness", witness); |
|
780 |
log->stamp(); |
|
781 |
} |
|
782 |
log->end_elem(); |
|
783 |
} |
|
784 |
||
785 |
void Dependencies::write_dependency_to(xmlStream* xtty, |
|
786 |
DepType dept, |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
787 |
GrowableArray<DepArgument>* args, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
788 |
Klass* witness) { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
789 |
if (xtty == NULL) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
790 |
return; |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
791 |
} |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
40362
diff
changeset
|
792 |
Thread* thread = Thread::current(); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
40362
diff
changeset
|
793 |
HandleMark rm(thread); |
1 | 794 |
ttyLocker ttyl; |
795 |
int ctxkj = dep_context_arg(dept); // -1 if no context arg |
|
796 |
if (witness != NULL) { |
|
797 |
xtty->begin_elem("dependency_failed"); |
|
798 |
} else { |
|
799 |
xtty->begin_elem("dependency"); |
|
800 |
} |
|
801 |
xtty->print(" type='%s'", dep_name(dept)); |
|
802 |
if (ctxkj >= 0) { |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
803 |
xtty->object("ctxk", args->at(ctxkj).metadata_value()); |
1 | 804 |
} |
805 |
// write remaining arguments, if any. |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
806 |
for (int j = 0; j < args->length(); j++) { |
1 | 807 |
if (j == ctxkj) continue; // already logged |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
808 |
DepArgument arg = args->at(j); |
1 | 809 |
if (j == 1) { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
810 |
if (arg.is_oop()) { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
40362
diff
changeset
|
811 |
xtty->object("x", Handle(thread, arg.oop_value())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
812 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
813 |
xtty->object("x", arg.metadata_value()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
814 |
} |
1 | 815 |
} else { |
46672
dc24cb5e50a1
8184309: Buld warnings from GCC 7.1 on Fedora 26
ysuenaga
parents:
46630
diff
changeset
|
816 |
char xn[12]; sprintf(xn, "x%d", j); |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
817 |
if (arg.is_oop()) { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
40362
diff
changeset
|
818 |
xtty->object(xn, Handle(thread, arg.oop_value())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
819 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
820 |
xtty->object(xn, arg.metadata_value()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
821 |
} |
1 | 822 |
} |
823 |
} |
|
824 |
if (witness != NULL) { |
|
825 |
xtty->object("witness", witness); |
|
826 |
xtty->stamp(); |
|
827 |
} |
|
828 |
xtty->end_elem(); |
|
829 |
} |
|
830 |
||
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
831 |
void Dependencies::print_dependency(DepType dept, GrowableArray<DepArgument>* args, |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
832 |
Klass* witness, outputStream* st) { |
1 | 833 |
ResourceMark rm; |
834 |
ttyLocker ttyl; // keep the following output all in one block |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
835 |
st->print_cr("%s of type %s", |
1 | 836 |
(witness == NULL)? "Dependency": "Failed dependency", |
837 |
dep_name(dept)); |
|
838 |
// print arguments |
|
839 |
int ctxkj = dep_context_arg(dept); // -1 if no context arg |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
840 |
for (int j = 0; j < args->length(); j++) { |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
841 |
DepArgument arg = args->at(j); |
1 | 842 |
bool put_star = false; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
843 |
if (arg.is_null()) continue; |
1 | 844 |
const char* what; |
845 |
if (j == ctxkj) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
846 |
assert(arg.is_metadata(), "must be"); |
1 | 847 |
what = "context"; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
848 |
put_star = !Dependencies::is_concrete_klass((Klass*)arg.metadata_value()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
849 |
} else if (arg.is_method()) { |
1 | 850 |
what = "method "; |
28514 | 851 |
put_star = !Dependencies::is_concrete_method((Method*)arg.metadata_value(), NULL); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
852 |
} else if (arg.is_klass()) { |
1 | 853 |
what = "class "; |
854 |
} else { |
|
855 |
what = "object "; |
|
856 |
} |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
857 |
st->print(" %s = %s", what, (put_star? "*": "")); |
26914
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
858 |
if (arg.is_klass()) { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
859 |
st->print("%s", ((Klass*)arg.metadata_value())->external_name()); |
26914
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
860 |
} else if (arg.is_method()) { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
861 |
((Method*)arg.metadata_value())->print_value_on(st); |
26914
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
862 |
} else if (arg.is_oop()) { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
863 |
arg.oop_value()->print_value_on(st); |
26914
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
864 |
} else { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
865 |
ShouldNotReachHere(); // Provide impl for this type. |
26914
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
866 |
} |
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
867 |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
868 |
st->cr(); |
1 | 869 |
} |
870 |
if (witness != NULL) { |
|
871 |
bool put_star = !Dependencies::is_concrete_klass(witness); |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
872 |
st->print_cr(" witness = %s%s", |
1 | 873 |
(put_star? "*": ""), |
14488 | 874 |
witness->external_name()); |
1 | 875 |
} |
876 |
} |
|
877 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
878 |
void Dependencies::DepStream::log_dependency(Klass* witness) { |
1 | 879 |
if (_deps == NULL && xtty == NULL) return; // fast cutout for runtime |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
880 |
ResourceMark rm; |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
881 |
const int nargs = argument_count(); |
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
882 |
GrowableArray<DepArgument>* args = new GrowableArray<DepArgument>(nargs); |
1 | 883 |
for (int j = 0; j < nargs; j++) { |
30296
95baefac8485
8057967: CallSite dependency tracking scales devastatingly poorly
vlivanov
parents:
30195
diff
changeset
|
884 |
if (is_oop_argument(j)) { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
885 |
args->push(argument_oop(j)); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
886 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
887 |
args->push(argument(j)); |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
888 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
889 |
} |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
890 |
int argslen = args->length(); |
1 | 891 |
if (_deps != NULL && _deps->log() != NULL) { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
892 |
if (ciEnv::current() != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
893 |
Dependencies::write_dependency_to(_deps->log(), type(), args, witness); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
894 |
} else { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
895 |
// Treat the CompileLog as an xmlstream instead |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
896 |
Dependencies::write_dependency_to((xmlStream*)_deps->log(), type(), args, witness); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
897 |
} |
1 | 898 |
} else { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
899 |
Dependencies::write_dependency_to(xtty, type(), args, witness); |
1 | 900 |
} |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
901 |
guarantee(argslen == args->length(), "args array cannot grow inside nested ResoureMark scope"); |
1 | 902 |
} |
903 |
||
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
904 |
void Dependencies::DepStream::print_dependency(Klass* witness, bool verbose, outputStream* st) { |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
905 |
ResourceMark rm; |
1 | 906 |
int nargs = argument_count(); |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
907 |
GrowableArray<DepArgument>* args = new GrowableArray<DepArgument>(nargs); |
1 | 908 |
for (int j = 0; j < nargs; j++) { |
30296
95baefac8485
8057967: CallSite dependency tracking scales devastatingly poorly
vlivanov
parents:
30195
diff
changeset
|
909 |
if (is_oop_argument(j)) { |
26914
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
910 |
args->push(argument_oop(j)); |
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
911 |
} else { |
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
912 |
args->push(argument(j)); |
a270e0fac50e
8058578: -XX:+TraceDependencies is broken for call_site_target_value dependency type
vlivanov
parents:
25936
diff
changeset
|
913 |
} |
1 | 914 |
} |
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
915 |
int argslen = args->length(); |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
916 |
Dependencies::print_dependency(type(), args, witness, st); |
1 | 917 |
if (verbose) { |
918 |
if (_code != NULL) { |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
919 |
st->print(" code: "); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
920 |
_code->print_value_on(st); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
31037
diff
changeset
|
921 |
st->cr(); |
1 | 922 |
} |
923 |
} |
|
25936
9b693ed74c13
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
morris
parents:
24484
diff
changeset
|
924 |
guarantee(argslen == args->length(), "args array cannot grow inside nested ResoureMark scope"); |
1 | 925 |
} |
926 |
||
927 |
||
928 |
/// Dependency stream support (decodes dependencies from an nmethod): |
|
929 |
||
930 |
#ifdef ASSERT |
|
931 |
void Dependencies::DepStream::initial_asserts(size_t byte_limit) { |
|
932 |
assert(must_be_in_vm(), "raw oops here"); |
|
933 |
_byte_limit = byte_limit; |
|
934 |
_type = (DepType)(end_marker-1); // defeat "already at end" assert |
|
935 |
assert((_code!=NULL) + (_deps!=NULL) == 1, "one or t'other"); |
|
936 |
} |
|
937 |
#endif //ASSERT |
|
938 |
||
939 |
bool Dependencies::DepStream::next() { |
|
940 |
assert(_type != end_marker, "already at end"); |
|
941 |
if (_bytes.position() == 0 && _code != NULL |
|
942 |
&& _code->dependencies_size() == 0) { |
|
943 |
// Method has no dependencies at all. |
|
944 |
return false; |
|
945 |
} |
|
946 |
int code_byte = (_bytes.read_byte() & 0xFF); |
|
947 |
if (code_byte == end_marker) { |
|
948 |
DEBUG_ONLY(_type = end_marker); |
|
949 |
return false; |
|
950 |
} else { |
|
951 |
int ctxk_bit = (code_byte & Dependencies::default_context_type_bit); |
|
952 |
code_byte -= ctxk_bit; |
|
953 |
DepType dept = (DepType)code_byte; |
|
954 |
_type = dept; |
|
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
955 |
Dependencies::check_valid_dependency_type(dept); |
1 | 956 |
int stride = _dep_args[dept]; |
957 |
assert(stride == dep_args(dept), "sanity"); |
|
958 |
int skipj = -1; |
|
959 |
if (ctxk_bit != 0) { |
|
960 |
skipj = 0; // currently the only context argument is at zero |
|
961 |
assert(skipj == dep_context_arg(dept), "zero arg always ctxk"); |
|
962 |
} |
|
963 |
for (int j = 0; j < stride; j++) { |
|
964 |
_xi[j] = (j == skipj)? 0: _bytes.read_int(); |
|
965 |
} |
|
966 |
DEBUG_ONLY(_xi[stride] = -1); // help detect overruns |
|
967 |
return true; |
|
968 |
} |
|
969 |
} |
|
970 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
971 |
inline Metadata* Dependencies::DepStream::recorded_metadata_at(int i) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
972 |
Metadata* o = NULL; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
973 |
if (_code != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
974 |
o = _code->metadata_at(i); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
975 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
976 |
o = _deps->oop_recorder()->metadata_at(i); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
977 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
978 |
return o; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
979 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
980 |
|
1 | 981 |
inline oop Dependencies::DepStream::recorded_oop_at(int i) { |
982 |
return (_code != NULL) |
|
983 |
? _code->oop_at(i) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
984 |
: JNIHandles::resolve(_deps->oop_recorder()->oop_at(i)); |
1 | 985 |
} |
986 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
987 |
Metadata* Dependencies::DepStream::argument(int i) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
988 |
Metadata* result = recorded_metadata_at(argument_index(i)); |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
989 |
|
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
990 |
if (result == NULL) { // Explicit context argument can be compressed |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
991 |
int ctxkj = dep_context_arg(type()); // -1 if no explicit context arg |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
992 |
if (ctxkj >= 0 && i == ctxkj && ctxkj+1 < argument_count()) { |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
993 |
result = ctxk_encoded_as_null(type(), argument(ctxkj+1)); |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
994 |
} |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
995 |
} |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
996 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
997 |
assert(result == NULL || result->is_klass() || result->is_method(), "must be"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
998 |
return result; |
1 | 999 |
} |
1000 |
||
22506
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1001 |
/** |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1002 |
* Returns a unique identifier for each dependency argument. |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1003 |
*/ |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1004 |
uintptr_t Dependencies::DepStream::get_identifier(int i) { |
30296
95baefac8485
8057967: CallSite dependency tracking scales devastatingly poorly
vlivanov
parents:
30195
diff
changeset
|
1005 |
if (is_oop_argument(i)) { |
22506
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1006 |
return (uintptr_t)(oopDesc*)argument_oop(i); |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1007 |
} else { |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1008 |
return (uintptr_t)argument(i); |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1009 |
} |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1010 |
} |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1011 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1012 |
oop Dependencies::DepStream::argument_oop(int i) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1013 |
oop result = recorded_oop_at(argument_index(i)); |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
46672
diff
changeset
|
1014 |
assert(oopDesc::is_oop_or_null(result), "must be"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1015 |
return result; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1016 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1017 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1018 |
Klass* Dependencies::DepStream::context_type() { |
1 | 1019 |
assert(must_be_in_vm(), "raw oops here"); |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1020 |
|
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1021 |
// Most dependencies have an explicit context type argument. |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1022 |
{ |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
1023 |
int ctxkj = dep_context_arg(type()); // -1 if no explicit context arg |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1024 |
if (ctxkj >= 0) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1025 |
Metadata* k = argument(ctxkj); |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
1026 |
assert(k != NULL && k->is_klass(), "type check"); |
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
1027 |
return (Klass*)k; |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1028 |
} |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1029 |
} |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1030 |
|
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1031 |
// Some dependencies are using the klass of the first object |
30296
95baefac8485
8057967: CallSite dependency tracking scales devastatingly poorly
vlivanov
parents:
30195
diff
changeset
|
1032 |
// argument as implicit context type. |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1033 |
{ |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
1034 |
int ctxkj = dep_implicit_context_arg(type()); |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1035 |
if (ctxkj >= 0) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1036 |
Klass* k = argument_oop(ctxkj)->klass(); |
13965
fe09056af6ae
8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64
vlivanov
parents:
13743
diff
changeset
|
1037 |
assert(k != NULL && k->is_klass(), "type check"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1038 |
return (Klass*) k; |
1 | 1039 |
} |
1040 |
} |
|
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1041 |
|
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1042 |
// And some dependencies don't have a context type at all, |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1043 |
// e.g. evol_method. |
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1044 |
return NULL; |
1 | 1045 |
} |
1046 |
||
22506
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1047 |
// ----------------- DependencySignature -------------------------------------- |
23187
0f438571f278
8035946: Use ResourceHashtable for dependency checking
anoll
parents:
22921
diff
changeset
|
1048 |
bool DependencySignature::equals(DependencySignature const& s1, DependencySignature const& s2) { |
0f438571f278
8035946: Use ResourceHashtable for dependency checking
anoll
parents:
22921
diff
changeset
|
1049 |
if ((s1.type() != s2.type()) || (s1.args_count() != s2.args_count())) { |
22506
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1050 |
return false; |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1051 |
} |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1052 |
|
23187
0f438571f278
8035946: Use ResourceHashtable for dependency checking
anoll
parents:
22921
diff
changeset
|
1053 |
for (int i = 0; i < s1.args_count(); i++) { |
0f438571f278
8035946: Use ResourceHashtable for dependency checking
anoll
parents:
22921
diff
changeset
|
1054 |
if (s1.arg(i) != s2.arg(i)) { |
22506
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1055 |
return false; |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1056 |
} |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1057 |
} |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1058 |
return true; |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1059 |
} |
0759c126204d
7194669: CodeCache::mark_for_deoptimization should avoid verifying dependencies multiple times
anoll
parents:
20391
diff
changeset
|
1060 |
|
1 | 1061 |
/// Checking dependencies: |
1062 |
||
1063 |
// This hierarchy walker inspects subtypes of a given type, |
|
1064 |
// trying to find a "bad" class which breaks a dependency. |
|
1065 |
// Such a class is called a "witness" to the broken dependency. |
|
1066 |
// While searching around, we ignore "participants", which |
|
1067 |
// are already known to the dependency. |
|
1068 |
class ClassHierarchyWalker { |
|
1069 |
public: |
|
1070 |
enum { PARTICIPANT_LIMIT = 3 }; |
|
1071 |
||
1072 |
private: |
|
1073 |
// optional method descriptor to check for: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
1074 |
Symbol* _name; |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
1075 |
Symbol* _signature; |
1 | 1076 |
|
1077 |
// special classes which are not allowed to be witnesses: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1078 |
Klass* _participants[PARTICIPANT_LIMIT+1]; |
1 | 1079 |
int _num_participants; |
1080 |
||
1081 |
// cache of method lookups |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1082 |
Method* _found_methods[PARTICIPANT_LIMIT+1]; |
1 | 1083 |
|
1084 |
// if non-zero, tells how many witnesses to convert to participants |
|
1085 |
int _record_witnesses; |
|
1086 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1087 |
void initialize(Klass* participant) { |
1 | 1088 |
_record_witnesses = 0; |
1089 |
_participants[0] = participant; |
|
1090 |
_found_methods[0] = NULL; |
|
1091 |
_num_participants = 0; |
|
1092 |
if (participant != NULL) { |
|
1093 |
// Terminating NULL. |
|
1094 |
_participants[1] = NULL; |
|
1095 |
_found_methods[1] = NULL; |
|
1096 |
_num_participants = 1; |
|
1097 |
} |
|
1098 |
} |
|
1099 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1100 |
void initialize_from_method(Method* m) { |
1 | 1101 |
assert(m != NULL && m->is_method(), "sanity"); |
1102 |
_name = m->name(); |
|
1103 |
_signature = m->signature(); |
|
1104 |
} |
|
1105 |
||
1106 |
public: |
|
1107 |
// The walker is initialized to recognize certain methods and/or types |
|
1108 |
// as friendly participants. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1109 |
ClassHierarchyWalker(Klass* participant, Method* m) { |
1 | 1110 |
initialize_from_method(m); |
1111 |
initialize(participant); |
|
1112 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1113 |
ClassHierarchyWalker(Method* m) { |
1 | 1114 |
initialize_from_method(m); |
1115 |
initialize(NULL); |
|
1116 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1117 |
ClassHierarchyWalker(Klass* participant = NULL) { |
1 | 1118 |
_name = NULL; |
1119 |
_signature = NULL; |
|
1120 |
initialize(participant); |
|
1121 |
} |
|
49772 | 1122 |
ClassHierarchyWalker(Klass* participants[], int num_participants) { |
1123 |
_name = NULL; |
|
1124 |
_signature = NULL; |
|
1125 |
initialize(NULL); |
|
1126 |
for (int i = 0; i < num_participants; ++i) { |
|
1127 |
add_participant(participants[i]); |
|
1128 |
} |
|
1129 |
} |
|
1 | 1130 |
|
1131 |
// This is common code for two searches: One for concrete subtypes, |
|
1132 |
// the other for concrete method implementations and overrides. |
|
1133 |
bool doing_subtype_search() { |
|
1134 |
return _name == NULL; |
|
1135 |
} |
|
1136 |
||
1137 |
int num_participants() { return _num_participants; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1138 |
Klass* participant(int n) { |
1 | 1139 |
assert((uint)n <= (uint)_num_participants, "oob"); |
1140 |
return _participants[n]; |
|
1141 |
} |
|
1142 |
||
1143 |
// Note: If n==num_participants, returns NULL. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1144 |
Method* found_method(int n) { |
1 | 1145 |
assert((uint)n <= (uint)_num_participants, "oob"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1146 |
Method* fm = _found_methods[n]; |
1 | 1147 |
assert(n == _num_participants || fm != NULL, "proper usage"); |
30195
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1148 |
if (fm != NULL && fm->method_holder() != _participants[n]) { |
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1149 |
// Default methods from interfaces can be added to classes. In |
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1150 |
// that case the holder of the method is not the class but the |
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1151 |
// interface where it's defined. |
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1152 |
assert(fm->is_default_method(), "sanity"); |
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1153 |
return NULL; |
fff35af9b018
8069263: assert(fm == NULL || fm->method_holder() == _participants[n]) failed: sanity
roland
parents:
29081
diff
changeset
|
1154 |
} |
1 | 1155 |
return fm; |
1156 |
} |
|
1157 |
||
1158 |
#ifdef ASSERT |
|
1159 |
// Assert that m is inherited into ctxk, without intervening overrides. |
|
1160 |
// (May return true even if this is not true, in corner cases where we punt.) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1161 |
bool check_method_context(Klass* ctxk, Method* m) { |
1 | 1162 |
if (m->method_holder() == ctxk) |
1163 |
return true; // Quick win. |
|
1164 |
if (m->is_private()) |
|
1165 |
return false; // Quick lose. Should not happen. |
|
1166 |
if (!(m->is_public() || m->is_protected())) |
|
1167 |
// The override story is complex when packages get involved. |
|
1168 |
return true; // Must punt the assertion to true. |
|
40362
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1169 |
Method* lm = ctxk->lookup_method(m->name(), m->signature()); |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1170 |
if (lm == NULL && ctxk->is_instance_klass()) { |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
18439
diff
changeset
|
1171 |
// It might be an interface method |
40362
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1172 |
lm = InstanceKlass::cast(ctxk)->lookup_method_in_ordered_interfaces(m->name(), |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1173 |
m->signature()); |
1 | 1174 |
} |
1175 |
if (lm == m) |
|
1176 |
// Method m is inherited into ctxk. |
|
1177 |
return true; |
|
1178 |
if (lm != NULL) { |
|
10984
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1179 |
if (!(lm->is_public() || lm->is_protected())) { |
1 | 1180 |
// Method is [package-]private, so the override story is complex. |
1181 |
return true; // Must punt the assertion to true. |
|
10984
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1182 |
} |
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1183 |
if (lm->is_static()) { |
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1184 |
// Static methods don't override non-static so punt |
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1185 |
return true; |
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1186 |
} |
40362
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1187 |
if (!Dependencies::is_concrete_method(lm, ctxk) && |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1188 |
!Dependencies::is_concrete_method(m, ctxk)) { |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1189 |
// They are both non-concrete |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1190 |
if (lm->method_holder()->is_subtype_of(m->method_holder())) { |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1191 |
// Method m is overridden by lm, but both are non-concrete. |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1192 |
return true; |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1193 |
} |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1194 |
if (lm->method_holder()->is_interface() && m->method_holder()->is_interface() && |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1195 |
ctxk->is_subtype_of(m->method_holder()) && ctxk->is_subtype_of(lm->method_holder())) { |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1196 |
// Interface method defined in multiple super interfaces |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1197 |
return true; |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1198 |
} |
94addd7cfa10
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
never
parents:
37248
diff
changeset
|
1199 |
} |
1 | 1200 |
} |
1201 |
ResourceMark rm; |
|
1202 |
tty->print_cr("Dependency method not found in the associated context:"); |
|
14488 | 1203 |
tty->print_cr(" context = %s", ctxk->external_name()); |
1 | 1204 |
tty->print( " method = "); m->print_short_name(tty); tty->cr(); |
1205 |
if (lm != NULL) { |
|
1206 |
tty->print( " found = "); lm->print_short_name(tty); tty->cr(); |
|
1207 |
} |
|
1208 |
return false; |
|
1209 |
} |
|
1210 |
#endif |
|
1211 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1212 |
void add_participant(Klass* participant) { |
1 | 1213 |
assert(_num_participants + _record_witnesses < PARTICIPANT_LIMIT, "oob"); |
1214 |
int np = _num_participants++; |
|
1215 |
_participants[np] = participant; |
|
1216 |
_participants[np+1] = NULL; |
|
1217 |
_found_methods[np+1] = NULL; |
|
1218 |
} |
|
1219 |
||
1220 |
void record_witnesses(int add) { |
|
1221 |
if (add > PARTICIPANT_LIMIT) add = PARTICIPANT_LIMIT; |
|
1222 |
assert(_num_participants + add < PARTICIPANT_LIMIT, "oob"); |
|
1223 |
_record_witnesses = add; |
|
1224 |
} |
|
1225 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1226 |
bool is_witness(Klass* k) { |
1 | 1227 |
if (doing_subtype_search()) { |
1228 |
return Dependencies::is_concrete_klass(k); |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
1229 |
} else if (!k->is_instance_klass()) { |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1230 |
return false; // no methods to find in an array type |
1 | 1231 |
} else { |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
49902
diff
changeset
|
1232 |
// Search class hierarchy first, skipping private implementations |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
49902
diff
changeset
|
1233 |
// as they never override any inherited methods |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
49902
diff
changeset
|
1234 |
Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature, Klass::skip_private); |
28514 | 1235 |
if (!Dependencies::is_concrete_method(m, k)) { |
49772 | 1236 |
// Check for re-abstraction of method |
1237 |
if (!k->is_interface() && m != NULL && m->is_abstract()) { |
|
1238 |
// Found a matching abstract method 'm' in the class hierarchy. |
|
1239 |
// This is fine iff 'k' is an abstract class and all concrete subtypes |
|
1240 |
// of 'k' override 'm' and are participates of the current search. |
|
1241 |
ClassHierarchyWalker wf(_participants, _num_participants); |
|
1242 |
Klass* w = wf.find_witness_subtype(k); |
|
1243 |
if (w != NULL) { |
|
1244 |
Method* wm = InstanceKlass::cast(w)->find_instance_method(_name, _signature); |
|
1245 |
if (!Dependencies::is_concrete_method(wm, w)) { |
|
1246 |
// Found a concrete subtype 'w' which does not override abstract method 'm'. |
|
1247 |
// Bail out because 'm' could be called with 'w' as receiver (leading to an |
|
1248 |
// AbstractMethodError) and thus the method we are looking for is not unique. |
|
1249 |
_found_methods[_num_participants] = m; |
|
1250 |
return true; |
|
1251 |
} |
|
1252 |
} |
|
1253 |
} |
|
28514 | 1254 |
// Check interface defaults also, if any exist. |
1255 |
Array<Method*>* default_methods = InstanceKlass::cast(k)->default_methods(); |
|
1256 |
if (default_methods == NULL) |
|
1257 |
return false; |
|
1258 |
m = InstanceKlass::cast(k)->find_method(default_methods, _name, _signature); |
|
1259 |
if (!Dependencies::is_concrete_method(m, NULL)) |
|
1260 |
return false; |
|
1261 |
} |
|
1 | 1262 |
_found_methods[_num_participants] = m; |
1263 |
// Note: If add_participant(k) is called, |
|
1264 |
// the method m will already be memoized for it. |
|
1265 |
return true; |
|
1266 |
} |
|
1267 |
} |
|
1268 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1269 |
bool is_participant(Klass* k) { |
1 | 1270 |
if (k == _participants[0]) { |
1271 |
return true; |
|
1272 |
} else if (_num_participants <= 1) { |
|
1273 |
return false; |
|
1274 |
} else { |
|
1275 |
return in_list(k, &_participants[1]); |
|
1276 |
} |
|
1277 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1278 |
bool ignore_witness(Klass* witness) { |
1 | 1279 |
if (_record_witnesses == 0) { |
1280 |
return false; |
|
1281 |
} else { |
|
1282 |
--_record_witnesses; |
|
1283 |
add_participant(witness); |
|
1284 |
return true; |
|
1285 |
} |
|
1286 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1287 |
static bool in_list(Klass* x, Klass** list) { |
1 | 1288 |
for (int i = 0; ; i++) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1289 |
Klass* y = list[i]; |
1 | 1290 |
if (y == NULL) break; |
1291 |
if (y == x) return true; |
|
1292 |
} |
|
1293 |
return false; // not in list |
|
1294 |
} |
|
1295 |
||
1296 |
private: |
|
1297 |
// the actual search method: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1298 |
Klass* find_witness_anywhere(Klass* context_type, |
1 | 1299 |
bool participants_hide_witnesses, |
1300 |
bool top_level_call = true); |
|
1301 |
// the spot-checking version: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1302 |
Klass* find_witness_in(KlassDepChange& changes, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1303 |
Klass* context_type, |
1 | 1304 |
bool participants_hide_witnesses); |
1305 |
public: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1306 |
Klass* find_witness_subtype(Klass* context_type, KlassDepChange* changes = NULL) { |
1 | 1307 |
assert(doing_subtype_search(), "must set up a subtype search"); |
1308 |
// When looking for unexpected concrete types, |
|
1309 |
// do not look beneath expected ones. |
|
1310 |
const bool participants_hide_witnesses = true; |
|
1311 |
// CX > CC > C' is OK, even if C' is new. |
|
1312 |
// CX > { CC, C' } is not OK if C' is new, and C' is the witness. |
|
1313 |
if (changes != NULL) { |
|
1314 |
return find_witness_in(*changes, context_type, participants_hide_witnesses); |
|
1315 |
} else { |
|
1316 |
return find_witness_anywhere(context_type, participants_hide_witnesses); |
|
1317 |
} |
|
1318 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1319 |
Klass* find_witness_definer(Klass* context_type, KlassDepChange* changes = NULL) { |
1 | 1320 |
assert(!doing_subtype_search(), "must set up a method definer search"); |
1321 |
// When looking for unexpected concrete methods, |
|
1322 |
// look beneath expected ones, to see if there are overrides. |
|
1323 |
const bool participants_hide_witnesses = true; |
|
1324 |
// CX.m > CC.m > C'.m is not OK, if C'.m is new, and C' is the witness. |
|
1325 |
if (changes != NULL) { |
|
1326 |
return find_witness_in(*changes, context_type, !participants_hide_witnesses); |
|
1327 |
} else { |
|
1328 |
return find_witness_anywhere(context_type, !participants_hide_witnesses); |
|
1329 |
} |
|
1330 |
} |
|
1331 |
}; |
|
1332 |
||
1333 |
#ifndef PRODUCT |
|
1334 |
static int deps_find_witness_calls = 0; |
|
1335 |
static int deps_find_witness_steps = 0; |
|
1336 |
static int deps_find_witness_recursions = 0; |
|
1337 |
static int deps_find_witness_singles = 0; |
|
1338 |
static int deps_find_witness_print = 0; // set to -1 to force a final print |
|
1339 |
static bool count_find_witness_calls() { |
|
1340 |
if (TraceDependencies || LogCompilation) { |
|
1341 |
int pcount = deps_find_witness_print + 1; |
|
1342 |
bool final_stats = (pcount == 0); |
|
1343 |
bool initial_call = (pcount == 1); |
|
1344 |
bool occasional_print = ((pcount & ((1<<10) - 1)) == 0); |
|
1345 |
if (pcount < 0) pcount = 1; // crude overflow protection |
|
1346 |
deps_find_witness_print = pcount; |
|
1347 |
if (VerifyDependencies && initial_call) { |
|
1348 |
tty->print_cr("Warning: TraceDependencies results may be inflated by VerifyDependencies"); |
|
1349 |
} |
|
1350 |
if (occasional_print || final_stats) { |
|
1351 |
// Every now and then dump a little info about dependency searching. |
|
1352 |
if (xtty != NULL) { |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4493
diff
changeset
|
1353 |
ttyLocker ttyl; |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4493
diff
changeset
|
1354 |
xtty->elem("deps_find_witness calls='%d' steps='%d' recursions='%d' singles='%d'", |
1 | 1355 |
deps_find_witness_calls, |
1356 |
deps_find_witness_steps, |
|
1357 |
deps_find_witness_recursions, |
|
1358 |
deps_find_witness_singles); |
|
1359 |
} |
|
1360 |
if (final_stats || (TraceDependencies && WizardMode)) { |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4493
diff
changeset
|
1361 |
ttyLocker ttyl; |
1 | 1362 |
tty->print_cr("Dependency check (find_witness) " |
1363 |
"calls=%d, steps=%d (avg=%.1f), recursions=%d, singles=%d", |
|
1364 |
deps_find_witness_calls, |
|
1365 |
deps_find_witness_steps, |
|
1366 |
(double)deps_find_witness_steps / deps_find_witness_calls, |
|
1367 |
deps_find_witness_recursions, |
|
1368 |
deps_find_witness_singles); |
|
1369 |
} |
|
1370 |
} |
|
1371 |
return true; |
|
1372 |
} |
|
1373 |
return false; |
|
1374 |
} |
|
1375 |
#else |
|
1376 |
#define count_find_witness_calls() (0) |
|
1377 |
#endif //PRODUCT |
|
1378 |
||
1379 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1380 |
Klass* ClassHierarchyWalker::find_witness_in(KlassDepChange& changes, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1381 |
Klass* context_type, |
1 | 1382 |
bool participants_hide_witnesses) { |
1383 |
assert(changes.involves_context(context_type), "irrelevant dependency"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1384 |
Klass* new_type = changes.new_type(); |
1 | 1385 |
|
18073
f02460441ddc
8014431: cleanup warnings indicated by the -Wunused-value compiler option on linux
ccheung
parents:
14490
diff
changeset
|
1386 |
(void)count_find_witness_calls(); |
1 | 1387 |
NOT_PRODUCT(deps_find_witness_singles++); |
1388 |
||
1389 |
// Current thread must be in VM (not native mode, as in CI): |
|
1390 |
assert(must_be_in_vm(), "raw oops here"); |
|
1391 |
// Must not move the class hierarchy during this check: |
|
1392 |
assert_locked_or_safepoint(Compile_lock); |
|
1393 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1394 |
int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); |
203 | 1395 |
if (nof_impls > 1) { |
1396 |
// Avoid this case: *I.m > { A.m, C }; B.m > C |
|
1397 |
// %%% Until this is fixed more systematically, bail out. |
|
1398 |
// See corresponding comment in find_witness_anywhere. |
|
1399 |
return context_type; |
|
1400 |
} |
|
1401 |
||
1 | 1402 |
assert(!is_participant(new_type), "only old classes are participants"); |
1403 |
if (participants_hide_witnesses) { |
|
1404 |
// If the new type is a subtype of a participant, we are done. |
|
1405 |
for (int i = 0; i < num_participants(); i++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1406 |
Klass* part = participant(i); |
1 | 1407 |
if (part == NULL) continue; |
14488 | 1408 |
assert(changes.involves_context(part) == new_type->is_subtype_of(part), |
1 | 1409 |
"correct marking of participants, b/c new_type is unique"); |
1410 |
if (changes.involves_context(part)) { |
|
1411 |
// new guy is protected from this check by previous participant |
|
1412 |
return NULL; |
|
1413 |
} |
|
1414 |
} |
|
1415 |
} |
|
1416 |
||
1417 |
if (is_witness(new_type) && |
|
1418 |
!ignore_witness(new_type)) { |
|
1419 |
return new_type; |
|
1420 |
} |
|
1421 |
||
1422 |
return NULL; |
|
1423 |
} |
|
1424 |
||
1425 |
||
1426 |
// Walk hierarchy under a context type, looking for unexpected types. |
|
1427 |
// Do not report participant types, and recursively walk beneath |
|
1428 |
// them only if participants_hide_witnesses is false. |
|
1429 |
// If top_level_call is false, skip testing the context type, |
|
1430 |
// because the caller has already considered it. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1431 |
Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type, |
1 | 1432 |
bool participants_hide_witnesses, |
1433 |
bool top_level_call) { |
|
1434 |
// Current thread must be in VM (not native mode, as in CI): |
|
1435 |
assert(must_be_in_vm(), "raw oops here"); |
|
1436 |
// Must not move the class hierarchy during this check: |
|
1437 |
assert_locked_or_safepoint(Compile_lock); |
|
1438 |
||
1439 |
bool do_counts = count_find_witness_calls(); |
|
1440 |
||
1441 |
// Check the root of the sub-hierarchy first. |
|
1442 |
if (top_level_call) { |
|
1443 |
if (do_counts) { |
|
1444 |
NOT_PRODUCT(deps_find_witness_calls++); |
|
1445 |
NOT_PRODUCT(deps_find_witness_steps++); |
|
1446 |
} |
|
1447 |
if (is_participant(context_type)) { |
|
1448 |
if (participants_hide_witnesses) return NULL; |
|
1449 |
// else fall through to search loop... |
|
1450 |
} else if (is_witness(context_type) && !ignore_witness(context_type)) { |
|
1451 |
// The context is an abstract class or interface, to start with. |
|
1452 |
return context_type; |
|
1453 |
} |
|
1454 |
} |
|
1455 |
||
1456 |
// Now we must check each implementor and each subclass. |
|
1457 |
// Use a short worklist to avoid blowing the stack. |
|
1458 |
// Each worklist entry is a *chain* of subklass siblings to process. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1459 |
const int CHAINMAX = 100; // >= 1 + InstanceKlass::implementors_limit |
1 | 1460 |
Klass* chains[CHAINMAX]; |
1461 |
int chaini = 0; // index into worklist |
|
1462 |
Klass* chain; // scratch variable |
|
1463 |
#define ADD_SUBCLASS_CHAIN(k) { \ |
|
1464 |
assert(chaini < CHAINMAX, "oob"); \ |
|
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1465 |
chain = k->subklass(); \ |
1 | 1466 |
if (chain != NULL) chains[chaini++] = chain; } |
1467 |
||
1468 |
// Look for non-abstract subclasses. |
|
1469 |
// (Note: Interfaces do not have subclasses.) |
|
1470 |
ADD_SUBCLASS_CHAIN(context_type); |
|
1471 |
||
1472 |
// If it is an interface, search its direct implementors. |
|
1473 |
// (Their subclasses are additional indirect implementors. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1474 |
// See InstanceKlass::add_implementor.) |
1 | 1475 |
// (Note: nof_implementors is always zero for non-interfaces.) |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1476 |
if (top_level_call) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1477 |
int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1478 |
if (nof_impls > 1) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1479 |
// Avoid this case: *I.m > { A.m, C }; B.m > C |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1480 |
// Here, I.m has 2 concrete implementations, but m appears unique |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1481 |
// as A.m, because the search misses B.m when checking C. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1482 |
// The inherited method B.m was getting missed by the walker |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1483 |
// when interface 'I' was the starting point. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1484 |
// %%% Until this is fixed more systematically, bail out. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1485 |
// (Old CHA had the same limitation.) |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1486 |
return context_type; |
1 | 1487 |
} |
27700
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1488 |
if (nof_impls > 0) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1489 |
Klass* impl = InstanceKlass::cast(context_type)->implementor(); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1490 |
assert(impl != NULL, "just checking"); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1491 |
// If impl is the same as the context_type, then more than one |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1492 |
// implementor has seen. No exact info in this case. |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1493 |
if (impl == context_type) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1494 |
return context_type; // report an inexact witness to this sad affair |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1495 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1496 |
if (do_counts) |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1497 |
{ NOT_PRODUCT(deps_find_witness_steps++); } |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1498 |
if (is_participant(impl)) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1499 |
if (!participants_hide_witnesses) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1500 |
ADD_SUBCLASS_CHAIN(impl); |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1501 |
} |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1502 |
} else if (is_witness(impl) && !ignore_witness(impl)) { |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1503 |
return impl; |
a402738ebfcf
8050079: crash while compiling java.lang.ref.Finalizer::runFinalizer
thartmann
parents:
26914
diff
changeset
|
1504 |
} else { |
12369
48fd3da4025c
7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents:
11440
diff
changeset
|
1505 |
ADD_SUBCLASS_CHAIN(impl); |
48fd3da4025c
7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents:
11440
diff
changeset
|
1506 |
} |
1 | 1507 |
} |
1508 |
} |
|
1509 |
||
1510 |
// Recursively process each non-trivial sibling chain. |
|
1511 |
while (chaini > 0) { |
|
1512 |
Klass* chain = chains[--chaini]; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1513 |
for (Klass* sub = chain; sub != NULL; sub = sub->next_sibling()) { |
1 | 1514 |
if (do_counts) { NOT_PRODUCT(deps_find_witness_steps++); } |
1515 |
if (is_participant(sub)) { |
|
1516 |
if (participants_hide_witnesses) continue; |
|
1517 |
// else fall through to process this guy's subclasses |
|
1518 |
} else if (is_witness(sub) && !ignore_witness(sub)) { |
|
1519 |
return sub; |
|
1520 |
} |
|
1521 |
if (chaini < (VerifyDependencies? 2: CHAINMAX)) { |
|
1522 |
// Fast path. (Partially disabled if VerifyDependencies.) |
|
1523 |
ADD_SUBCLASS_CHAIN(sub); |
|
1524 |
} else { |
|
1525 |
// Worklist overflow. Do a recursive call. Should be rare. |
|
1526 |
// The recursive call will have its own worklist, of course. |
|
1527 |
// (Note that sub has already been tested, so that there is |
|
1528 |
// no need for the recursive call to re-test. That's handy, |
|
1529 |
// since the recursive call sees sub as the context_type.) |
|
1530 |
if (do_counts) { NOT_PRODUCT(deps_find_witness_recursions++); } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1531 |
Klass* witness = find_witness_anywhere(sub, |
1 | 1532 |
participants_hide_witnesses, |
1533 |
/*top_level_call=*/ false); |
|
1534 |
if (witness != NULL) return witness; |
|
1535 |
} |
|
1536 |
} |
|
1537 |
} |
|
1538 |
||
1539 |
// No witness found. The dependency remains unbroken. |
|
1540 |
return NULL; |
|
1541 |
#undef ADD_SUBCLASS_CHAIN |
|
1542 |
} |
|
1543 |
||
1544 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1545 |
bool Dependencies::is_concrete_klass(Klass* k) { |
14488 | 1546 |
if (k->is_abstract()) return false; |
1 | 1547 |
// %%% We could treat classes which are concrete but |
1548 |
// have not yet been instantiated as virtually abstract. |
|
1549 |
// This would require a deoptimization barrier on first instantiation. |
|
1550 |
//if (k->is_not_instantiated()) return false; |
|
1551 |
return true; |
|
1552 |
} |
|
1553 |
||
28514 | 1554 |
bool Dependencies::is_concrete_method(Method* m, Klass * k) { |
1555 |
// NULL is not a concrete method, |
|
1556 |
// statics are irrelevant to virtual call sites, |
|
1557 |
// abstract methods are not concrete, |
|
1558 |
// overpass (error) methods are not concrete if k is abstract |
|
1559 |
// |
|
1560 |
// note "true" is conservative answer -- |
|
1561 |
// overpass clause is false if k == NULL, implies return true if |
|
1562 |
// answer depends on overpass clause. |
|
1563 |
return ! ( m == NULL || m -> is_static() || m -> is_abstract() || |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
1564 |
(m->is_overpass() && k != NULL && k -> is_abstract()) ); |
1 | 1565 |
} |
1566 |
||
1567 |
||
1568 |
Klass* Dependencies::find_finalizable_subclass(Klass* k) { |
|
1569 |
if (k->is_interface()) return NULL; |
|
1570 |
if (k->has_finalizer()) return k; |
|
1571 |
k = k->subklass(); |
|
1572 |
while (k != NULL) { |
|
1573 |
Klass* result = find_finalizable_subclass(k); |
|
1574 |
if (result != NULL) return result; |
|
1575 |
k = k->next_sibling(); |
|
1576 |
} |
|
1577 |
return NULL; |
|
1578 |
} |
|
1579 |
||
1580 |
||
1581 |
bool Dependencies::is_concrete_klass(ciInstanceKlass* k) { |
|
1582 |
if (k->is_abstract()) return false; |
|
10984
bca73db4935e
7105305: assert check_method_context proper context
never
parents:
10503
diff
changeset
|
1583 |
// We could also return false if k does not yet appear to be |
1 | 1584 |
// instantiated, if the VM version supports this distinction also. |
1585 |
//if (k->is_not_instantiated()) return false; |
|
1586 |
return true; |
|
1587 |
} |
|
1588 |
||
1589 |
bool Dependencies::has_finalizable_subclass(ciInstanceKlass* k) { |
|
1590 |
return k->has_finalizable_subclass(); |
|
1591 |
} |
|
1592 |
||
1593 |
||
1594 |
// Any use of the contents (bytecodes) of a method must be |
|
1595 |
// marked by an "evol_method" dependency, if those contents |
|
1596 |
// can change. (Note: A method is always dependent on itself.) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1597 |
Klass* Dependencies::check_evol_method(Method* m) { |
1 | 1598 |
assert(must_be_in_vm(), "raw oops here"); |
1599 |
// Did somebody do a JVMTI RedefineClasses while our backs were turned? |
|
1600 |
// Or is there a now a breakpoint? |
|
1601 |
// (Assumes compiled code cannot handle bkpts; change if UseFastBreakpoints.) |
|
1602 |
if (m->is_old() |
|
1603 |
|| m->number_of_breakpoints() > 0) { |
|
1604 |
return m->method_holder(); |
|
1605 |
} else { |
|
1606 |
return NULL; |
|
1607 |
} |
|
1608 |
} |
|
1609 |
||
1610 |
// This is a strong assertion: It is that the given type |
|
1611 |
// has no subtypes whatever. It is most useful for |
|
1612 |
// optimizing checks on reflected types or on array types. |
|
1613 |
// (Checks on types which are derived from real instances |
|
1614 |
// can be optimized more strongly than this, because we |
|
1615 |
// know that the checked type comes from a concrete type, |
|
1616 |
// and therefore we can disregard abstract types.) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1617 |
Klass* Dependencies::check_leaf_type(Klass* ctxk) { |
1 | 1618 |
assert(must_be_in_vm(), "raw oops here"); |
1619 |
assert_locked_or_safepoint(Compile_lock); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1620 |
InstanceKlass* ctx = InstanceKlass::cast(ctxk); |
1 | 1621 |
Klass* sub = ctx->subklass(); |
1622 |
if (sub != NULL) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1623 |
return sub; |
1 | 1624 |
} else if (ctx->nof_implementors() != 0) { |
1625 |
// if it is an interface, it must be unimplemented |
|
1626 |
// (if it is not an interface, nof_implementors is always zero) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1627 |
Klass* impl = ctx->implementor(); |
12369
48fd3da4025c
7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents:
11440
diff
changeset
|
1628 |
assert(impl != NULL, "must be set"); |
48fd3da4025c
7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents:
11440
diff
changeset
|
1629 |
return impl; |
1 | 1630 |
} else { |
1631 |
return NULL; |
|
1632 |
} |
|
1633 |
} |
|
1634 |
||
1635 |
// Test the assertion that conck is the only concrete subtype* of ctxk. |
|
1636 |
// The type conck itself is allowed to have have further concrete subtypes. |
|
1637 |
// This allows the compiler to narrow occurrences of ctxk by conck, |
|
1638 |
// when dealing with the types of actual instances. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1639 |
Klass* Dependencies::check_abstract_with_unique_concrete_subtype(Klass* ctxk, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1640 |
Klass* conck, |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1641 |
KlassDepChange* changes) { |
1 | 1642 |
ClassHierarchyWalker wf(conck); |
1643 |
return wf.find_witness_subtype(ctxk, changes); |
|
1644 |
} |
|
1645 |
||
1646 |
// If a non-concrete class has no concrete subtypes, it is not (yet) |
|
1647 |
// instantiatable. This can allow the compiler to make some paths go |
|
1648 |
// dead, if they are gated by a test of the type. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1649 |
Klass* Dependencies::check_abstract_with_no_concrete_subtype(Klass* ctxk, |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1650 |
KlassDepChange* changes) { |
1 | 1651 |
// Find any concrete subtype, with no participants: |
1652 |
ClassHierarchyWalker wf; |
|
1653 |
return wf.find_witness_subtype(ctxk, changes); |
|
1654 |
} |
|
1655 |
||
1656 |
||
1657 |
// If a concrete class has no concrete subtypes, it can always be |
|
1658 |
// exactly typed. This allows the use of a cheaper type test. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1659 |
Klass* Dependencies::check_concrete_with_no_concrete_subtype(Klass* ctxk, |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1660 |
KlassDepChange* changes) { |
1 | 1661 |
// Find any concrete subtype, with only the ctxk as participant: |
1662 |
ClassHierarchyWalker wf(ctxk); |
|
1663 |
return wf.find_witness_subtype(ctxk, changes); |
|
1664 |
} |
|
1665 |
||
1666 |
||
1667 |
// Find the unique concrete proper subtype of ctxk, or NULL if there |
|
1668 |
// is more than one concrete proper subtype. If there are no concrete |
|
1669 |
// proper subtypes, return ctxk itself, whether it is concrete or not. |
|
1670 |
// The returned subtype is allowed to have have further concrete subtypes. |
|
1671 |
// That is, return CC1 for CX > CC1 > CC2, but NULL for CX > { CC1, CC2 }. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1672 |
Klass* Dependencies::find_unique_concrete_subtype(Klass* ctxk) { |
1 | 1673 |
ClassHierarchyWalker wf(ctxk); // Ignore ctxk when walking. |
1674 |
wf.record_witnesses(1); // Record one other witness when walking. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1675 |
Klass* wit = wf.find_witness_subtype(ctxk); |
1 | 1676 |
if (wit != NULL) return NULL; // Too many witnesses. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1677 |
Klass* conck = wf.participant(0); |
1 | 1678 |
if (conck == NULL) { |
1679 |
#ifndef PRODUCT |
|
1680 |
// Make sure the dependency mechanism will pass this discovery: |
|
1681 |
if (VerifyDependencies) { |
|
1682 |
// Turn off dependency tracing while actually testing deps. |
|
1683 |
FlagSetting fs(TraceDependencies, false); |
|
1684 |
if (!Dependencies::is_concrete_klass(ctxk)) { |
|
1685 |
guarantee(NULL == |
|
1686 |
(void *)check_abstract_with_no_concrete_subtype(ctxk), |
|
1687 |
"verify dep."); |
|
1688 |
} else { |
|
1689 |
guarantee(NULL == |
|
1690 |
(void *)check_concrete_with_no_concrete_subtype(ctxk), |
|
1691 |
"verify dep."); |
|
1692 |
} |
|
1693 |
} |
|
1694 |
#endif //PRODUCT |
|
1695 |
return ctxk; // Return ctxk as a flag for "no subtypes". |
|
1696 |
} else { |
|
1697 |
#ifndef PRODUCT |
|
1698 |
// Make sure the dependency mechanism will pass this discovery: |
|
1699 |
if (VerifyDependencies) { |
|
1700 |
// Turn off dependency tracing while actually testing deps. |
|
1701 |
FlagSetting fs(TraceDependencies, false); |
|
1702 |
if (!Dependencies::is_concrete_klass(ctxk)) { |
|
1703 |
guarantee(NULL == (void *) |
|
1704 |
check_abstract_with_unique_concrete_subtype(ctxk, conck), |
|
1705 |
"verify dep."); |
|
1706 |
} |
|
1707 |
} |
|
1708 |
#endif //PRODUCT |
|
1709 |
return conck; |
|
1710 |
} |
|
1711 |
} |
|
1712 |
||
1713 |
// Test the assertion that the k[12] are the only concrete subtypes of ctxk, |
|
1714 |
// except possibly for further subtypes of k[12] themselves. |
|
1715 |
// The context type must be abstract. The types k1 and k2 are themselves |
|
1716 |
// allowed to have further concrete subtypes. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1717 |
Klass* Dependencies::check_abstract_with_exclusive_concrete_subtypes( |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1718 |
Klass* ctxk, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1719 |
Klass* k1, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1720 |
Klass* k2, |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1721 |
KlassDepChange* changes) { |
1 | 1722 |
ClassHierarchyWalker wf; |
1723 |
wf.add_participant(k1); |
|
1724 |
wf.add_participant(k2); |
|
1725 |
return wf.find_witness_subtype(ctxk, changes); |
|
1726 |
} |
|
1727 |
||
1728 |
// Search ctxk for concrete implementations. If there are klen or fewer, |
|
1729 |
// pack them into the given array and return the number. |
|
1730 |
// Otherwise, return -1, meaning the given array would overflow. |
|
1731 |
// (Note that a return of 0 means there are exactly no concrete subtypes.) |
|
1732 |
// In this search, if ctxk is concrete, it will be reported alone. |
|
1733 |
// For any type CC reported, no proper subtypes of CC will be reported. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1734 |
int Dependencies::find_exclusive_concrete_subtypes(Klass* ctxk, |
1 | 1735 |
int klen, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1736 |
Klass* karray[]) { |
1 | 1737 |
ClassHierarchyWalker wf; |
1738 |
wf.record_witnesses(klen); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1739 |
Klass* wit = wf.find_witness_subtype(ctxk); |
1 | 1740 |
if (wit != NULL) return -1; // Too many witnesses. |
1741 |
int num = wf.num_participants(); |
|
1742 |
assert(num <= klen, "oob"); |
|
1743 |
// Pack the result array with the good news. |
|
1744 |
for (int i = 0; i < num; i++) |
|
1745 |
karray[i] = wf.participant(i); |
|
1746 |
#ifndef PRODUCT |
|
1747 |
// Make sure the dependency mechanism will pass this discovery: |
|
1748 |
if (VerifyDependencies) { |
|
1749 |
// Turn off dependency tracing while actually testing deps. |
|
1750 |
FlagSetting fs(TraceDependencies, false); |
|
1751 |
switch (Dependencies::is_concrete_klass(ctxk)? -1: num) { |
|
1752 |
case -1: // ctxk was itself concrete |
|
1753 |
guarantee(num == 1 && karray[0] == ctxk, "verify dep."); |
|
1754 |
break; |
|
1755 |
case 0: |
|
1756 |
guarantee(NULL == (void *)check_abstract_with_no_concrete_subtype(ctxk), |
|
1757 |
"verify dep."); |
|
1758 |
break; |
|
1759 |
case 1: |
|
1760 |
guarantee(NULL == (void *) |
|
1761 |
check_abstract_with_unique_concrete_subtype(ctxk, karray[0]), |
|
1762 |
"verify dep."); |
|
1763 |
break; |
|
1764 |
case 2: |
|
1765 |
guarantee(NULL == (void *) |
|
1766 |
check_abstract_with_exclusive_concrete_subtypes(ctxk, |
|
1767 |
karray[0], |
|
1768 |
karray[1]), |
|
1769 |
"verify dep."); |
|
1770 |
break; |
|
1771 |
default: |
|
1772 |
ShouldNotReachHere(); // klen > 2 yet supported |
|
1773 |
} |
|
1774 |
} |
|
1775 |
#endif //PRODUCT |
|
1776 |
return num; |
|
1777 |
} |
|
1778 |
||
1779 |
// If a class (or interface) has a unique concrete method uniqm, return NULL. |
|
1780 |
// Otherwise, return a class that contains an interfering method. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1781 |
Klass* Dependencies::check_unique_concrete_method(Klass* ctxk, Method* uniqm, |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1782 |
KlassDepChange* changes) { |
1 | 1783 |
// Here is a missing optimization: If uniqm->is_final(), |
1784 |
// we don't really need to search beneath it for overrides. |
|
1785 |
// This is probably not important, since we don't use dependencies |
|
1786 |
// to track final methods. (They can't be "definalized".) |
|
1787 |
ClassHierarchyWalker wf(uniqm->method_holder(), uniqm); |
|
1788 |
return wf.find_witness_definer(ctxk, changes); |
|
1789 |
} |
|
1790 |
||
1791 |
// Find the set of all non-abstract methods under ctxk that match m. |
|
1792 |
// (The method m must be defined or inherited in ctxk.) |
|
1793 |
// Include m itself in the set, unless it is abstract. |
|
1794 |
// If this set has exactly one element, return that element. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1795 |
Method* Dependencies::find_unique_concrete_method(Klass* ctxk, Method* m) { |
24484
4a37a32e36a9
6563994: assert(wf.check_method_context(ctxk, m), "proper context") failed
bharadwaj
parents:
24351
diff
changeset
|
1796 |
// Return NULL if m is marked old; must have been a redefined method. |
4a37a32e36a9
6563994: assert(wf.check_method_context(ctxk, m), "proper context") failed
bharadwaj
parents:
24351
diff
changeset
|
1797 |
if (m->is_old()) { |
4a37a32e36a9
6563994: assert(wf.check_method_context(ctxk, m), "proper context") failed
bharadwaj
parents:
24351
diff
changeset
|
1798 |
return NULL; |
4a37a32e36a9
6563994: assert(wf.check_method_context(ctxk, m), "proper context") failed
bharadwaj
parents:
24351
diff
changeset
|
1799 |
} |
1 | 1800 |
ClassHierarchyWalker wf(m); |
1801 |
assert(wf.check_method_context(ctxk, m), "proper context"); |
|
1802 |
wf.record_witnesses(1); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1803 |
Klass* wit = wf.find_witness_definer(ctxk); |
1 | 1804 |
if (wit != NULL) return NULL; // Too many witnesses. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1805 |
Method* fm = wf.found_method(0); // Will be NULL if num_parts == 0. |
28514 | 1806 |
if (Dependencies::is_concrete_method(m, ctxk)) { |
1 | 1807 |
if (fm == NULL) { |
1808 |
// It turns out that m was always the only implementation. |
|
1809 |
fm = m; |
|
1810 |
} else if (fm != m) { |
|
1811 |
// Two conflicting implementations after all. |
|
1812 |
// (This can happen if m is inherited into ctxk and fm overrides it.) |
|
1813 |
return NULL; |
|
1814 |
} |
|
1815 |
} |
|
1816 |
#ifndef PRODUCT |
|
1817 |
// Make sure the dependency mechanism will pass this discovery: |
|
1818 |
if (VerifyDependencies && fm != NULL) { |
|
1819 |
guarantee(NULL == (void *)check_unique_concrete_method(ctxk, fm), |
|
1820 |
"verify dep."); |
|
1821 |
} |
|
1822 |
#endif //PRODUCT |
|
1823 |
return fm; |
|
1824 |
} |
|
1825 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1826 |
Klass* Dependencies::check_exclusive_concrete_methods(Klass* ctxk, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1827 |
Method* m1, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1828 |
Method* m2, |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1829 |
KlassDepChange* changes) { |
1 | 1830 |
ClassHierarchyWalker wf(m1); |
1831 |
wf.add_participant(m1->method_holder()); |
|
1832 |
wf.add_participant(m2->method_holder()); |
|
1833 |
return wf.find_witness_definer(ctxk, changes); |
|
1834 |
} |
|
1835 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1836 |
Klass* Dependencies::check_has_no_finalizable_subclasses(Klass* ctxk, KlassDepChange* changes) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1837 |
Klass* search_at = ctxk; |
1 | 1838 |
if (changes != NULL) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1839 |
search_at = changes->new_type(); // just look at the new bit |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1840 |
return find_finalizable_subclass(search_at); |
1 | 1841 |
} |
1842 |
||
31037
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30296
diff
changeset
|
1843 |
Klass* Dependencies::check_call_site_target_value(oop call_site, oop method_handle, CallSiteDepChange* changes) { |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49192
diff
changeset
|
1844 |
assert(call_site != NULL, "sanity"); |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49192
diff
changeset
|
1845 |
assert(method_handle != NULL, "sanity"); |
30296
95baefac8485
8057967: CallSite dependency tracking scales devastatingly poorly
vlivanov
parents:
30195
diff
changeset
|
1846 |
assert(call_site->is_a(SystemDictionary::CallSite_klass()), "sanity"); |
95baefac8485
8057967: CallSite dependency tracking scales devastatingly poorly
vlivanov
parents:
30195
diff
changeset
|
1847 |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1848 |
if (changes == NULL) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1849 |
// Validate all CallSites |
49658 | 1850 |
if (!oopDesc::equals(java_lang_invoke_CallSite::target(call_site), method_handle)) |
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1851 |
return call_site->klass(); // assertion failed |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1852 |
} else { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1853 |
// Validate the given CallSite |
49658 | 1854 |
if (oopDesc::equals(call_site, changes->call_site()) && !oopDesc::equals(java_lang_invoke_CallSite::target(call_site), changes->method_handle())) { |
1855 |
assert(!oopDesc::equals(method_handle, changes->method_handle()), "must be"); |
|
10503
04b74421bdea
7083184: JSR 292: don't store context class argument with call site dependencies
twisti
parents:
10265
diff
changeset
|
1856 |
return call_site->klass(); // assertion failed |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1857 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1858 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1859 |
return NULL; // assertion still valid |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1860 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1861 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1862 |
void Dependencies::DepStream::trace_and_log_witness(Klass* witness) { |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1863 |
if (witness != NULL) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1864 |
if (TraceDependencies) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1865 |
print_dependency(witness, /*verbose=*/ true); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1866 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1867 |
// The following is a no-op unless logging is enabled: |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1868 |
log_dependency(witness); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1869 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1870 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1871 |
|
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1872 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1873 |
Klass* Dependencies::DepStream::check_klass_dependency(KlassDepChange* changes) { |
1 | 1874 |
assert_locked_or_safepoint(Compile_lock); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1875 |
Dependencies::check_valid_dependency_type(type()); |
1 | 1876 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1877 |
Klass* witness = NULL; |
1 | 1878 |
switch (type()) { |
1879 |
case evol_method: |
|
1880 |
witness = check_evol_method(method_argument(0)); |
|
1881 |
break; |
|
1882 |
case leaf_type: |
|
1883 |
witness = check_leaf_type(context_type()); |
|
1884 |
break; |
|
1885 |
case abstract_with_unique_concrete_subtype: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1886 |
witness = check_abstract_with_unique_concrete_subtype(context_type(), type_argument(1), changes); |
1 | 1887 |
break; |
1888 |
case abstract_with_no_concrete_subtype: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1889 |
witness = check_abstract_with_no_concrete_subtype(context_type(), changes); |
1 | 1890 |
break; |
1891 |
case concrete_with_no_concrete_subtype: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1892 |
witness = check_concrete_with_no_concrete_subtype(context_type(), changes); |
1 | 1893 |
break; |
1894 |
case unique_concrete_method: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1895 |
witness = check_unique_concrete_method(context_type(), method_argument(1), changes); |
1 | 1896 |
break; |
1897 |
case abstract_with_exclusive_concrete_subtypes_2: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1898 |
witness = check_abstract_with_exclusive_concrete_subtypes(context_type(), type_argument(1), type_argument(2), changes); |
1 | 1899 |
break; |
1900 |
case exclusive_concrete_methods_2: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1901 |
witness = check_exclusive_concrete_methods(context_type(), method_argument(1), method_argument(2), changes); |
1 | 1902 |
break; |
1903 |
case no_finalizable_subclasses: |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1904 |
witness = check_has_no_finalizable_subclasses(context_type(), changes); |
1 | 1905 |
break; |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1906 |
default: |
1 | 1907 |
witness = NULL; |
1908 |
break; |
|
1909 |
} |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1910 |
trace_and_log_witness(witness); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1911 |
return witness; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1912 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1913 |
|
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1914 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1915 |
Klass* Dependencies::DepStream::check_call_site_dependency(CallSiteDepChange* changes) { |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1916 |
assert_locked_or_safepoint(Compile_lock); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1917 |
Dependencies::check_valid_dependency_type(type()); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1918 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1919 |
Klass* witness = NULL; |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1920 |
switch (type()) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1921 |
case call_site_target_value: |
31037
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30296
diff
changeset
|
1922 |
witness = check_call_site_target_value(argument_oop(0), argument_oop(1), changes); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1923 |
break; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1924 |
default: |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1925 |
witness = NULL; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1926 |
break; |
1 | 1927 |
} |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1928 |
trace_and_log_witness(witness); |
1 | 1929 |
return witness; |
1930 |
} |
|
1931 |
||
1932 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1933 |
Klass* Dependencies::DepStream::spot_check_dependency_at(DepChange& changes) { |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1934 |
// Handle klass dependency |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1935 |
if (changes.is_klass_change() && changes.as_klass_change()->involves_context(context_type())) |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1936 |
return check_klass_dependency(changes.as_klass_change()); |
1 | 1937 |
|
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1938 |
// Handle CallSite dependency |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1939 |
if (changes.is_call_site_change()) |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1940 |
return check_call_site_dependency(changes.as_call_site_change()); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1941 |
|
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1942 |
// irrelevant dependency; skip it |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1943 |
return NULL; |
1 | 1944 |
} |
1945 |
||
1946 |
||
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1947 |
void DepChange::print() { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1948 |
int nsup = 0, nint = 0; |
1 | 1949 |
for (ContextStream str(*this); str.next(); ) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1950 |
Klass* k = str.klass(); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1951 |
switch (str.change_type()) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1952 |
case Change_new_type: |
33602 | 1953 |
tty->print_cr(" dependee = %s", k->external_name()); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1954 |
break; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1955 |
case Change_new_sub: |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1956 |
if (!WizardMode) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1957 |
++nsup; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1958 |
} else { |
33602 | 1959 |
tty->print_cr(" context super = %s", k->external_name()); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1960 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1961 |
break; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1962 |
case Change_new_impl: |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1963 |
if (!WizardMode) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1964 |
++nint; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1965 |
} else { |
33602 | 1966 |
tty->print_cr(" context interface = %s", k->external_name()); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1967 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1968 |
break; |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
1969 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46271
diff
changeset
|
1970 |
break; |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1971 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1972 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1973 |
if (nsup + nint != 0) { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1974 |
tty->print_cr(" context supers = %d, interfaces = %d", nsup, nint); |
1 | 1975 |
} |
1976 |
} |
|
1977 |
||
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1978 |
void DepChange::ContextStream::start() { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1979 |
Klass* new_type = _changes.is_klass_change() ? _changes.as_klass_change()->new_type() : (Klass*) NULL; |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1980 |
_change_type = (new_type == NULL ? NO_CHANGE : Start_Klass); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1981 |
_klass = new_type; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1982 |
_ti_base = NULL; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1983 |
_ti_index = 0; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
1984 |
_ti_limit = 0; |
1 | 1985 |
} |
1986 |
||
1987 |
bool DepChange::ContextStream::next() { |
|
1988 |
switch (_change_type) { |
|
1989 |
case Start_Klass: // initial state; _klass is the new type |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
1990 |
_ti_base = InstanceKlass::cast(_klass)->transitive_interfaces(); |
1 | 1991 |
_ti_index = 0; |
1992 |
_change_type = Change_new_type; |
|
1993 |
return true; |
|
1994 |
case Change_new_type: |
|
1995 |
// fall through: |
|
1996 |
_change_type = Change_new_sub; |
|
1997 |
case Change_new_sub: |
|
227
1d53148d4a4c
6598190: JPRT tests fail when run with -XX:+CheckUnhandledOops
sbohne
parents:
1
diff
changeset
|
1998 |
// 6598190: brackets workaround Sun Studio C++ compiler bug 6629277 |
1d53148d4a4c
6598190: JPRT tests fail when run with -XX:+CheckUnhandledOops
sbohne
parents:
1
diff
changeset
|
1999 |
{ |
33602 | 2000 |
_klass = _klass->super(); |
227
1d53148d4a4c
6598190: JPRT tests fail when run with -XX:+CheckUnhandledOops
sbohne
parents:
1
diff
changeset
|
2001 |
if (_klass != NULL) { |
1d53148d4a4c
6598190: JPRT tests fail when run with -XX:+CheckUnhandledOops
sbohne
parents:
1
diff
changeset
|
2002 |
return true; |
1d53148d4a4c
6598190: JPRT tests fail when run with -XX:+CheckUnhandledOops
sbohne
parents:
1
diff
changeset
|
2003 |
} |
1 | 2004 |
} |
2005 |
// else set up _ti_limit and fall through: |
|
2006 |
_ti_limit = (_ti_base == NULL) ? 0 : _ti_base->length(); |
|
2007 |
_change_type = Change_new_impl; |
|
2008 |
case Change_new_impl: |
|
2009 |
if (_ti_index < _ti_limit) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2010 |
_klass = _ti_base->at(_ti_index++); |
1 | 2011 |
return true; |
2012 |
} |
|
2013 |
// fall through: |
|
2014 |
_change_type = NO_CHANGE; // iterator is exhausted |
|
2015 |
case NO_CHANGE: |
|
2016 |
break; |
|
2017 |
default: |
|
2018 |
ShouldNotReachHere(); |
|
2019 |
} |
|
2020 |
return false; |
|
2021 |
} |
|
2022 |
||
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2023 |
void KlassDepChange::initialize() { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2024 |
// entire transaction must be under this lock: |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2025 |
assert_lock_strong(Compile_lock); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2026 |
|
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2027 |
// Mark all dependee and all its superclasses |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2028 |
// Mark transitive interfaces |
1 | 2029 |
for (ContextStream str(*this); str.next(); ) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2030 |
Klass* d = str.klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2031 |
assert(!InstanceKlass::cast(d)->is_marked_dependent(), "checking"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2032 |
InstanceKlass::cast(d)->set_is_marked_dependent(true); |
1 | 2033 |
} |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2034 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2035 |
|
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2036 |
KlassDepChange::~KlassDepChange() { |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2037 |
// Unmark all dependee and all its superclasses |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2038 |
// Unmark transitive interfaces |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2039 |
for (ContextStream str(*this); str.next(); ) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2040 |
Klass* d = str.klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2041 |
InstanceKlass::cast(d)->set_is_marked_dependent(false); |
1 | 2042 |
} |
2043 |
} |
|
2044 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2045 |
bool KlassDepChange::involves_context(Klass* k) { |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
2046 |
if (k == NULL || !k->is_instance_klass()) { |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2047 |
return false; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2048 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12369
diff
changeset
|
2049 |
InstanceKlass* ik = InstanceKlass::cast(k); |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2050 |
bool is_contained = ik->is_marked_dependent(); |
14488 | 2051 |
assert(is_contained == new_type()->is_subtype_of(k), |
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2052 |
"correct marking of potential context types"); |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2053 |
return is_contained; |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2054 |
} |
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
8921
diff
changeset
|
2055 |
|
1 | 2056 |
#ifndef PRODUCT |
2057 |
void Dependencies::print_statistics() { |
|
2058 |
if (deps_find_witness_print != 0) { |
|
2059 |
// Call one final time, to flush out the data. |
|
2060 |
deps_find_witness_print = -1; |
|
2061 |
count_find_witness_calls(); |
|
2062 |
} |
|
2063 |
} |
|
2064 |
#endif |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2065 |
|
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2066 |
CallSiteDepChange::CallSiteDepChange(Handle call_site, Handle method_handle) : |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2067 |
_call_site(call_site), |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2068 |
_method_handle(method_handle) { |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2069 |
assert(_call_site()->is_a(SystemDictionary::CallSite_klass()), "must be"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2070 |
assert(_method_handle.is_null() || _method_handle()->is_a(SystemDictionary::MethodHandle_klass()), "must be"); |
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
33611
diff
changeset
|
2071 |
} |