author | kvn |
Fri, 09 Mar 2018 10:15:22 -0800 | |
changeset 49370 | 81bc1dc36a53 |
parent 49358 | 0dc249f5c260 |
child 49371 | 59ad6672bf78 |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
48605
00d8c8d696e9
8194991: Null pointer dereference caused by c2v_getNextStackFrame
dlong
parents:
48400
diff
changeset
|
2 |
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
33160 | 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 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
#include "precompiled.hpp" |
|
25 |
#include "code/scopeDesc.hpp" |
|
26 |
#include "memory/oopFactory.hpp" |
|
49340
4e82736053ae
8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
49192
diff
changeset
|
27 |
#include "oops/cpCache.inline.hpp" |
33160 | 28 |
#include "oops/generateOopMap.hpp" |
49340
4e82736053ae
8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
49192
diff
changeset
|
29 |
#include "oops/method.inline.hpp" |
33160 | 30 |
#include "oops/objArrayOop.inline.hpp" |
49036
bc92debe57e4
8197999: Accessors in typeArrayOopDesc should use new Access API
rkennke
parents:
48826
diff
changeset
|
31 |
#include "oops/typeArrayOop.inline.hpp" |
33160 | 32 |
#include "compiler/compileBroker.hpp" |
33 |
#include "compiler/disassembler.hpp" |
|
34 |
#include "jvmci/jvmciCompilerToVM.hpp" |
|
35 |
#include "jvmci/jvmciCodeInstaller.hpp" |
|
49370
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
36 |
#include "jvmci/jvmciRuntime.hpp" |
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
37 |
#include "runtime/jniHandles.inline.hpp" |
37161
e881f320966e
8150015: Integrate TraceTime with Unified Logging more seamlessly
rehn
parents:
35913
diff
changeset
|
38 |
#include "runtime/timerTrace.hpp" |
33160 | 39 |
#include "runtime/vframe_hp.hpp" |
40 |
||
41 |
||
44092 | 42 |
void JNIHandleMark::push_jni_handle_block() { |
43 |
JavaThread* thread = JavaThread::current(); |
|
44 |
if (thread != NULL) { |
|
45 |
// Allocate a new block for JNI handles. |
|
46 |
// Inlined code from jni_PushLocalFrame() |
|
47 |
JNIHandleBlock* java_handles = ((JavaThread*)thread)->active_handles(); |
|
48 |
JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread); |
|
49 |
assert(compile_handles != NULL && java_handles != NULL, "should not be NULL"); |
|
50 |
compile_handles->set_pop_frame_link(java_handles); |
|
51 |
thread->set_active_handles(compile_handles); |
|
52 |
} |
|
53 |
} |
|
54 |
||
55 |
void JNIHandleMark::pop_jni_handle_block() { |
|
56 |
JavaThread* thread = JavaThread::current(); |
|
57 |
if (thread != NULL) { |
|
58 |
// Release our JNI handle block |
|
59 |
JNIHandleBlock* compile_handles = thread->active_handles(); |
|
60 |
JNIHandleBlock* java_handles = compile_handles->pop_frame_link(); |
|
61 |
thread->set_active_handles(java_handles); |
|
62 |
compile_handles->set_pop_frame_link(NULL); |
|
63 |
JNIHandleBlock::release_block(compile_handles, thread); // may block |
|
64 |
} |
|
65 |
} |
|
66 |
||
33160 | 67 |
// Entry to native method implementation that transitions current thread to '_thread_in_vm'. |
68 |
#define C2V_VMENTRY(result_type, name, signature) \ |
|
69 |
JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
|
70 |
TRACE_jvmci_1("CompilerToVM::" #name); \ |
|
71 |
TRACE_CALL(result_type, jvmci_ ## name signature) \ |
|
72 |
JVMCI_VM_ENTRY_MARK; \ |
|
73 |
||
74 |
#define C2V_END } |
|
75 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33160
diff
changeset
|
76 |
oop CompilerToVM::get_jvmci_method(const methodHandle& method, TRAPS) { |
33160 | 77 |
if (method() != NULL) { |
78 |
JavaValue result(T_OBJECT); |
|
79 |
JavaCallArguments args; |
|
80 |
args.push_long((jlong) (address) method()); |
|
81 |
JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_NULL); |
|
82 |
||
83 |
return (oop)result.get_jobject(); |
|
84 |
} |
|
85 |
return NULL; |
|
86 |
} |
|
87 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
88 |
oop CompilerToVM::get_jvmci_type(Klass* klass, TRAPS) { |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
89 |
if (klass != NULL) { |
33160 | 90 |
JavaValue result(T_OBJECT); |
91 |
JavaCallArguments args; |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
92 |
args.push_oop(Handle(THREAD, klass->java_mirror())); |
33160 | 93 |
JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL); |
94 |
||
95 |
return (oop)result.get_jobject(); |
|
96 |
} |
|
97 |
return NULL; |
|
98 |
} |
|
99 |
||
44092 | 100 |
|
49370
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
101 |
jobjectArray readConfiguration0(JNIEnv *env, TRAPS); |
43939 | 102 |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
103 |
C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env)) |
49370
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
104 |
jobjectArray config = readConfiguration0(env, CHECK_NULL); |
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
105 |
return config; |
43939 | 106 |
C2V_END |
107 |
||
108 |
C2V_VMENTRY(jobject, getFlagValue, (JNIEnv *, jobject c2vm, jobject name_handle)) |
|
109 |
#define RETURN_BOXED_LONG(value) oop box; jvalue p; p.j = (jlong) (value); box = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box); |
|
110 |
#define RETURN_BOXED_DOUBLE(value) oop box; jvalue p; p.d = (jdouble) (value); box = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box); |
|
46327 | 111 |
Handle name(THREAD, JNIHandles::resolve(name_handle)); |
43939 | 112 |
if (name.is_null()) { |
113 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
114 |
} |
|
115 |
ResourceMark rm; |
|
116 |
const char* cstring = java_lang_String::as_utf8_string(name()); |
|
117 |
Flag* flag = Flag::find_flag(cstring, strlen(cstring), /* allow_locked */ true, /* return_flag */ true); |
|
118 |
if (flag == NULL) { |
|
119 |
return c2vm; |
|
120 |
} |
|
121 |
if (flag->is_bool()) { |
|
122 |
jvalue prim; |
|
123 |
prim.z = flag->get_bool(); |
|
124 |
oop box = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL); |
|
125 |
return JNIHandles::make_local(THREAD, box); |
|
126 |
} else if (flag->is_ccstr()) { |
|
127 |
Handle value = java_lang_String::create_from_str(flag->get_ccstr(), CHECK_NULL); |
|
128 |
return JNIHandles::make_local(THREAD, value()); |
|
129 |
} else if (flag->is_intx()) { |
|
130 |
RETURN_BOXED_LONG(flag->get_intx()); |
|
131 |
} else if (flag->is_int()) { |
|
132 |
RETURN_BOXED_LONG(flag->get_int()); |
|
133 |
} else if (flag->is_uint()) { |
|
134 |
RETURN_BOXED_LONG(flag->get_uint()); |
|
135 |
} else if (flag->is_uint64_t()) { |
|
136 |
RETURN_BOXED_LONG(flag->get_uint64_t()); |
|
137 |
} else if (flag->is_size_t()) { |
|
138 |
RETURN_BOXED_LONG(flag->get_size_t()); |
|
139 |
} else if (flag->is_uintx()) { |
|
140 |
RETURN_BOXED_LONG(flag->get_uintx()); |
|
141 |
} else if (flag->is_double()) { |
|
142 |
RETURN_BOXED_DOUBLE(flag->get_double()); |
|
143 |
} else { |
|
144 |
JVMCI_ERROR_NULL("VM flag %s has unsupported type %s", flag->_name, flag->_type); |
|
145 |
} |
|
49370
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
146 |
#undef RETURN_BOXED_LONG |
81bc1dc36a53
8197235: src/hotspot/share/jvmci/jvmciCompilerToVM.cpp takes 4 minutes to compile on windows
kvn
parents:
49358
diff
changeset
|
147 |
#undef RETURN_BOXED_DOUBLE |
43939 | 148 |
C2V_END |
149 |
||
33160 | 150 |
C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jobject jvmci_method)) |
151 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
152 |
ResourceMark rm; |
|
153 |
||
154 |
int code_size = method->code_size(); |
|
155 |
typeArrayOop reconstituted_code = oopFactory::new_byteArray(code_size, CHECK_NULL); |
|
156 |
||
157 |
guarantee(method->method_holder()->is_rewritten(), "Method's holder should be rewritten"); |
|
158 |
// iterate over all bytecodes and replace non-Java bytecodes |
|
159 |
||
160 |
for (BytecodeStream s(method); s.next() != Bytecodes::_illegal; ) { |
|
161 |
Bytecodes::Code code = s.code(); |
|
162 |
Bytecodes::Code raw_code = s.raw_code(); |
|
163 |
int bci = s.bci(); |
|
164 |
int len = s.instruction_size(); |
|
165 |
||
166 |
// Restore original byte code. |
|
167 |
reconstituted_code->byte_at_put(bci, (jbyte) (s.is_wide()? Bytecodes::_wide : code)); |
|
168 |
if (len > 1) { |
|
169 |
memcpy(reconstituted_code->byte_at_addr(bci + 1), s.bcp()+1, len-1); |
|
170 |
} |
|
171 |
||
172 |
if (len > 1) { |
|
173 |
// Restore the big-endian constant pool indexes. |
|
174 |
// Cf. Rewriter::scan_method |
|
175 |
switch (code) { |
|
176 |
case Bytecodes::_getstatic: |
|
177 |
case Bytecodes::_putstatic: |
|
178 |
case Bytecodes::_getfield: |
|
179 |
case Bytecodes::_putfield: |
|
180 |
case Bytecodes::_invokevirtual: |
|
181 |
case Bytecodes::_invokespecial: |
|
182 |
case Bytecodes::_invokestatic: |
|
183 |
case Bytecodes::_invokeinterface: |
|
184 |
case Bytecodes::_invokehandle: { |
|
185 |
int cp_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
186 |
Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index); |
|
187 |
break; |
|
188 |
} |
|
189 |
||
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
190 |
case Bytecodes::_invokedynamic: { |
33160 | 191 |
int cp_index = Bytes::get_native_u4((address) reconstituted_code->byte_at_addr(bci + 1)); |
192 |
Bytes::put_Java_u4((address) reconstituted_code->byte_at_addr(bci + 1), (u4) cp_index); |
|
193 |
break; |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
194 |
} |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
195 |
|
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
196 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
197 |
break; |
33160 | 198 |
} |
199 |
||
200 |
// Not all ldc byte code are rewritten. |
|
201 |
switch (raw_code) { |
|
202 |
case Bytecodes::_fast_aldc: { |
|
203 |
int cpc_index = reconstituted_code->byte_at(bci + 1) & 0xff; |
|
204 |
int cp_index = method->constants()->object_to_cp_index(cpc_index); |
|
205 |
assert(cp_index < method->constants()->length(), "sanity check"); |
|
206 |
reconstituted_code->byte_at_put(bci + 1, (jbyte) cp_index); |
|
207 |
break; |
|
208 |
} |
|
209 |
||
210 |
case Bytecodes::_fast_aldc_w: { |
|
211 |
int cpc_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
212 |
int cp_index = method->constants()->object_to_cp_index(cpc_index); |
|
213 |
assert(cp_index < method->constants()->length(), "sanity check"); |
|
214 |
Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index); |
|
215 |
break; |
|
216 |
} |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
217 |
|
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
218 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
219 |
break; |
33160 | 220 |
} |
221 |
} |
|
222 |
} |
|
223 |
||
224 |
return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code); |
|
225 |
C2V_END |
|
226 |
||
227 |
C2V_VMENTRY(jint, getExceptionTableLength, (JNIEnv *, jobject, jobject jvmci_method)) |
|
228 |
ResourceMark rm; |
|
229 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
230 |
return method->exception_table_length(); |
|
231 |
C2V_END |
|
232 |
||
233 |
C2V_VMENTRY(jlong, getExceptionTableStart, (JNIEnv *, jobject, jobject jvmci_method)) |
|
234 |
ResourceMark rm; |
|
235 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
236 |
if (method->exception_table_length() == 0) { |
|
237 |
return 0L; |
|
238 |
} |
|
239 |
return (jlong) (address) method->exception_table_start(); |
|
240 |
C2V_END |
|
241 |
||
41325 | 242 |
C2V_VMENTRY(jobject, asResolvedJavaMethod, (JNIEnv *, jobject, jobject executable_handle)) |
243 |
oop executable = JNIHandles::resolve(executable_handle); |
|
244 |
oop mirror = NULL; |
|
245 |
int slot = 0; |
|
246 |
||
247 |
if (executable->klass() == SystemDictionary::reflect_Constructor_klass()) { |
|
248 |
mirror = java_lang_reflect_Constructor::clazz(executable); |
|
249 |
slot = java_lang_reflect_Constructor::slot(executable); |
|
250 |
} else { |
|
251 |
assert(executable->klass() == SystemDictionary::reflect_Method_klass(), "wrong type"); |
|
252 |
mirror = java_lang_reflect_Method::clazz(executable); |
|
253 |
slot = java_lang_reflect_Method::slot(executable); |
|
254 |
} |
|
255 |
Klass* holder = java_lang_Class::as_Klass(mirror); |
|
33160 | 256 |
methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot); |
257 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
258 |
return JNIHandles::make_local(THREAD, result); |
|
259 |
} |
|
260 |
||
261 |
C2V_VMENTRY(jobject, getResolvedJavaMethod, (JNIEnv *, jobject, jobject base, jlong offset)) |
|
262 |
methodHandle method; |
|
263 |
oop base_object = JNIHandles::resolve(base); |
|
264 |
if (base_object == NULL) { |
|
265 |
method = *((Method**)(offset)); |
|
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46481
diff
changeset
|
266 |
} else if (base_object->is_a(SystemDictionary::ResolvedMethodName_klass())) { |
33160 | 267 |
method = (Method*) (intptr_t) base_object->long_field(offset); |
268 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
269 |
method = *((Method**)(HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object) + offset)); |
|
270 |
} else { |
|
271 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
272 |
err_msg("Unexpected type: %s", base_object->klass()->external_name())); |
|
273 |
} |
|
274 |
assert (method.is_null() || method->is_method(), "invalid read"); |
|
275 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
276 |
return JNIHandles::make_local(THREAD, result); |
|
277 |
} |
|
278 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
279 |
C2V_VMENTRY(jobject, getConstantPool, (JNIEnv *, jobject, jobject object_handle)) |
33160 | 280 |
constantPoolHandle cp; |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
281 |
oop object = JNIHandles::resolve(object_handle); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
282 |
if (object == NULL) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
283 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
33160 | 284 |
} |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
285 |
if (object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
286 |
cp = CompilerToVM::asMethod(object)->constMethod()->constants(); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
287 |
} else if (object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
288 |
cp = InstanceKlass::cast(CompilerToVM::asKlass(object))->constants(); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
289 |
} else { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
290 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
291 |
err_msg("Unexpected type: %s", object->klass()->external_name())); |
33160 | 292 |
} |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
293 |
assert(!cp.is_null(), "npe"); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
294 |
JavaValue method_result(T_OBJECT); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
295 |
JavaCallArguments args; |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
296 |
args.push_long((jlong) (address) cp()); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
297 |
JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
298 |
return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject()); |
33160 | 299 |
} |
300 |
||
301 |
C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed)) |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
302 |
Klass* klass = NULL; |
33160 | 303 |
oop base_object = JNIHandles::resolve(base); |
304 |
jlong base_address = 0; |
|
305 |
if (base_object != NULL && offset == oopDesc::klass_offset_in_bytes()) { |
|
306 |
klass = base_object->klass(); |
|
307 |
} else if (!compressed) { |
|
308 |
if (base_object != NULL) { |
|
309 |
if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
310 |
base_address = HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object); |
|
311 |
} else if (base_object->is_a(SystemDictionary::HotSpotConstantPool_klass())) { |
|
312 |
base_address = HotSpotConstantPool::metaspaceConstantPool(base_object); |
|
313 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
|
314 |
base_address = (jlong) CompilerToVM::asKlass(base_object); |
|
315 |
} else if (base_object->is_a(SystemDictionary::Class_klass())) { |
|
316 |
base_address = (jlong) (address) base_object; |
|
317 |
} else { |
|
318 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
319 |
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); |
|
320 |
} |
|
321 |
} |
|
322 |
klass = *((Klass**) (intptr_t) (base_address + offset)); |
|
323 |
} else { |
|
324 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
325 |
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); |
|
326 |
} |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
327 |
assert (klass == NULL || klass->is_klass(), "invalid read"); |
33160 | 328 |
oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); |
329 |
return JNIHandles::make_local(THREAD, result); |
|
330 |
} |
|
331 |
||
332 |
C2V_VMENTRY(jobject, findUniqueConcreteMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) |
|
333 |
ResourceMark rm; |
|
334 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
335 |
Klass* holder = CompilerToVM::asKlass(jvmci_type); |
33160 | 336 |
if (holder->is_interface()) { |
337 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", holder->external_name())); |
|
338 |
} |
|
339 |
||
340 |
methodHandle ucm; |
|
341 |
{ |
|
342 |
MutexLocker locker(Compile_lock); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
343 |
ucm = Dependencies::find_unique_concrete_method(holder, method()); |
33160 | 344 |
} |
345 |
oop result = CompilerToVM::get_jvmci_method(ucm, CHECK_NULL); |
|
346 |
return JNIHandles::make_local(THREAD, result); |
|
347 |
C2V_END |
|
348 |
||
349 |
C2V_VMENTRY(jobject, getImplementor, (JNIEnv *, jobject, jobject jvmci_type)) |
|
48480
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
350 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
351 |
if (!klass->is_interface()) { |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
352 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
353 |
err_msg("Expected interface type, got %s", klass->external_name())); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
354 |
} |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
355 |
InstanceKlass* iklass = InstanceKlass::cast(klass); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
356 |
oop implementor = CompilerToVM::get_jvmci_type(iklass->implementor(), CHECK_NULL); |
33160 | 357 |
return JNIHandles::make_local(THREAD, implementor); |
358 |
C2V_END |
|
359 |
||
360 |
C2V_VMENTRY(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv *, jobject, jobject jvmci_method)) |
|
361 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
362 |
return method->is_ignored_by_security_stack_walk(); |
|
363 |
C2V_END |
|
364 |
||
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
365 |
C2V_VMENTRY(jboolean, isCompilable,(JNIEnv *, jobject, jobject jvmci_method)) |
33160 | 366 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
48826 | 367 |
constantPoolHandle cp = method->constMethod()->constants(); |
368 |
assert(!cp.is_null(), "npe"); |
|
369 |
// don't inline method when constant pool contains a CONSTANT_Dynamic |
|
370 |
return !method->is_not_compilable(CompLevel_full_optimization) && !cp->has_dynamic_constant(); |
|
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
371 |
C2V_END |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
372 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
373 |
C2V_VMENTRY(jboolean, hasNeverInlineDirective,(JNIEnv *, jobject, jobject jvmci_method)) |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
374 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
46945
f3a636ac46e4
8186235: [Graal] compiler/aot/RecompilationTest.java fails in case UseJVMCICompiler is enabled
iveresov
parents:
46794
diff
changeset
|
375 |
return !Inline || CompilerOracle::should_not_inline(method) || method->dont_inline(); |
33160 | 376 |
C2V_END |
377 |
||
378 |
C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jobject jvmci_method)) |
|
379 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
380 |
return CompilerOracle::should_inline(method) || method->force_inline(); |
|
381 |
C2V_END |
|
382 |
||
383 |
C2V_VMENTRY(jobject, lookupType, (JNIEnv*, jobject, jstring jname, jclass accessing_class, jboolean resolve)) |
|
384 |
ResourceMark rm; |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
385 |
Handle name(THREAD, JNIHandles::resolve(jname)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
386 |
Symbol* class_name = java_lang_String::as_symbol(name(), CHECK_0); |
33160 | 387 |
if (java_lang_String::length(name()) <= 1) { |
388 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Primitive type %s should be handled in Java code", class_name->as_C_string())); |
|
389 |
} |
|
390 |
||
391 |
Klass* resolved_klass = NULL; |
|
392 |
if (JNIHandles::resolve(accessing_class) == NULL) { |
|
393 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
394 |
} |
|
395 |
Klass* accessing_klass = java_lang_Class::as_Klass(JNIHandles::resolve(accessing_class)); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
396 |
Handle class_loader(THREAD, accessing_klass->class_loader()); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
397 |
Handle protection_domain(THREAD, accessing_klass->protection_domain()); |
33160 | 398 |
|
399 |
if (resolve) { |
|
400 |
resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0); |
|
401 |
} else { |
|
402 |
if (class_name->byte_at(0) == 'L' && |
|
403 |
class_name->byte_at(class_name->utf8_length()-1) == ';') { |
|
404 |
// This is a name from a signature. Strip off the trimmings. |
|
405 |
// Call recursive to keep scope of strippedsym. |
|
406 |
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1, |
|
407 |
class_name->utf8_length()-2, |
|
408 |
CHECK_0); |
|
409 |
resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_0); |
|
410 |
} else if (FieldType::is_array(class_name)) { |
|
411 |
FieldArrayInfo fd; |
|
412 |
// dimension and object_key in FieldArrayInfo are assigned as a side-effect |
|
413 |
// of this call |
|
414 |
BasicType t = FieldType::get_array_info(class_name, fd, CHECK_0); |
|
415 |
if (t == T_OBJECT) { |
|
416 |
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1+fd.dimension(), |
|
417 |
class_name->utf8_length()-2-fd.dimension(), |
|
418 |
CHECK_0); |
|
419 |
// naked oop "k" is OK here -- we assign back into it |
|
420 |
resolved_klass = SystemDictionary::find(strippedsym, |
|
421 |
class_loader, |
|
422 |
protection_domain, |
|
423 |
CHECK_0); |
|
424 |
if (resolved_klass != NULL) { |
|
425 |
resolved_klass = resolved_klass->array_klass(fd.dimension(), CHECK_0); |
|
426 |
} |
|
427 |
} else { |
|
428 |
resolved_klass = Universe::typeArrayKlassObj(t); |
|
429 |
resolved_klass = TypeArrayKlass::cast(resolved_klass)->array_klass(fd.dimension(), CHECK_0); |
|
430 |
} |
|
431 |
} |
|
432 |
} |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
433 |
oop result = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
434 |
return JNIHandles::make_local(THREAD, result); |
33160 | 435 |
C2V_END |
436 |
||
437 |
C2V_VMENTRY(jobject, resolveConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
438 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
439 |
oop result = cp->resolve_constant_at(index, CHECK_NULL); |
|
440 |
return JNIHandles::make_local(THREAD, result); |
|
441 |
C2V_END |
|
442 |
||
443 |
C2V_VMENTRY(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
444 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
445 |
oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); |
|
446 |
return JNIHandles::make_local(THREAD, result); |
|
447 |
C2V_END |
|
448 |
||
449 |
C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
450 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
451 |
return cp->name_and_type_ref_index_at(index); |
|
452 |
C2V_END |
|
453 |
||
454 |
C2V_VMENTRY(jobject, lookupNameInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which)) |
|
455 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
456 |
Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(which), CHECK_NULL); |
|
457 |
return JNIHandles::make_local(THREAD, sym()); |
|
458 |
C2V_END |
|
459 |
||
460 |
C2V_VMENTRY(jobject, lookupSignatureInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which)) |
|
461 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
462 |
Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(which), CHECK_NULL); |
|
463 |
return JNIHandles::make_local(THREAD, sym()); |
|
464 |
C2V_END |
|
465 |
||
466 |
C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
467 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
468 |
return cp->klass_ref_index_at(index); |
|
469 |
C2V_END |
|
470 |
||
471 |
C2V_VMENTRY(jobject, resolveTypeInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
472 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
473 |
Klass* resolved_klass = cp->klass_at(index, CHECK_NULL); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
474 |
oop klass = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
475 |
return JNIHandles::make_local(THREAD, klass); |
33160 | 476 |
C2V_END |
477 |
||
478 |
C2V_VMENTRY(jobject, lookupKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
|
479 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
480 |
Klass* loading_klass = cp->pool_holder(); |
33160 | 481 |
bool is_accessible = false; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
482 |
Klass* klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); |
33160 | 483 |
Symbol* symbol = NULL; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
484 |
if (klass == NULL) { |
33160 | 485 |
symbol = cp->klass_name_at(index); |
486 |
} |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
487 |
oop result_oop; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
488 |
if (klass != NULL) { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
489 |
result_oop = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); |
33160 | 490 |
} else { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
491 |
Handle result = java_lang_String::create_from_symbol(symbol, CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
492 |
result_oop = result(); |
33160 | 493 |
} |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
494 |
return JNIHandles::make_local(THREAD, result_oop); |
33160 | 495 |
C2V_END |
496 |
||
497 |
C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
498 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
499 |
oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index); |
|
500 |
return JNIHandles::make_local(THREAD, appendix_oop); |
|
501 |
C2V_END |
|
502 |
||
503 |
C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
|
504 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
505 |
InstanceKlass* pool_holder = cp->pool_holder(); |
33160 | 506 |
Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); |
507 |
methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder); |
|
508 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
509 |
return JNIHandles::make_local(THREAD, result); |
|
510 |
C2V_END |
|
511 |
||
512 |
C2V_VMENTRY(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
513 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
514 |
return cp->remap_instruction_operand_from_cache(index); |
|
515 |
C2V_END |
|
516 |
||
43939 | 517 |
C2V_VMENTRY(jobject, resolveFieldInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jobject jvmci_method, jbyte opcode, jintArray info_handle)) |
33160 | 518 |
ResourceMark rm; |
519 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
520 |
Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF); |
|
521 |
fieldDescriptor fd; |
|
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38719
diff
changeset
|
522 |
LinkInfo link_info(cp, index, (jvmci_method != NULL) ? CompilerToVM::asMethod(jvmci_method) : NULL, CHECK_0); |
33160 | 523 |
LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_0); |
524 |
typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle); |
|
43939 | 525 |
if (info == NULL || info->length() != 3) { |
526 |
JVMCI_ERROR_NULL("info must not be null and have a length of 3"); |
|
527 |
} |
|
528 |
info->int_at_put(0, fd.access_flags().as_int()); |
|
529 |
info->int_at_put(1, fd.offset()); |
|
530 |
info->int_at_put(2, fd.index()); |
|
33160 | 531 |
oop field_holder = CompilerToVM::get_jvmci_type(fd.field_holder(), CHECK_NULL); |
532 |
return JNIHandles::make_local(THREAD, field_holder); |
|
533 |
C2V_END |
|
534 |
||
535 |
C2V_VMENTRY(jint, getVtableIndexForInterfaceMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) |
|
536 |
ResourceMark rm; |
|
537 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
|
538 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
539 |
if (klass->is_interface()) { |
|
540 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", klass->external_name())); |
|
541 |
} |
|
542 |
if (!method->method_holder()->is_interface()) { |
|
543 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string())); |
|
544 |
} |
|
33632 | 545 |
if (!InstanceKlass::cast(klass)->is_linked()) { |
546 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name())); |
|
33160 | 547 |
} |
548 |
return LinkResolver::vtable_index_of_interface_method(klass, method); |
|
549 |
C2V_END |
|
550 |
||
551 |
C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
552 |
Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
553 |
Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type); |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
554 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
33160 | 555 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
556 |
Klass* resolved = method->method_holder(); |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
557 |
Symbol* h_name = method->name(); |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
558 |
Symbol* h_signature = method->signature(); |
33160 | 559 |
|
41051
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
560 |
if (MethodHandles::is_signature_polymorphic_method(method())) { |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
561 |
// Signature polymorphic methods are already resolved, JVMCI just returns NULL in this case. |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
562 |
return NULL; |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
563 |
} |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
564 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
565 |
LinkInfo link_info(resolved, h_name, h_signature, caller_klass); |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
566 |
methodHandle m; |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
567 |
// Only do exact lookup if receiver klass has been linked. Otherwise, |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
568 |
// the vtable has not been setup, and the LinkResolver will fail. |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
569 |
if (recv_klass->is_array_klass() || |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
570 |
(InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface())) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
571 |
if (resolved->is_interface()) { |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
572 |
m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info); |
33160 | 573 |
} else { |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
574 |
m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); |
33160 | 575 |
} |
576 |
} |
|
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
577 |
|
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
578 |
if (m.is_null()) { |
41051
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
579 |
// Return NULL if there was a problem with lookup (uninitialized class, etc.) |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
580 |
return NULL; |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
581 |
} |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
582 |
|
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
583 |
oop result = CompilerToVM::get_jvmci_method(m, CHECK_NULL); |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
584 |
return JNIHandles::make_local(THREAD, result); |
33160 | 585 |
C2V_END |
586 |
||
587 |
C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject jvmci_type)) |
|
588 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
|
589 |
assert(klass != NULL, "method must not be called for primitive types"); |
|
590 |
return Dependencies::find_finalizable_subclass(klass) != NULL; |
|
591 |
C2V_END |
|
592 |
||
593 |
C2V_VMENTRY(jobject, getClassInitializer, (JNIEnv *, jobject, jobject jvmci_type)) |
|
48480
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
594 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
595 |
if (!klass->is_instance_klass()) { |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
596 |
return NULL; |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
597 |
} |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
598 |
InstanceKlass* iklass = InstanceKlass::cast(klass); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
599 |
oop result = CompilerToVM::get_jvmci_method(iklass->class_initializer(), CHECK_NULL); |
33160 | 600 |
return JNIHandles::make_local(THREAD, result); |
601 |
C2V_END |
|
602 |
||
603 |
C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr)) |
|
604 |
address target_addr = (address) addr; |
|
605 |
if (target_addr != 0x0) { |
|
606 |
int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int)); |
|
607 |
int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int)); |
|
608 |
return MAX2(ABS(off_low), ABS(off_high)); |
|
609 |
} |
|
610 |
return -1; |
|
611 |
C2V_END |
|
612 |
||
47793
3dcd54513db1
8186478: [JVMCI] rename HotSpotResolvedJavaMethod#setNotInlineableOrCompileable
dnsimon
parents:
47765
diff
changeset
|
613 |
C2V_VMENTRY(void, setNotInlinableOrCompilable,(JNIEnv *, jobject, jobject jvmci_method)) |
33160 | 614 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
615 |
method->set_not_c1_compilable(); |
|
616 |
method->set_not_c2_compilable(); |
|
617 |
method->set_dont_inline(true); |
|
618 |
C2V_END |
|
619 |
||
620 |
C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log)) |
|
621 |
ResourceMark rm; |
|
622 |
HandleMark hm; |
|
44092 | 623 |
JNIHandleMark jni_hm; |
624 |
||
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
625 |
Handle target_handle(THREAD, JNIHandles::resolve(target)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
626 |
Handle compiled_code_handle(THREAD, JNIHandles::resolve(compiled_code)); |
33160 | 627 |
CodeBlob* cb = NULL; |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
628 |
Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
629 |
Handle speculation_log_handle(THREAD, JNIHandles::resolve(speculation_log)); |
33160 | 630 |
|
47796
47629b00daa9
8187315: [JVMCI] hosted use of JVMCI can crash VM under -Xint
dnsimon
parents:
47794
diff
changeset
|
631 |
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK_JNI_ERR); |
33160 | 632 |
|
633 |
TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer()); |
|
42650 | 634 |
bool is_immutable_PIC = HotSpotCompiledCode::isImmutablePIC(compiled_code_handle) > 0; |
635 |
CodeInstaller installer(is_immutable_PIC); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
636 |
JVMCIEnv::CodeInstallResult result = installer.install(compiler, target_handle, compiled_code_handle, cb, installed_code_handle, speculation_log_handle, CHECK_0); |
33160 | 637 |
|
638 |
if (PrintCodeCacheOnCompilation) { |
|
639 |
stringStream s; |
|
640 |
// Dump code cache into a buffer before locking the tty, |
|
641 |
{ |
|
642 |
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
|
643 |
CodeCache::print_summary(&s, false); |
|
644 |
} |
|
645 |
ttyLocker ttyl; |
|
646 |
tty->print_raw_cr(s.as_string()); |
|
647 |
} |
|
648 |
||
649 |
if (result != JVMCIEnv::ok) { |
|
650 |
assert(cb == NULL, "should be"); |
|
651 |
} else { |
|
47794
e84aa2c71241
8188102: [JVMCI] Convert special JVMCI oops in nmethod to jweak values
dnsimon
parents:
47793
diff
changeset
|
652 |
if (installed_code_handle.not_null()) { |
33160 | 653 |
assert(installed_code_handle->is_a(InstalledCode::klass()), "wrong type"); |
35092
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
654 |
nmethod::invalidate_installed_code(installed_code_handle, CHECK_0); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
655 |
{ |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
656 |
// Ensure that all updates to the InstalledCode fields are consistent. |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
657 |
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
658 |
InstalledCode::set_address(installed_code_handle, (jlong) cb); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
659 |
InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
660 |
if (cb->is_nmethod()) { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
661 |
InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->as_nmethod_or_null()->verified_entry_point()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
662 |
} else { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
663 |
InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->code_begin()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
664 |
} |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
665 |
if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
666 |
HotSpotInstalledCode::set_size(installed_code_handle, cb->size()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
667 |
HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
668 |
HotSpotInstalledCode::set_codeSize(installed_code_handle, cb->code_size()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
669 |
} |
33160 | 670 |
} |
671 |
} |
|
672 |
} |
|
673 |
return result; |
|
674 |
C2V_END |
|
675 |
||
676 |
C2V_VMENTRY(jint, getMetadata, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject metadata)) |
|
677 |
ResourceMark rm; |
|
678 |
HandleMark hm; |
|
679 |
||
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
680 |
Handle target_handle(THREAD, JNIHandles::resolve(target)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
681 |
Handle compiled_code_handle(THREAD, JNIHandles::resolve(compiled_code)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
682 |
Handle metadata_handle(THREAD, JNIHandles::resolve(metadata)); |
33160 | 683 |
|
684 |
CodeMetadata code_metadata; |
|
685 |
CodeBlob *cb = NULL; |
|
42650 | 686 |
CodeInstaller installer(true /* immutable PIC compilation */); |
33160 | 687 |
|
38695 | 688 |
JVMCIEnv::CodeInstallResult result = installer.gather_metadata(target_handle, compiled_code_handle, code_metadata, CHECK_0); |
33160 | 689 |
if (result != JVMCIEnv::ok) { |
690 |
return result; |
|
691 |
} |
|
692 |
||
693 |
if (code_metadata.get_nr_pc_desc() > 0) { |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
694 |
typeArrayHandle pcArrayOop = oopFactory::new_byteArray_handle(sizeof(PcDesc) * code_metadata.get_nr_pc_desc(), CHECK_(JVMCIEnv::cache_full)); |
33160 | 695 |
memcpy(pcArrayOop->byte_at_addr(0), code_metadata.get_pc_desc(), sizeof(PcDesc) * code_metadata.get_nr_pc_desc()); |
696 |
HotSpotMetaData::set_pcDescBytes(metadata_handle, pcArrayOop()); |
|
697 |
} |
|
698 |
||
699 |
if (code_metadata.get_scopes_size() > 0) { |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
700 |
typeArrayHandle scopesArrayOop = oopFactory::new_byteArray_handle(code_metadata.get_scopes_size(), CHECK_(JVMCIEnv::cache_full)); |
33160 | 701 |
memcpy(scopesArrayOop->byte_at_addr(0), code_metadata.get_scopes_desc(), code_metadata.get_scopes_size()); |
702 |
HotSpotMetaData::set_scopesDescBytes(metadata_handle, scopesArrayOop()); |
|
703 |
} |
|
704 |
||
705 |
RelocBuffer* reloc_buffer = code_metadata.get_reloc_buffer(); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
706 |
typeArrayHandle relocArrayOop = oopFactory::new_byteArray_handle((int) reloc_buffer->size(), CHECK_(JVMCIEnv::cache_full)); |
33160 | 707 |
if (reloc_buffer->size() > 0) { |
708 |
memcpy(relocArrayOop->byte_at_addr(0), reloc_buffer->begin(), reloc_buffer->size()); |
|
709 |
} |
|
710 |
HotSpotMetaData::set_relocBytes(metadata_handle, relocArrayOop()); |
|
711 |
||
712 |
const OopMapSet* oopMapSet = installer.oopMapSet(); |
|
713 |
{ |
|
714 |
ResourceMark mark; |
|
715 |
ImmutableOopMapBuilder builder(oopMapSet); |
|
716 |
int oopmap_size = builder.heap_size(); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
717 |
typeArrayHandle oopMapArrayHandle = oopFactory::new_byteArray_handle(oopmap_size, CHECK_(JVMCIEnv::cache_full)); |
33160 | 718 |
builder.generate_into((address) oopMapArrayHandle->byte_at_addr(0)); |
719 |
HotSpotMetaData::set_oopMaps(metadata_handle, oopMapArrayHandle()); |
|
720 |
} |
|
721 |
||
42650 | 722 |
AOTOopRecorder* recorder = code_metadata.get_oop_recorder(); |
723 |
||
47668 | 724 |
int nr_meta_refs = recorder->nr_meta_refs(); |
725 |
objArrayOop metadataArray = oopFactory::new_objectArray(nr_meta_refs, CHECK_(JVMCIEnv::cache_full)); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
726 |
objArrayHandle metadataArrayHandle(THREAD, metadataArray); |
47668 | 727 |
for (int i = 0; i < nr_meta_refs; ++i) { |
728 |
jobject element = recorder->meta_element(i); |
|
729 |
if (element == NULL) { |
|
730 |
return JVMCIEnv::cache_full; |
|
731 |
} |
|
732 |
metadataArrayHandle->obj_at_put(i, JNIHandles::resolve(element)); |
|
42650 | 733 |
} |
734 |
HotSpotMetaData::set_metadata(metadata_handle, metadataArrayHandle()); |
|
33160 | 735 |
|
736 |
ExceptionHandlerTable* handler = code_metadata.get_exception_table(); |
|
737 |
int table_size = handler->size_in_bytes(); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
738 |
typeArrayHandle exceptionArrayOop = oopFactory::new_byteArray_handle(table_size, CHECK_(JVMCIEnv::cache_full)); |
33160 | 739 |
|
740 |
if (table_size > 0) { |
|
741 |
handler->copy_bytes_to((address) exceptionArrayOop->byte_at_addr(0)); |
|
742 |
} |
|
743 |
HotSpotMetaData::set_exceptionBytes(metadata_handle, exceptionArrayOop()); |
|
744 |
||
745 |
return result; |
|
746 |
C2V_END |
|
747 |
||
748 |
C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject)) |
|
47796
47629b00daa9
8187315: [JVMCI] hosted use of JVMCI can crash VM under -Xint
dnsimon
parents:
47794
diff
changeset
|
749 |
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK); |
33160 | 750 |
CompilerStatistics* stats = compiler->stats(); |
751 |
stats->_standard.reset(); |
|
752 |
stats->_osr.reset(); |
|
753 |
C2V_END |
|
754 |
||
33632 | 755 |
C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jobject installedCode)) |
33160 | 756 |
ResourceMark rm; |
757 |
HandleMark hm; |
|
758 |
||
33632 | 759 |
if (installedCode == NULL) { |
760 |
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "installedCode is null"); |
|
761 |
} |
|
762 |
||
763 |
jlong codeBlob = InstalledCode::address(installedCode); |
|
764 |
if (codeBlob == 0L) { |
|
765 |
return NULL; |
|
766 |
} |
|
767 |
||
33160 | 768 |
CodeBlob* cb = (CodeBlob*) (address) codeBlob; |
769 |
if (cb == NULL) { |
|
770 |
return NULL; |
|
771 |
} |
|
772 |
||
773 |
// We don't want the stringStream buffer to resize during disassembly as it |
|
774 |
// uses scoped resource memory. If a nested function called during disassembly uses |
|
775 |
// a ResourceMark and the buffer expands within the scope of the mark, |
|
776 |
// the buffer becomes garbage when that scope is exited. Experience shows that |
|
777 |
// the disassembled code is typically about 10x the code size so a fixed buffer |
|
778 |
// sized to 20x code size plus a fixed amount for header info should be sufficient. |
|
779 |
int bufferSize = cb->code_size() * 20 + 1024; |
|
780 |
char* buffer = NEW_RESOURCE_ARRAY(char, bufferSize); |
|
781 |
stringStream st(buffer, bufferSize); |
|
782 |
if (cb->is_nmethod()) { |
|
783 |
nmethod* nm = (nmethod*) cb; |
|
784 |
if (!nm->is_alive()) { |
|
785 |
return NULL; |
|
786 |
} |
|
787 |
} |
|
35542
9dccb7f9f656
8071374: -XX:+PrintAssembly -XX:+PrintSignatureHandlers crash fastdebug VM with assert(limit == __null || limit <= nm->code_end()) in RelocIterator::initialize
vlivanov
parents:
35123
diff
changeset
|
788 |
Disassembler::decode(cb, &st); |
33160 | 789 |
if (st.size() <= 0) { |
790 |
return NULL; |
|
791 |
} |
|
792 |
||
793 |
Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
|
794 |
return JNIHandles::make_local(THREAD, result()); |
|
795 |
C2V_END |
|
796 |
||
797 |
C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv*, jobject, jobject jvmci_method, int bci)) |
|
798 |
ResourceMark rm; |
|
799 |
HandleMark hm; |
|
800 |
||
801 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
802 |
oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); |
|
803 |
return JNIHandles::make_local(THREAD, element); |
|
804 |
C2V_END |
|
805 |
||
806 |
C2V_VMENTRY(jobject, executeInstalledCode, (JNIEnv*, jobject, jobject args, jobject hotspotInstalledCode)) |
|
807 |
ResourceMark rm; |
|
808 |
HandleMark hm; |
|
809 |
||
810 |
jlong nmethodValue = InstalledCode::address(hotspotInstalledCode); |
|
811 |
if (nmethodValue == 0L) { |
|
812 |
THROW_NULL(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException()); |
|
813 |
} |
|
814 |
nmethod* nm = (nmethod*) (address) nmethodValue; |
|
815 |
methodHandle mh = nm->method(); |
|
816 |
Symbol* signature = mh->signature(); |
|
817 |
JavaCallArguments jca(mh->size_of_parameters()); |
|
818 |
||
819 |
JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
|
820 |
JavaValue result(jap.get_ret_type()); |
|
821 |
jca.set_alternative_target(nm); |
|
822 |
JavaCalls::call(&result, mh, &jca, CHECK_NULL); |
|
823 |
||
824 |
if (jap.get_ret_type() == T_VOID) { |
|
825 |
return NULL; |
|
826 |
} else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) { |
|
827 |
return JNIHandles::make_local(THREAD, (oop) result.get_jobject()); |
|
828 |
} else { |
|
829 |
jvalue *value = (jvalue *) result.get_value_addr(); |
|
830 |
// Narrow the value down if required (Important on big endian machines) |
|
831 |
switch (jap.get_ret_type()) { |
|
832 |
case T_BOOLEAN: |
|
833 |
value->z = (jboolean) value->i; |
|
834 |
break; |
|
835 |
case T_BYTE: |
|
836 |
value->b = (jbyte) value->i; |
|
837 |
break; |
|
838 |
case T_CHAR: |
|
839 |
value->c = (jchar) value->i; |
|
840 |
break; |
|
841 |
case T_SHORT: |
|
842 |
value->s = (jshort) value->i; |
|
843 |
break; |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
844 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
845 |
break; |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
846 |
} |
33160 | 847 |
oop o = java_lang_boxing_object::create(jap.get_ret_type(), value, CHECK_NULL); |
848 |
return JNIHandles::make_local(THREAD, o); |
|
849 |
} |
|
850 |
C2V_END |
|
851 |
||
852 |
C2V_VMENTRY(jlongArray, getLineNumberTable, (JNIEnv *, jobject, jobject jvmci_method)) |
|
853 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
854 |
if (!method->has_linenumber_table()) { |
|
855 |
return NULL; |
|
856 |
} |
|
857 |
u2 num_entries = 0; |
|
858 |
CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table()); |
|
859 |
while (streamForSize.read_pair()) { |
|
860 |
num_entries++; |
|
861 |
} |
|
862 |
||
863 |
CompressedLineNumberReadStream stream(method->compressed_linenumber_table()); |
|
864 |
typeArrayOop result = oopFactory::new_longArray(2 * num_entries, CHECK_NULL); |
|
865 |
||
866 |
int i = 0; |
|
867 |
jlong value; |
|
868 |
while (stream.read_pair()) { |
|
869 |
value = ((long) stream.bci()); |
|
870 |
result->long_at_put(i, value); |
|
871 |
value = ((long) stream.line()); |
|
872 |
result->long_at_put(i + 1, value); |
|
873 |
i += 2; |
|
874 |
} |
|
875 |
||
876 |
return (jlongArray) JNIHandles::make_local(THREAD, result); |
|
877 |
C2V_END |
|
878 |
||
879 |
C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jobject jvmci_method)) |
|
880 |
ResourceMark rm; |
|
881 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
882 |
if (!method->has_localvariable_table()) { |
|
883 |
return 0; |
|
884 |
} |
|
885 |
return (jlong) (address) method->localvariable_table_start(); |
|
886 |
C2V_END |
|
887 |
||
888 |
C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jobject jvmci_method)) |
|
889 |
ResourceMark rm; |
|
890 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
891 |
return method->localvariable_table_length(); |
|
892 |
C2V_END |
|
893 |
||
894 |
C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jobject jvmci_method)) |
|
895 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
896 |
MethodCounters* mcs = method->method_counters(); |
|
897 |
if (mcs != NULL) { |
|
898 |
mcs->clear_counters(); |
|
899 |
} |
|
900 |
NOT_PRODUCT(method->set_compiled_invocation_count(0)); |
|
901 |
||
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
902 |
CompiledMethod* code = method->code(); |
33160 | 903 |
if (code != NULL) { |
904 |
code->make_not_entrant(); |
|
905 |
} |
|
906 |
||
907 |
MethodData* method_data = method->method_data(); |
|
908 |
if (method_data == NULL) { |
|
909 |
ClassLoaderData* loader_data = method->method_holder()->class_loader_data(); |
|
910 |
method_data = MethodData::allocate(loader_data, method, CHECK); |
|
911 |
method->set_method_data(method_data); |
|
912 |
} else { |
|
913 |
method_data->initialize(); |
|
914 |
} |
|
915 |
C2V_END |
|
916 |
||
917 |
||
33632 | 918 |
C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject installed_code)) |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
919 |
Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code)); |
35092
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
920 |
nmethod::invalidate_installed_code(installed_code_handle, CHECK); |
33160 | 921 |
C2V_END |
922 |
||
923 |
C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject)) |
|
924 |
typeArrayOop arrayOop = oopFactory::new_longArray(JVMCICounterSize, CHECK_NULL); |
|
925 |
JavaThread::collect_counters(arrayOop); |
|
926 |
return (jlongArray) JNIHandles::make_local(THREAD, arrayOop); |
|
927 |
C2V_END |
|
928 |
||
929 |
C2V_VMENTRY(int, allocateCompileId, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci)) |
|
930 |
HandleMark hm; |
|
931 |
ResourceMark rm; |
|
932 |
if (JNIHandles::resolve(jvmci_method) == NULL) { |
|
933 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
934 |
} |
|
935 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
936 |
if (entry_bci >= method->code_size() || entry_bci < -1) { |
|
937 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Unexpected bci %d", entry_bci)); |
|
938 |
} |
|
939 |
return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci); |
|
940 |
C2V_END |
|
941 |
||
942 |
||
943 |
C2V_VMENTRY(jboolean, isMature, (JNIEnv*, jobject, jlong metaspace_method_data)) |
|
944 |
MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data); |
|
945 |
return mdo != NULL && mdo->is_mature(); |
|
946 |
C2V_END |
|
947 |
||
948 |
C2V_VMENTRY(jboolean, hasCompiledCodeForOSR, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci, int comp_level)) |
|
949 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
950 |
return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL; |
|
951 |
C2V_END |
|
952 |
||
953 |
C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong symbol)) |
|
954 |
Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)symbol, CHECK_NULL); |
|
955 |
return JNIHandles::make_local(THREAD, sym()); |
|
956 |
C2V_END |
|
957 |
||
958 |
bool matches(jobjectArray methods, Method* method) { |
|
959 |
objArrayOop methods_oop = (objArrayOop) JNIHandles::resolve(methods); |
|
960 |
||
961 |
for (int i = 0; i < methods_oop->length(); i++) { |
|
33632 | 962 |
oop resolved = methods_oop->obj_at(i); |
963 |
if (resolved->is_a(HotSpotResolvedJavaMethodImpl::klass()) && CompilerToVM::asMethod(resolved) == method) { |
|
33160 | 964 |
return true; |
965 |
} |
|
966 |
} |
|
967 |
return false; |
|
968 |
} |
|
969 |
||
49358 | 970 |
void call_interface(JavaValue* result, Klass* spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { |
971 |
CallInfo callinfo; |
|
972 |
Handle receiver = args->receiver(); |
|
973 |
Klass* recvrKlass = receiver.is_null() ? (Klass*)NULL : receiver->klass(); |
|
974 |
LinkInfo link_info(spec_klass, name, signature); |
|
975 |
LinkResolver::resolve_interface_call( |
|
976 |
callinfo, receiver, recvrKlass, link_info, true, CHECK); |
|
977 |
methodHandle method = callinfo.selected_method(); |
|
978 |
assert(method.not_null(), "should have thrown exception"); |
|
979 |
||
980 |
// Invoke the method |
|
981 |
JavaCalls::call(result, method, args, CHECK); |
|
982 |
} |
|
983 |
||
984 |
C2V_VMENTRY(jobject, iterateFrames, (JNIEnv*, jobject compilerToVM, jobjectArray initial_methods, jobjectArray match_methods, jint initialSkip, jobject visitor_handle)) |
|
33160 | 985 |
ResourceMark rm; |
986 |
||
49358 | 987 |
if (!thread->has_last_Java_frame()) { |
988 |
return NULL; |
|
989 |
} |
|
990 |
Handle visitor(THREAD, JNIHandles::resolve_non_null(visitor_handle)); |
|
991 |
Handle frame_reference = HotSpotStackFrameReference::klass()->allocate_instance_handle(CHECK_NULL); |
|
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
992 |
HotSpotStackFrameReference::klass()->initialize(CHECK_NULL); |
33160 | 993 |
|
994 |
StackFrameStream fst(thread); |
|
49358 | 995 |
|
996 |
jobjectArray methods = initial_methods; |
|
33160 | 997 |
|
998 |
int frame_number = 0; |
|
999 |
vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1000 |
||
1001 |
while (true) { |
|
1002 |
// look for the given method |
|
49358 | 1003 |
bool realloc_called = false; |
33160 | 1004 |
while (true) { |
1005 |
StackValueCollection* locals = NULL; |
|
1006 |
if (vf->is_compiled_frame()) { |
|
1007 |
// compiled method frame |
|
1008 |
compiledVFrame* cvf = compiledVFrame::cast(vf); |
|
1009 |
if (methods == NULL || matches(methods, cvf->method())) { |
|
1010 |
if (initialSkip > 0) { |
|
49358 | 1011 |
initialSkip--; |
33160 | 1012 |
} else { |
1013 |
ScopeDesc* scope = cvf->scope(); |
|
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1014 |
// native wrappers do not have a scope |
33160 | 1015 |
if (scope != NULL && scope->objects() != NULL) { |
49358 | 1016 |
GrowableArray<ScopeValue*>* objects; |
1017 |
if (!realloc_called) { |
|
1018 |
objects = scope->objects(); |
|
1019 |
} else { |
|
1020 |
// some object might already have been re-allocated, only reallocate the non-allocated ones |
|
1021 |
objects = new GrowableArray<ScopeValue*>(scope->objects()->length()); |
|
1022 |
int ii = 0; |
|
1023 |
for (int i = 0; i < scope->objects()->length(); i++) { |
|
1024 |
ObjectValue* sv = (ObjectValue*) scope->objects()->at(i); |
|
1025 |
if (sv->value().is_null()) { |
|
1026 |
objects->at_put(ii++, sv); |
|
1027 |
} |
|
1028 |
} |
|
1029 |
} |
|
1030 |
bool realloc_failures = Deoptimization::realloc_objects(thread, fst.current(), objects, CHECK_NULL); |
|
1031 |
Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, realloc_failures, false); |
|
1032 |
realloc_called = true; |
|
33160 | 1033 |
|
1034 |
GrowableArray<ScopeValue*>* local_values = scope->locals(); |
|
48605
00d8c8d696e9
8194991: Null pointer dereference caused by c2v_getNextStackFrame
dlong
parents:
48400
diff
changeset
|
1035 |
assert(local_values != NULL, "NULL locals"); |
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1036 |
typeArrayOop array_oop = oopFactory::new_boolArray(local_values->length(), CHECK_NULL); |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1037 |
typeArrayHandle array(THREAD, array_oop); |
33160 | 1038 |
for (int i = 0; i < local_values->length(); i++) { |
1039 |
ScopeValue* value = local_values->at(i); |
|
1040 |
if (value->is_object()) { |
|
1041 |
array->bool_at_put(i, true); |
|
1042 |
} |
|
1043 |
} |
|
49358 | 1044 |
HotSpotStackFrameReference::set_localIsVirtual(frame_reference, array()); |
33160 | 1045 |
} else { |
49358 | 1046 |
HotSpotStackFrameReference::set_localIsVirtual(frame_reference, NULL); |
33160 | 1047 |
} |
1048 |
||
1049 |
locals = cvf->locals(); |
|
49358 | 1050 |
HotSpotStackFrameReference::set_bci(frame_reference, cvf->bci()); |
33160 | 1051 |
oop method = CompilerToVM::get_jvmci_method(cvf->method(), CHECK_NULL); |
49358 | 1052 |
HotSpotStackFrameReference::set_method(frame_reference, method); |
33160 | 1053 |
} |
1054 |
} |
|
1055 |
} else if (vf->is_interpreted_frame()) { |
|
1056 |
// interpreted method frame |
|
1057 |
interpretedVFrame* ivf = interpretedVFrame::cast(vf); |
|
1058 |
if (methods == NULL || matches(methods, ivf->method())) { |
|
1059 |
if (initialSkip > 0) { |
|
49358 | 1060 |
initialSkip--; |
33160 | 1061 |
} else { |
1062 |
locals = ivf->locals(); |
|
49358 | 1063 |
HotSpotStackFrameReference::set_bci(frame_reference, ivf->bci()); |
33160 | 1064 |
oop method = CompilerToVM::get_jvmci_method(ivf->method(), CHECK_NULL); |
49358 | 1065 |
HotSpotStackFrameReference::set_method(frame_reference, method); |
1066 |
HotSpotStackFrameReference::set_localIsVirtual(frame_reference, NULL); |
|
33160 | 1067 |
} |
1068 |
} |
|
1069 |
} |
|
1070 |
||
1071 |
// locals != NULL means that we found a matching frame and result is already partially initialized |
|
1072 |
if (locals != NULL) { |
|
49358 | 1073 |
methods = match_methods; |
1074 |
HotSpotStackFrameReference::set_compilerToVM(frame_reference, JNIHandles::resolve(compilerToVM)); |
|
1075 |
HotSpotStackFrameReference::set_stackPointer(frame_reference, (jlong) fst.current()->sp()); |
|
1076 |
HotSpotStackFrameReference::set_frameNumber(frame_reference, frame_number); |
|
33160 | 1077 |
|
1078 |
// initialize the locals array |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1079 |
objArrayOop array_oop = oopFactory::new_objectArray(locals->size(), CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1080 |
objArrayHandle array(THREAD, array_oop); |
33160 | 1081 |
for (int i = 0; i < locals->size(); i++) { |
1082 |
StackValue* var = locals->at(i); |
|
1083 |
if (var->type() == T_OBJECT) { |
|
1084 |
array->obj_at_put(i, locals->at(i)->get_obj()()); |
|
1085 |
} |
|
1086 |
} |
|
49358 | 1087 |
HotSpotStackFrameReference::set_locals(frame_reference, array()); |
1088 |
HotSpotStackFrameReference::set_objectsMaterialized(frame_reference, JNI_FALSE); |
|
33160 | 1089 |
|
49358 | 1090 |
JavaValue result(T_OBJECT); |
1091 |
JavaCallArguments args(visitor); |
|
1092 |
args.push_oop(frame_reference); |
|
1093 |
call_interface(&result, SystemDictionary::InspectedFrameVisitor_klass(), vmSymbols::visitFrame_name(), vmSymbols::visitFrame_signature(), &args, CHECK_NULL); |
|
1094 |
if (result.get_jobject() != NULL) { |
|
1095 |
return JNIHandles::make_local(thread, (oop) result.get_jobject()); |
|
1096 |
} |
|
1097 |
assert(initialSkip == 0, "There should be no match before initialSkip == 0"); |
|
1098 |
if (HotSpotStackFrameReference::objectsMaterialized(frame_reference) == JNI_TRUE) { |
|
1099 |
// the frame has been deoptimized, we need to re-synchronize the frame and vframe |
|
1100 |
intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(frame_reference); |
|
1101 |
fst = StackFrameStream(thread); |
|
1102 |
while (fst.current()->sp() != stack_pointer && !fst.is_done()) { |
|
1103 |
fst.next(); |
|
1104 |
} |
|
1105 |
if (fst.current()->sp() != stack_pointer) { |
|
1106 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "stack frame not found after deopt") |
|
1107 |
} |
|
1108 |
vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1109 |
if (!vf->is_compiled_frame()) { |
|
1110 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1111 |
} |
|
1112 |
for (int i = 0; i < frame_number; i++) { |
|
1113 |
if (vf->is_top()) { |
|
1114 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "vframe not found after deopt") |
|
1115 |
} |
|
1116 |
vf = vf->sender(); |
|
1117 |
assert(vf->is_compiled_frame(), "Wrong frame type"); |
|
1118 |
} |
|
1119 |
} |
|
1120 |
frame_reference = HotSpotStackFrameReference::klass()->allocate_instance_handle(CHECK_NULL); |
|
1121 |
HotSpotStackFrameReference::klass()->initialize(CHECK_NULL); |
|
33160 | 1122 |
} |
1123 |
||
1124 |
if (vf->is_top()) { |
|
1125 |
break; |
|
1126 |
} |
|
1127 |
frame_number++; |
|
1128 |
vf = vf->sender(); |
|
1129 |
} // end of vframe loop |
|
1130 |
||
1131 |
if (fst.is_done()) { |
|
1132 |
break; |
|
1133 |
} |
|
1134 |
fst.next(); |
|
1135 |
vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1136 |
frame_number = 0; |
|
1137 |
} // end of frame loop |
|
1138 |
||
1139 |
// the end was reached without finding a matching method |
|
1140 |
return NULL; |
|
1141 |
C2V_END |
|
1142 |
||
1143 |
C2V_VMENTRY(void, resolveInvokeDynamicInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
1144 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
1145 |
CallInfo callInfo; |
|
1146 |
LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokedynamic, CHECK); |
|
1147 |
ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index); |
|
1148 |
cp_cache_entry->set_dynamic_call(cp, callInfo); |
|
1149 |
C2V_END |
|
1150 |
||
1151 |
C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
1152 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
1153 |
Klass* holder = cp->klass_ref_at(index, CHECK); |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1154 |
Symbol* name = cp->name_ref_at(index); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
1155 |
if (MethodHandles::is_signature_polymorphic_name(holder, name)) { |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1156 |
CallInfo callInfo; |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1157 |
LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
1158 |
ConstantPoolCacheEntry* cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index)); |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1159 |
cp_cache_entry->set_method_handle(cp, callInfo); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1160 |
} |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1161 |
C2V_END |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1162 |
|
47668 | 1163 |
C2V_VMENTRY(jint, isResolvedInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
1164 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
1165 |
ConstantPoolCacheEntry* cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index)); |
|
1166 |
if (cp_cache_entry->is_resolved(Bytecodes::_invokehandle)) { |
|
1167 |
// MethodHandle.invoke* --> LambdaForm? |
|
1168 |
ResourceMark rm; |
|
1169 |
||
1170 |
LinkInfo link_info(cp, index, CATCH); |
|
1171 |
||
1172 |
Klass* resolved_klass = link_info.resolved_klass(); |
|
1173 |
||
1174 |
Symbol* name_sym = cp->name_ref_at(index); |
|
1175 |
||
1176 |
vmassert(MethodHandles::is_method_handle_invoke_name(resolved_klass, name_sym), "!"); |
|
1177 |
vmassert(MethodHandles::is_signature_polymorphic_name(resolved_klass, name_sym), "!"); |
|
1178 |
||
1179 |
methodHandle adapter_method(cp_cache_entry->f1_as_method()); |
|
1180 |
||
1181 |
methodHandle resolved_method(adapter_method); |
|
1182 |
||
1183 |
// Can we treat it as a regular invokevirtual? |
|
1184 |
if (resolved_method->method_holder() == resolved_klass && resolved_method->name() == name_sym) { |
|
1185 |
vmassert(!resolved_method->is_static(),"!"); |
|
1186 |
vmassert(MethodHandles::is_signature_polymorphic_method(resolved_method()),"!"); |
|
1187 |
vmassert(!MethodHandles::is_signature_polymorphic_static(resolved_method->intrinsic_id()), "!"); |
|
1188 |
vmassert(cp_cache_entry->appendix_if_resolved(cp) == NULL, "!"); |
|
1189 |
vmassert(cp_cache_entry->method_type_if_resolved(cp) == NULL, "!"); |
|
1190 |
||
1191 |
methodHandle m(LinkResolver::linktime_resolve_virtual_method_or_null(link_info)); |
|
1192 |
vmassert(m == resolved_method, "!!"); |
|
1193 |
return -1; |
|
1194 |
} |
|
1195 |
||
1196 |
return Bytecodes::_invokevirtual; |
|
1197 |
} |
|
1198 |
if (cp_cache_entry->is_resolved(Bytecodes::_invokedynamic)) { |
|
1199 |
return Bytecodes::_invokedynamic; |
|
1200 |
} |
|
1201 |
return -1; |
|
1202 |
C2V_END |
|
1203 |
||
1204 |
||
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1205 |
C2V_VMENTRY(jobject, getSignaturePolymorphicHolders, (JNIEnv*, jobject)) |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1206 |
objArrayHandle holders = oopFactory::new_objArray_handle(SystemDictionary::String_klass(), 2, CHECK_NULL); |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1207 |
Handle mh = java_lang_String::create_from_str("Ljava/lang/invoke/MethodHandle;", CHECK_NULL); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1208 |
Handle vh = java_lang_String::create_from_str("Ljava/lang/invoke/VarHandle;", CHECK_NULL); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1209 |
holders->obj_at_put(0, mh()); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1210 |
holders->obj_at_put(1, vh()); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1211 |
return JNIHandles::make_local(THREAD, holders()); |
33160 | 1212 |
C2V_END |
1213 |
||
1214 |
C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject)) |
|
1215 |
//see compute_recording_non_safepoints in debugInfroRec.cpp |
|
1216 |
if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
|
1217 |
return true; |
|
1218 |
} |
|
1219 |
return DebugNonSafepoints; |
|
1220 |
C2V_END |
|
1221 |
||
1222 |
// public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate); |
|
1223 |
C2V_VMENTRY(void, materializeVirtualObjects, (JNIEnv*, jobject, jobject hs_frame, bool invalidate)) |
|
1224 |
ResourceMark rm; |
|
1225 |
||
1226 |
if (hs_frame == NULL) { |
|
1227 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), "stack frame is null") |
|
1228 |
} |
|
1229 |
||
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1230 |
HotSpotStackFrameReference::klass()->initialize(CHECK); |
33160 | 1231 |
|
1232 |
// look for the given stack frame |
|
1233 |
StackFrameStream fst(thread); |
|
1234 |
intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame); |
|
1235 |
while (fst.current()->sp() != stack_pointer && !fst.is_done()) { |
|
1236 |
fst.next(); |
|
1237 |
} |
|
1238 |
if (fst.current()->sp() != stack_pointer) { |
|
1239 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found") |
|
1240 |
} |
|
1241 |
||
1242 |
if (invalidate) { |
|
1243 |
if (!fst.current()->is_compiled_frame()) { |
|
1244 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1245 |
} |
|
1246 |
assert(fst.current()->cb()->is_nmethod(), "nmethod expected"); |
|
1247 |
((nmethod*) fst.current()->cb())->make_not_entrant(); |
|
1248 |
} |
|
1249 |
Deoptimization::deoptimize(thread, *fst.current(), fst.register_map(), Deoptimization::Reason_none); |
|
1250 |
// look for the frame again as it has been updated by deopt (pc, deopt state...) |
|
1251 |
StackFrameStream fstAfterDeopt(thread); |
|
1252 |
while (fstAfterDeopt.current()->sp() != stack_pointer && !fstAfterDeopt.is_done()) { |
|
1253 |
fstAfterDeopt.next(); |
|
1254 |
} |
|
1255 |
if (fstAfterDeopt.current()->sp() != stack_pointer) { |
|
1256 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found after deopt") |
|
1257 |
} |
|
1258 |
||
1259 |
vframe* vf = vframe::new_vframe(fstAfterDeopt.current(), fstAfterDeopt.register_map(), thread); |
|
1260 |
if (!vf->is_compiled_frame()) { |
|
1261 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1262 |
} |
|
1263 |
||
1264 |
GrowableArray<compiledVFrame*>* virtualFrames = new GrowableArray<compiledVFrame*>(10); |
|
1265 |
while (true) { |
|
1266 |
assert(vf->is_compiled_frame(), "Wrong frame type"); |
|
1267 |
virtualFrames->push(compiledVFrame::cast(vf)); |
|
1268 |
if (vf->is_top()) { |
|
1269 |
break; |
|
1270 |
} |
|
1271 |
vf = vf->sender(); |
|
1272 |
} |
|
1273 |
||
1274 |
int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame); |
|
1275 |
if (last_frame_number >= virtualFrames->length()) { |
|
1276 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "invalid frame number") |
|
1277 |
} |
|
1278 |
||
1279 |
// Reallocate the non-escaping objects and restore their fields. |
|
1280 |
assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope"); |
|
1281 |
GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects(); |
|
1282 |
||
1283 |
if (objects == NULL) { |
|
1284 |
// no objects to materialize |
|
1285 |
return; |
|
1286 |
} |
|
1287 |
||
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1288 |
bool realloc_failures = Deoptimization::realloc_objects(thread, fstAfterDeopt.current(), objects, CHECK); |
33160 | 1289 |
Deoptimization::reassign_fields(fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, realloc_failures, false); |
1290 |
||
1291 |
for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) { |
|
1292 |
compiledVFrame* cvf = virtualFrames->at(frame_index); |
|
1293 |
||
1294 |
GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals(); |
|
1295 |
StackValueCollection* locals = cvf->locals(); |
|
1296 |
if (locals != NULL) { |
|
1297 |
for (int i2 = 0; i2 < locals->size(); i2++) { |
|
1298 |
StackValue* var = locals->at(i2); |
|
1299 |
if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) { |
|
1300 |
jvalue val; |
|
1301 |
val.l = (jobject) locals->at(i2)->get_obj()(); |
|
1302 |
cvf->update_local(T_OBJECT, i2, val); |
|
1303 |
} |
|
1304 |
} |
|
1305 |
} |
|
48792
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1306 |
|
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1307 |
GrowableArray<ScopeValue*>* scopeExpressions = cvf->scope()->expressions(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1308 |
StackValueCollection* expressions = cvf->expressions(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1309 |
if (expressions != NULL) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1310 |
for (int i2 = 0; i2 < expressions->size(); i2++) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1311 |
StackValue* var = expressions->at(i2); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1312 |
if (var->type() == T_OBJECT && scopeExpressions->at(i2)->is_object()) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1313 |
jvalue val; |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1314 |
val.l = (jobject) expressions->at(i2)->get_obj()(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1315 |
cvf->update_stack(T_OBJECT, i2, val); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1316 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1317 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1318 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1319 |
|
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1320 |
GrowableArray<MonitorValue*>* scopeMonitors = cvf->scope()->monitors(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1321 |
GrowableArray<MonitorInfo*>* monitors = cvf->monitors(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1322 |
if (monitors != NULL) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1323 |
for (int i2 = 0; i2 < monitors->length(); i2++) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1324 |
cvf->update_monitor(i2, monitors->at(i2)); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1325 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1326 |
} |
33160 | 1327 |
} |
1328 |
||
1329 |
// all locals are materialized by now |
|
1330 |
HotSpotStackFrameReference::set_localIsVirtual(hs_frame, NULL); |
|
1331 |
||
1332 |
// update the locals array |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1333 |
objArrayHandle array(THREAD, HotSpotStackFrameReference::locals(hs_frame)); |
33160 | 1334 |
StackValueCollection* locals = virtualFrames->at(last_frame_number)->locals(); |
1335 |
for (int i = 0; i < locals->size(); i++) { |
|
1336 |
StackValue* var = locals->at(i); |
|
1337 |
if (var->type() == T_OBJECT) { |
|
1338 |
array->obj_at_put(i, locals->at(i)->get_obj()()); |
|
1339 |
} |
|
1340 |
} |
|
49358 | 1341 |
HotSpotStackFrameReference::set_objectsMaterialized(hs_frame, JNI_TRUE); |
33160 | 1342 |
C2V_END |
1343 |
||
1344 |
C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length)) |
|
1345 |
if (bytes == NULL) { |
|
1346 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1347 |
} |
|
1348 |
typeArrayOop array = (typeArrayOop) JNIHandles::resolve(bytes); |
|
1349 |
||
1350 |
// Check if offset and length are non negative. |
|
1351 |
if (offset < 0 || length < 0) { |
|
1352 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
1353 |
} |
|
1354 |
// Check if the range is valid. |
|
1355 |
if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) { |
|
1356 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
1357 |
} |
|
1358 |
while (length > 0) { |
|
1359 |
jbyte* start = array->byte_at_addr(offset); |
|
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47668
diff
changeset
|
1360 |
tty->write((char*) start, MIN2(length, (jint)O_BUFLEN)); |
33160 | 1361 |
length -= O_BUFLEN; |
1362 |
offset += O_BUFLEN; |
|
1363 |
} |
|
1364 |
C2V_END |
|
1365 |
||
1366 |
C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject)) |
|
1367 |
tty->flush(); |
|
1368 |
C2V_END |
|
1369 |
||
33632 | 1370 |
C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position)) |
1371 |
ResourceMark rm; |
|
1372 |
MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data); |
|
1373 |
ProfileData* profile_data = mdo->data_at(position); |
|
1374 |
if (mdo->is_valid(profile_data)) { |
|
1375 |
return profile_data->size_in_bytes(); |
|
1376 |
} |
|
1377 |
DataLayout* data = mdo->extra_data_base(); |
|
1378 |
DataLayout* end = mdo->extra_data_limit(); |
|
1379 |
for (;; data = mdo->next_extra(data)) { |
|
1380 |
assert(data < end, "moved past end of extra data"); |
|
1381 |
profile_data = data->data_in(); |
|
1382 |
if (mdo->dp_to_di(profile_data->dp()) == position) { |
|
1383 |
return profile_data->size_in_bytes(); |
|
1384 |
} |
|
1385 |
} |
|
1386 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position)); |
|
1387 |
C2V_END |
|
1388 |
||
42650 | 1389 |
C2V_VMENTRY(jlong, getFingerprint, (JNIEnv*, jobject, jlong metaspace_klass)) |
1390 |
Klass *k = CompilerToVM::asKlass(metaspace_klass); |
|
1391 |
if (k->is_instance_klass()) { |
|
1392 |
return InstanceKlass::cast(k)->get_stored_fingerprint(); |
|
1393 |
} else { |
|
1394 |
return 0; |
|
1395 |
} |
|
1396 |
C2V_END |
|
1397 |
||
45626
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1398 |
C2V_VMENTRY(jobject, getHostClass, (JNIEnv*, jobject, jobject jvmci_type)) |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1399 |
InstanceKlass* k = InstanceKlass::cast(CompilerToVM::asKlass(jvmci_type)); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1400 |
InstanceKlass* host = k->host_klass(); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1401 |
oop result = CompilerToVM::get_jvmci_type(host, CHECK_NULL); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1402 |
return JNIHandles::make_local(THREAD, result); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1403 |
C2V_END |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1404 |
|
35593
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1405 |
C2V_VMENTRY(int, interpreterFrameSize, (JNIEnv*, jobject, jobject bytecode_frame_handle)) |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1406 |
if (bytecode_frame_handle == NULL) { |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1407 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1408 |
} |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1409 |
|
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1410 |
oop top_bytecode_frame = JNIHandles::resolve_non_null(bytecode_frame_handle); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1411 |
oop bytecode_frame = top_bytecode_frame; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1412 |
int size = 0; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1413 |
int callee_parameters = 0; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1414 |
int callee_locals = 0; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1415 |
Method* method = getMethodFromHotSpotMethod(BytecodePosition::method(bytecode_frame)); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1416 |
int extra_args = method->max_stack() - BytecodeFrame::numStack(bytecode_frame); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1417 |
|
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1418 |
while (bytecode_frame != NULL) { |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1419 |
int locks = BytecodeFrame::numLocks(bytecode_frame); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1420 |
int temps = BytecodeFrame::numStack(bytecode_frame); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1421 |
bool is_top_frame = (bytecode_frame == top_bytecode_frame); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1422 |
Method* method = getMethodFromHotSpotMethod(BytecodePosition::method(bytecode_frame)); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1423 |
|
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1424 |
int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(), |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1425 |
temps + callee_parameters, |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1426 |
extra_args, |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1427 |
locks, |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1428 |
callee_parameters, |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1429 |
callee_locals, |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1430 |
is_top_frame); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1431 |
size += frame_size; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1432 |
|
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1433 |
callee_parameters = method->size_of_parameters(); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1434 |
callee_locals = method->max_locals(); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1435 |
extra_args = 0; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1436 |
bytecode_frame = BytecodePosition::caller(bytecode_frame); |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1437 |
} |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1438 |
return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord; |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1439 |
C2V_END |
c733fd198e6e
8146424: runtime/ReservedStack/ReservedStackTest.java triggers: assert(thread->deopt_mark() == __null) failed: no stack overflow from deopt blob/uncommon trap
never
parents:
35592
diff
changeset
|
1440 |
|
41325 | 1441 |
C2V_VMENTRY(void, compileToBytecode, (JNIEnv*, jobject, jobject lambda_form_handle)) |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1442 |
Handle lambda_form(THREAD, JNIHandles::resolve_non_null(lambda_form_handle)); |
41325 | 1443 |
if (lambda_form->is_a(SystemDictionary::LambdaForm_klass())) { |
1444 |
TempNewSymbol compileToBytecode = SymbolTable::new_symbol("compileToBytecode", CHECK); |
|
1445 |
JavaValue result(T_VOID); |
|
1446 |
JavaCalls::call_special(&result, lambda_form, SystemDictionary::LambdaForm_klass(), compileToBytecode, vmSymbols::void_method_signature(), CHECK); |
|
1447 |
} else { |
|
1448 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
1449 |
err_msg("Unexpected type: %s", lambda_form->klass()->external_name())); |
|
1450 |
} |
|
1451 |
C2V_END |
|
33160 | 1452 |
|
1453 |
#define CC (char*) /*cast a literal from (const char*)*/ |
|
1454 |
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) |
|
1455 |
||
49358 | 1456 |
#define STRING "Ljava/lang/String;" |
1457 |
#define OBJECT "Ljava/lang/Object;" |
|
1458 |
#define CLASS "Ljava/lang/Class;" |
|
1459 |
#define EXECUTABLE "Ljava/lang/reflect/Executable;" |
|
1460 |
#define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
|
1461 |
#define INSTALLED_CODE "Ljdk/vm/ci/code/InstalledCode;" |
|
1462 |
#define TARGET_DESCRIPTION "Ljdk/vm/ci/code/TargetDescription;" |
|
1463 |
#define BYTECODE_FRAME "Ljdk/vm/ci/code/BytecodeFrame;" |
|
1464 |
#define INSPECTED_FRAME_VISITOR "Ljdk/vm/ci/code/stack/InspectedFrameVisitor;" |
|
1465 |
#define RESOLVED_METHOD "Ljdk/vm/ci/meta/ResolvedJavaMethod;" |
|
1466 |
#define HS_RESOLVED_METHOD "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;" |
|
1467 |
#define HS_RESOLVED_KLASS "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;" |
|
1468 |
#define HS_CONSTANT_POOL "Ljdk/vm/ci/hotspot/HotSpotConstantPool;" |
|
1469 |
#define HS_COMPILED_CODE "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;" |
|
1470 |
#define HS_CONFIG "Ljdk/vm/ci/hotspot/HotSpotVMConfig;" |
|
1471 |
#define HS_METADATA "Ljdk/vm/ci/hotspot/HotSpotMetaData;" |
|
1472 |
#define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;" |
|
1473 |
#define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;" |
|
1474 |
#define METASPACE_METHOD_DATA "J" |
|
33160 | 1475 |
|
1476 |
JNINativeMethod CompilerToVM::methods[] = { |
|
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1477 |
{CC "getBytecode", CC "(" HS_RESOLVED_METHOD ")[B", FN_PTR(getBytecode)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1478 |
{CC "getExceptionTableStart", CC "(" HS_RESOLVED_METHOD ")J", FN_PTR(getExceptionTableStart)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1479 |
{CC "getExceptionTableLength", CC "(" HS_RESOLVED_METHOD ")I", FN_PTR(getExceptionTableLength)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1480 |
{CC "findUniqueConcreteMethod", CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD ")" HS_RESOLVED_METHOD, FN_PTR(findUniqueConcreteMethod)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1481 |
{CC "getImplementor", CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_KLASS, FN_PTR(getImplementor)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1482 |
{CC "getStackTraceElement", CC "(" HS_RESOLVED_METHOD "I)" STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1483 |
{CC "methodIsIgnoredBySecurityStackWalk", CC "(" HS_RESOLVED_METHOD ")Z", FN_PTR(methodIsIgnoredBySecurityStackWalk)}, |
47793
3dcd54513db1
8186478: [JVMCI] rename HotSpotResolvedJavaMethod#setNotInlineableOrCompileable
dnsimon
parents:
47765
diff
changeset
|
1484 |
{CC "setNotInlinableOrCompilable", CC "(" HS_RESOLVED_METHOD ")V", FN_PTR(setNotInlinableOrCompilable)}, |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
1485 |
{CC "isCompilable", CC "(" HS_RESOLVED_METHOD ")Z", FN_PTR(isCompilable)}, |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
1486 |
{CC "hasNeverInlineDirective", CC "(" HS_RESOLVED_METHOD ")Z", FN_PTR(hasNeverInlineDirective)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1487 |
{CC "shouldInlineMethod", CC "(" HS_RESOLVED_METHOD ")Z", FN_PTR(shouldInlineMethod)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1488 |
{CC "lookupType", CC "(" STRING CLASS "Z)" HS_RESOLVED_KLASS, FN_PTR(lookupType)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1489 |
{CC "lookupNameInPool", CC "(" HS_CONSTANT_POOL "I)" STRING, FN_PTR(lookupNameInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1490 |
{CC "lookupNameAndTypeRefIndexInPool", CC "(" HS_CONSTANT_POOL "I)I", FN_PTR(lookupNameAndTypeRefIndexInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1491 |
{CC "lookupSignatureInPool", CC "(" HS_CONSTANT_POOL "I)" STRING, FN_PTR(lookupSignatureInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1492 |
{CC "lookupKlassRefIndexInPool", CC "(" HS_CONSTANT_POOL "I)I", FN_PTR(lookupKlassRefIndexInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1493 |
{CC "lookupKlassInPool", CC "(" HS_CONSTANT_POOL "I)Ljava/lang/Object;", FN_PTR(lookupKlassInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1494 |
{CC "lookupAppendixInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECT, FN_PTR(lookupAppendixInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1495 |
{CC "lookupMethodInPool", CC "(" HS_CONSTANT_POOL "IB)" HS_RESOLVED_METHOD, FN_PTR(lookupMethodInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1496 |
{CC "constantPoolRemapInstructionOperandFromCache", CC "(" HS_CONSTANT_POOL "I)I", FN_PTR(constantPoolRemapInstructionOperandFromCache)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1497 |
{CC "resolveConstantInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECT, FN_PTR(resolveConstantInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1498 |
{CC "resolvePossiblyCachedConstantInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1499 |
{CC "resolveTypeInPool", CC "(" HS_CONSTANT_POOL "I)" HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)}, |
43939 | 1500 |
{CC "resolveFieldInPool", CC "(" HS_CONSTANT_POOL "I" HS_RESOLVED_METHOD "B[I)" HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1501 |
{CC "resolveInvokeDynamicInPool", CC "(" HS_CONSTANT_POOL "I)V", FN_PTR(resolveInvokeDynamicInPool)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1502 |
{CC "resolveInvokeHandleInPool", CC "(" HS_CONSTANT_POOL "I)V", FN_PTR(resolveInvokeHandleInPool)}, |
47668 | 1503 |
{CC "isResolvedInvokeHandleInPool", CC "(" HS_CONSTANT_POOL "I)I", FN_PTR(isResolvedInvokeHandleInPool)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1504 |
{CC "resolveMethod", CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD, FN_PTR(resolveMethod)}, |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1505 |
{CC "getSignaturePolymorphicHolders", CC "()[" STRING, FN_PTR(getSignaturePolymorphicHolders)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1506 |
{CC "getVtableIndexForInterfaceMethod", CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD ")I", FN_PTR(getVtableIndexForInterfaceMethod)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1507 |
{CC "getClassInitializer", CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD, FN_PTR(getClassInitializer)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1508 |
{CC "hasFinalizableSubclass", CC "(" HS_RESOLVED_KLASS ")Z", FN_PTR(hasFinalizableSubclass)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1509 |
{CC "getMaxCallTargetOffset", CC "(J)J", FN_PTR(getMaxCallTargetOffset)}, |
41325 | 1510 |
{CC "asResolvedJavaMethod", CC "(" EXECUTABLE ")" HS_RESOLVED_METHOD, FN_PTR(asResolvedJavaMethod)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1511 |
{CC "getResolvedJavaMethod", CC "(Ljava/lang/Object;J)" HS_RESOLVED_METHOD, FN_PTR(getResolvedJavaMethod)}, |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
1512 |
{CC "getConstantPool", CC "(Ljava/lang/Object;)" HS_CONSTANT_POOL, FN_PTR(getConstantPool)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1513 |
{CC "getResolvedJavaType", CC "(Ljava/lang/Object;JZ)" HS_RESOLVED_KLASS, FN_PTR(getResolvedJavaType)}, |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
1514 |
{CC "readConfiguration", CC "()[" OBJECT, FN_PTR(readConfiguration)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1515 |
{CC "installCode", CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG ")I", FN_PTR(installCode)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1516 |
{CC "getMetadata", CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE HS_METADATA ")I", FN_PTR(getMetadata)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1517 |
{CC "resetCompilationStatistics", CC "()V", FN_PTR(resetCompilationStatistics)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1518 |
{CC "disassembleCodeBlob", CC "(" INSTALLED_CODE ")" STRING, FN_PTR(disassembleCodeBlob)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1519 |
{CC "executeInstalledCode", CC "([" OBJECT INSTALLED_CODE ")" OBJECT, FN_PTR(executeInstalledCode)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1520 |
{CC "getLineNumberTable", CC "(" HS_RESOLVED_METHOD ")[J", FN_PTR(getLineNumberTable)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1521 |
{CC "getLocalVariableTableStart", CC "(" HS_RESOLVED_METHOD ")J", FN_PTR(getLocalVariableTableStart)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1522 |
{CC "getLocalVariableTableLength", CC "(" HS_RESOLVED_METHOD ")I", FN_PTR(getLocalVariableTableLength)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1523 |
{CC "reprofile", CC "(" HS_RESOLVED_METHOD ")V", FN_PTR(reprofile)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1524 |
{CC "invalidateInstalledCode", CC "(" INSTALLED_CODE ")V", FN_PTR(invalidateInstalledCode)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1525 |
{CC "collectCounters", CC "()[J", FN_PTR(collectCounters)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1526 |
{CC "allocateCompileId", CC "(" HS_RESOLVED_METHOD "I)I", FN_PTR(allocateCompileId)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1527 |
{CC "isMature", CC "(" METASPACE_METHOD_DATA ")Z", FN_PTR(isMature)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1528 |
{CC "hasCompiledCodeForOSR", CC "(" HS_RESOLVED_METHOD "II)Z", FN_PTR(hasCompiledCodeForOSR)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1529 |
{CC "getSymbol", CC "(J)" STRING, FN_PTR(getSymbol)}, |
49358 | 1530 |
{CC "iterateFrames", CC "([" RESOLVED_METHOD "[" RESOLVED_METHOD "I" INSPECTED_FRAME_VISITOR ")" OBJECT, FN_PTR(iterateFrames)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1531 |
{CC "materializeVirtualObjects", CC "(" HS_STACK_FRAME_REF "Z)V", FN_PTR(materializeVirtualObjects)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1532 |
{CC "shouldDebugNonSafepoints", CC "()Z", FN_PTR(shouldDebugNonSafepoints)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1533 |
{CC "writeDebugOutput", CC "([BII)V", FN_PTR(writeDebugOutput)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1534 |
{CC "flushDebugOutput", CC "()V", FN_PTR(flushDebugOutput)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1535 |
{CC "methodDataProfileDataSize", CC "(JI)I", FN_PTR(methodDataProfileDataSize)}, |
42650 | 1536 |
{CC "getFingerprint", CC "(J)J", FN_PTR(getFingerprint)}, |
45626
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1537 |
{CC "getHostClass", CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_KLASS, FN_PTR(getHostClass)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1538 |
{CC "interpreterFrameSize", CC "(" BYTECODE_FRAME ")I", FN_PTR(interpreterFrameSize)}, |
41325 | 1539 |
{CC "compileToBytecode", CC "(" OBJECT ")V", FN_PTR(compileToBytecode)}, |
43939 | 1540 |
{CC "getFlagValue", CC "(" STRING ")" OBJECT, FN_PTR(getFlagValue)}, |
33160 | 1541 |
}; |
1542 |
||
1543 |
int CompilerToVM::methods_count() { |
|
1544 |
return sizeof(methods) / sizeof(JNINativeMethod); |
|
1545 |
} |