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