author | never |
Fri, 04 Dec 2015 15:18:46 -1000 | |
changeset 35092 | 82170e5767c3 |
parent 34317 | e93b85bf4cc2 |
child 35123 | b0b89d83bcf5 |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
2 |
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
#include "precompiled.hpp" |
|
25 |
#include "code/codeCache.hpp" |
|
26 |
#include "code/scopeDesc.hpp" |
|
27 |
#include "interpreter/linkResolver.hpp" |
|
28 |
#include "memory/oopFactory.hpp" |
|
29 |
#include "oops/generateOopMap.hpp" |
|
30 |
#include "oops/fieldStreams.hpp" |
|
31 |
#include "oops/oop.inline.hpp" |
|
32 |
#include "oops/objArrayOop.inline.hpp" |
|
33 |
#include "runtime/fieldDescriptor.hpp" |
|
34 |
#include "runtime/javaCalls.hpp" |
|
35 |
#include "jvmci/jvmciRuntime.hpp" |
|
36 |
#include "compiler/abstractCompiler.hpp" |
|
37 |
#include "compiler/compileBroker.hpp" |
|
38 |
#include "compiler/compilerOracle.hpp" |
|
39 |
#include "compiler/disassembler.hpp" |
|
40 |
#include "compiler/oopMap.hpp" |
|
41 |
#include "jvmci/jvmciCompilerToVM.hpp" |
|
42 |
#include "jvmci/jvmciCompiler.hpp" |
|
43 |
#include "jvmci/jvmciEnv.hpp" |
|
44 |
#include "jvmci/jvmciJavaClasses.hpp" |
|
45 |
#include "jvmci/jvmciCodeInstaller.hpp" |
|
46 |
#include "gc/g1/heapRegion.hpp" |
|
47 |
#include "runtime/javaCalls.hpp" |
|
48 |
#include "runtime/deoptimization.hpp" |
|
49 |
#include "runtime/vframe.hpp" |
|
50 |
#include "runtime/vframe_hp.hpp" |
|
51 |
#include "runtime/vmStructs.hpp" |
|
52 |
||
53 |
||
54 |
// Entry to native method implementation that transitions current thread to '_thread_in_vm'. |
|
55 |
#define C2V_VMENTRY(result_type, name, signature) \ |
|
56 |
JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
|
57 |
TRACE_jvmci_1("CompilerToVM::" #name); \ |
|
58 |
TRACE_CALL(result_type, jvmci_ ## name signature) \ |
|
59 |
JVMCI_VM_ENTRY_MARK; \ |
|
60 |
||
61 |
#define C2V_END } |
|
62 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33160
diff
changeset
|
63 |
oop CompilerToVM::get_jvmci_method(const methodHandle& method, TRAPS) { |
33160 | 64 |
if (method() != NULL) { |
65 |
JavaValue result(T_OBJECT); |
|
66 |
JavaCallArguments args; |
|
67 |
args.push_long((jlong) (address) method()); |
|
68 |
JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_NULL); |
|
69 |
||
70 |
return (oop)result.get_jobject(); |
|
71 |
} |
|
72 |
return NULL; |
|
73 |
} |
|
74 |
||
75 |
oop CompilerToVM::get_jvmci_type(KlassHandle klass, TRAPS) { |
|
76 |
if (klass() != NULL) { |
|
77 |
JavaValue result(T_OBJECT); |
|
78 |
JavaCallArguments args; |
|
79 |
args.push_oop(klass->java_mirror()); |
|
80 |
JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL); |
|
81 |
||
82 |
return (oop)result.get_jobject(); |
|
83 |
} |
|
84 |
return NULL; |
|
85 |
} |
|
86 |
||
87 |
extern "C" { |
|
88 |
extern VMStructEntry* gHotSpotVMStructs; |
|
89 |
extern uint64_t gHotSpotVMStructEntryTypeNameOffset; |
|
90 |
extern uint64_t gHotSpotVMStructEntryFieldNameOffset; |
|
91 |
extern uint64_t gHotSpotVMStructEntryTypeStringOffset; |
|
92 |
extern uint64_t gHotSpotVMStructEntryIsStaticOffset; |
|
93 |
extern uint64_t gHotSpotVMStructEntryOffsetOffset; |
|
94 |
extern uint64_t gHotSpotVMStructEntryAddressOffset; |
|
95 |
extern uint64_t gHotSpotVMStructEntryArrayStride; |
|
96 |
||
97 |
extern VMTypeEntry* gHotSpotVMTypes; |
|
98 |
extern uint64_t gHotSpotVMTypeEntryTypeNameOffset; |
|
99 |
extern uint64_t gHotSpotVMTypeEntrySuperclassNameOffset; |
|
100 |
extern uint64_t gHotSpotVMTypeEntryIsOopTypeOffset; |
|
101 |
extern uint64_t gHotSpotVMTypeEntryIsIntegerTypeOffset; |
|
102 |
extern uint64_t gHotSpotVMTypeEntryIsUnsignedOffset; |
|
103 |
extern uint64_t gHotSpotVMTypeEntrySizeOffset; |
|
104 |
extern uint64_t gHotSpotVMTypeEntryArrayStride; |
|
105 |
||
106 |
extern VMIntConstantEntry* gHotSpotVMIntConstants; |
|
107 |
extern uint64_t gHotSpotVMIntConstantEntryNameOffset; |
|
108 |
extern uint64_t gHotSpotVMIntConstantEntryValueOffset; |
|
109 |
extern uint64_t gHotSpotVMIntConstantEntryArrayStride; |
|
110 |
||
111 |
extern VMLongConstantEntry* gHotSpotVMLongConstants; |
|
112 |
extern uint64_t gHotSpotVMLongConstantEntryNameOffset; |
|
113 |
extern uint64_t gHotSpotVMLongConstantEntryValueOffset; |
|
114 |
extern uint64_t gHotSpotVMLongConstantEntryArrayStride; |
|
115 |
||
116 |
extern VMAddressEntry* gHotSpotVMAddresses; |
|
117 |
extern uint64_t gHotSpotVMAddressEntryNameOffset; |
|
118 |
extern uint64_t gHotSpotVMAddressEntryValueOffset; |
|
119 |
extern uint64_t gHotSpotVMAddressEntryArrayStride; |
|
120 |
} |
|
121 |
||
122 |
// FIXME This is only temporary until the GC code is changed. |
|
123 |
bool CompilerToVM::_supports_inline_contig_alloc; |
|
124 |
HeapWord** CompilerToVM::_heap_end_addr; |
|
125 |
HeapWord** CompilerToVM::_heap_top_addr; |
|
126 |
||
127 |
/** |
|
128 |
* We put all gHotSpotVM values in an array so we can read them easily from Java. |
|
129 |
*/ |
|
130 |
static uintptr_t ciHotSpotVMData[28]; |
|
131 |
||
132 |
C2V_VMENTRY(jlong, initializeConfiguration, (JNIEnv *env, jobject)) |
|
133 |
ciHotSpotVMData[0] = (uintptr_t) gHotSpotVMStructs; |
|
134 |
ciHotSpotVMData[1] = gHotSpotVMStructEntryTypeNameOffset; |
|
135 |
ciHotSpotVMData[2] = gHotSpotVMStructEntryFieldNameOffset; |
|
136 |
ciHotSpotVMData[3] = gHotSpotVMStructEntryTypeStringOffset; |
|
137 |
ciHotSpotVMData[4] = gHotSpotVMStructEntryIsStaticOffset; |
|
138 |
ciHotSpotVMData[5] = gHotSpotVMStructEntryOffsetOffset; |
|
139 |
ciHotSpotVMData[6] = gHotSpotVMStructEntryAddressOffset; |
|
140 |
ciHotSpotVMData[7] = gHotSpotVMStructEntryArrayStride; |
|
141 |
||
142 |
ciHotSpotVMData[8] = (uintptr_t) gHotSpotVMTypes; |
|
143 |
ciHotSpotVMData[9] = gHotSpotVMTypeEntryTypeNameOffset; |
|
144 |
ciHotSpotVMData[10] = gHotSpotVMTypeEntrySuperclassNameOffset; |
|
145 |
ciHotSpotVMData[11] = gHotSpotVMTypeEntryIsOopTypeOffset; |
|
146 |
ciHotSpotVMData[12] = gHotSpotVMTypeEntryIsIntegerTypeOffset; |
|
147 |
ciHotSpotVMData[13] = gHotSpotVMTypeEntryIsUnsignedOffset; |
|
148 |
ciHotSpotVMData[14] = gHotSpotVMTypeEntrySizeOffset; |
|
149 |
ciHotSpotVMData[15] = gHotSpotVMTypeEntryArrayStride; |
|
150 |
||
151 |
ciHotSpotVMData[16] = (uintptr_t) gHotSpotVMIntConstants; |
|
152 |
ciHotSpotVMData[17] = gHotSpotVMIntConstantEntryNameOffset; |
|
153 |
ciHotSpotVMData[18] = gHotSpotVMIntConstantEntryValueOffset; |
|
154 |
ciHotSpotVMData[19] = gHotSpotVMIntConstantEntryArrayStride; |
|
155 |
||
156 |
ciHotSpotVMData[20] = (uintptr_t) gHotSpotVMLongConstants; |
|
157 |
ciHotSpotVMData[21] = gHotSpotVMLongConstantEntryNameOffset; |
|
158 |
ciHotSpotVMData[22] = gHotSpotVMLongConstantEntryValueOffset; |
|
159 |
ciHotSpotVMData[23] = gHotSpotVMLongConstantEntryArrayStride; |
|
160 |
||
161 |
ciHotSpotVMData[24] = (uintptr_t) gHotSpotVMAddresses; |
|
162 |
ciHotSpotVMData[25] = gHotSpotVMAddressEntryNameOffset; |
|
163 |
ciHotSpotVMData[26] = gHotSpotVMAddressEntryValueOffset; |
|
164 |
ciHotSpotVMData[27] = gHotSpotVMAddressEntryArrayStride; |
|
165 |
||
166 |
// FIXME This is only temporary until the GC code is changed. |
|
167 |
CompilerToVM::_supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc(); |
|
168 |
CompilerToVM::_heap_end_addr = CompilerToVM::_supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1; |
|
169 |
CompilerToVM::_heap_top_addr = CompilerToVM::_supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1; |
|
170 |
||
171 |
return (jlong) (address) &ciHotSpotVMData; |
|
172 |
C2V_END |
|
173 |
||
174 |
C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jobject jvmci_method)) |
|
175 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
176 |
ResourceMark rm; |
|
177 |
||
178 |
int code_size = method->code_size(); |
|
179 |
typeArrayOop reconstituted_code = oopFactory::new_byteArray(code_size, CHECK_NULL); |
|
180 |
||
181 |
guarantee(method->method_holder()->is_rewritten(), "Method's holder should be rewritten"); |
|
182 |
// iterate over all bytecodes and replace non-Java bytecodes |
|
183 |
||
184 |
for (BytecodeStream s(method); s.next() != Bytecodes::_illegal; ) { |
|
185 |
Bytecodes::Code code = s.code(); |
|
186 |
Bytecodes::Code raw_code = s.raw_code(); |
|
187 |
int bci = s.bci(); |
|
188 |
int len = s.instruction_size(); |
|
189 |
||
190 |
// Restore original byte code. |
|
191 |
reconstituted_code->byte_at_put(bci, (jbyte) (s.is_wide()? Bytecodes::_wide : code)); |
|
192 |
if (len > 1) { |
|
193 |
memcpy(reconstituted_code->byte_at_addr(bci + 1), s.bcp()+1, len-1); |
|
194 |
} |
|
195 |
||
196 |
if (len > 1) { |
|
197 |
// Restore the big-endian constant pool indexes. |
|
198 |
// Cf. Rewriter::scan_method |
|
199 |
switch (code) { |
|
200 |
case Bytecodes::_getstatic: |
|
201 |
case Bytecodes::_putstatic: |
|
202 |
case Bytecodes::_getfield: |
|
203 |
case Bytecodes::_putfield: |
|
204 |
case Bytecodes::_invokevirtual: |
|
205 |
case Bytecodes::_invokespecial: |
|
206 |
case Bytecodes::_invokestatic: |
|
207 |
case Bytecodes::_invokeinterface: |
|
208 |
case Bytecodes::_invokehandle: { |
|
209 |
int cp_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
210 |
Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index); |
|
211 |
break; |
|
212 |
} |
|
213 |
||
214 |
case Bytecodes::_invokedynamic: |
|
215 |
int cp_index = Bytes::get_native_u4((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
216 |
Bytes::put_Java_u4((address) reconstituted_code->byte_at_addr(bci + 1), (u4) cp_index); |
|
217 |
break; |
|
218 |
} |
|
219 |
||
220 |
// Not all ldc byte code are rewritten. |
|
221 |
switch (raw_code) { |
|
222 |
case Bytecodes::_fast_aldc: { |
|
223 |
int cpc_index = reconstituted_code->byte_at(bci + 1) & 0xff; |
|
224 |
int cp_index = method->constants()->object_to_cp_index(cpc_index); |
|
225 |
assert(cp_index < method->constants()->length(), "sanity check"); |
|
226 |
reconstituted_code->byte_at_put(bci + 1, (jbyte) cp_index); |
|
227 |
break; |
|
228 |
} |
|
229 |
||
230 |
case Bytecodes::_fast_aldc_w: { |
|
231 |
int cpc_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
232 |
int cp_index = method->constants()->object_to_cp_index(cpc_index); |
|
233 |
assert(cp_index < method->constants()->length(), "sanity check"); |
|
234 |
Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index); |
|
235 |
break; |
|
236 |
} |
|
237 |
} |
|
238 |
} |
|
239 |
} |
|
240 |
||
241 |
return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code); |
|
242 |
C2V_END |
|
243 |
||
244 |
C2V_VMENTRY(jint, getExceptionTableLength, (JNIEnv *, jobject, jobject jvmci_method)) |
|
245 |
ResourceMark rm; |
|
246 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
247 |
return method->exception_table_length(); |
|
248 |
C2V_END |
|
249 |
||
250 |
C2V_VMENTRY(jlong, getExceptionTableStart, (JNIEnv *, jobject, jobject jvmci_method)) |
|
251 |
ResourceMark rm; |
|
252 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
253 |
if (method->exception_table_length() == 0) { |
|
254 |
return 0L; |
|
255 |
} |
|
256 |
return (jlong) (address) method->exception_table_start(); |
|
257 |
C2V_END |
|
258 |
||
259 |
C2V_VMENTRY(jobject, getResolvedJavaMethodAtSlot, (JNIEnv *, jobject, jclass holder_handle, jint slot)) |
|
260 |
oop java_class = JNIHandles::resolve(holder_handle); |
|
261 |
Klass* holder = java_lang_Class::as_Klass(java_class); |
|
262 |
methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot); |
|
263 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
264 |
return JNIHandles::make_local(THREAD, result); |
|
265 |
} |
|
266 |
||
267 |
C2V_VMENTRY(jobject, getResolvedJavaMethod, (JNIEnv *, jobject, jobject base, jlong offset)) |
|
268 |
methodHandle method; |
|
269 |
oop base_object = JNIHandles::resolve(base); |
|
270 |
if (base_object == NULL) { |
|
271 |
method = *((Method**)(offset)); |
|
272 |
} else if (base_object->is_a(SystemDictionary::MemberName_klass())) { |
|
273 |
method = (Method*) (intptr_t) base_object->long_field(offset); |
|
274 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
275 |
method = *((Method**)(HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object) + offset)); |
|
276 |
} else { |
|
277 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
278 |
err_msg("Unexpected type: %s", base_object->klass()->external_name())); |
|
279 |
} |
|
280 |
assert (method.is_null() || method->is_method(), "invalid read"); |
|
281 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
282 |
return JNIHandles::make_local(THREAD, result); |
|
283 |
} |
|
284 |
||
285 |
C2V_VMENTRY(jobject, getConstantPool, (JNIEnv *, jobject, jobject base, jlong offset)) |
|
286 |
constantPoolHandle cp; |
|
287 |
oop base_object = JNIHandles::resolve(base); |
|
288 |
jlong base_address = 0; |
|
289 |
if (base_object != NULL) { |
|
290 |
if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
291 |
base_address = HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object); |
|
292 |
} else if (base_object->is_a(SystemDictionary::HotSpotConstantPool_klass())) { |
|
293 |
base_address = HotSpotConstantPool::metaspaceConstantPool(base_object); |
|
294 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
|
295 |
base_address = (jlong) CompilerToVM::asKlass(base_object); |
|
296 |
} else { |
|
297 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
298 |
err_msg("Unexpected type: %s", base_object->klass()->external_name())); |
|
299 |
} |
|
300 |
} |
|
301 |
cp = *((ConstantPool**) (intptr_t) (base_address + offset)); |
|
302 |
if (!cp.is_null()) { |
|
303 |
JavaValue method_result(T_OBJECT); |
|
304 |
JavaCallArguments args; |
|
305 |
args.push_long((jlong) (address) cp()); |
|
306 |
JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL); |
|
307 |
return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject()); |
|
308 |
} |
|
309 |
return NULL; |
|
310 |
} |
|
311 |
||
312 |
C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed)) |
|
313 |
KlassHandle klass; |
|
314 |
oop base_object = JNIHandles::resolve(base); |
|
315 |
jlong base_address = 0; |
|
316 |
if (base_object != NULL && offset == oopDesc::klass_offset_in_bytes()) { |
|
317 |
klass = base_object->klass(); |
|
318 |
} else if (!compressed) { |
|
319 |
if (base_object != NULL) { |
|
320 |
if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
321 |
base_address = HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object); |
|
322 |
} else if (base_object->is_a(SystemDictionary::HotSpotConstantPool_klass())) { |
|
323 |
base_address = HotSpotConstantPool::metaspaceConstantPool(base_object); |
|
324 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
|
325 |
base_address = (jlong) CompilerToVM::asKlass(base_object); |
|
326 |
} else if (base_object->is_a(SystemDictionary::Class_klass())) { |
|
327 |
base_address = (jlong) (address) base_object; |
|
328 |
} else { |
|
329 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
330 |
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); |
|
331 |
} |
|
332 |
} |
|
333 |
klass = *((Klass**) (intptr_t) (base_address + offset)); |
|
334 |
} else { |
|
335 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
336 |
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); |
|
337 |
} |
|
338 |
assert (klass.is_null() || klass->is_klass(), "invalid read"); |
|
339 |
oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); |
|
340 |
return JNIHandles::make_local(THREAD, result); |
|
341 |
} |
|
342 |
||
343 |
C2V_VMENTRY(jobject, findUniqueConcreteMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) |
|
344 |
ResourceMark rm; |
|
345 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
346 |
KlassHandle holder = CompilerToVM::asKlass(jvmci_type); |
|
347 |
if (holder->is_interface()) { |
|
348 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", holder->external_name())); |
|
349 |
} |
|
350 |
||
351 |
methodHandle ucm; |
|
352 |
{ |
|
353 |
MutexLocker locker(Compile_lock); |
|
354 |
ucm = Dependencies::find_unique_concrete_method(holder(), method()); |
|
355 |
} |
|
356 |
oop result = CompilerToVM::get_jvmci_method(ucm, CHECK_NULL); |
|
357 |
return JNIHandles::make_local(THREAD, result); |
|
358 |
C2V_END |
|
359 |
||
360 |
C2V_VMENTRY(jobject, getImplementor, (JNIEnv *, jobject, jobject jvmci_type)) |
|
361 |
InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type); |
|
362 |
oop implementor = CompilerToVM::get_jvmci_type(klass->implementor(), CHECK_NULL); |
|
363 |
return JNIHandles::make_local(THREAD, implementor); |
|
364 |
C2V_END |
|
365 |
||
366 |
C2V_VMENTRY(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv *, jobject, jobject jvmci_method)) |
|
367 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
368 |
return method->is_ignored_by_security_stack_walk(); |
|
369 |
C2V_END |
|
370 |
||
371 |
C2V_VMENTRY(jboolean, canInlineMethod,(JNIEnv *, jobject, jobject jvmci_method)) |
|
372 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
373 |
return !method->is_not_compilable() && !CompilerOracle::should_not_inline(method) && !method->dont_inline(); |
|
374 |
C2V_END |
|
375 |
||
376 |
C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jobject jvmci_method)) |
|
377 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
378 |
return CompilerOracle::should_inline(method) || method->force_inline(); |
|
379 |
C2V_END |
|
380 |
||
381 |
C2V_VMENTRY(jobject, lookupType, (JNIEnv*, jobject, jstring jname, jclass accessing_class, jboolean resolve)) |
|
382 |
ResourceMark rm; |
|
383 |
Handle name = JNIHandles::resolve(jname); |
|
384 |
Symbol* class_name = java_lang_String::as_symbol(name, CHECK_0); |
|
385 |
if (java_lang_String::length(name()) <= 1) { |
|
386 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Primitive type %s should be handled in Java code", class_name->as_C_string())); |
|
387 |
} |
|
388 |
||
389 |
Klass* resolved_klass = NULL; |
|
390 |
Handle class_loader; |
|
391 |
Handle protection_domain; |
|
392 |
if (JNIHandles::resolve(accessing_class) == NULL) { |
|
393 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
394 |
} |
|
395 |
Klass* accessing_klass = java_lang_Class::as_Klass(JNIHandles::resolve(accessing_class)); |
|
396 |
class_loader = accessing_klass->class_loader(); |
|
397 |
protection_domain = accessing_klass->protection_domain(); |
|
398 |
||
399 |
if (resolve) { |
|
400 |
resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0); |
|
401 |
} else { |
|
402 |
if (class_name->byte_at(0) == 'L' && |
|
403 |
class_name->byte_at(class_name->utf8_length()-1) == ';') { |
|
404 |
// This is a name from a signature. Strip off the trimmings. |
|
405 |
// Call recursive to keep scope of strippedsym. |
|
406 |
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1, |
|
407 |
class_name->utf8_length()-2, |
|
408 |
CHECK_0); |
|
409 |
resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_0); |
|
410 |
} else if (FieldType::is_array(class_name)) { |
|
411 |
FieldArrayInfo fd; |
|
412 |
// dimension and object_key in FieldArrayInfo are assigned as a side-effect |
|
413 |
// of this call |
|
414 |
BasicType t = FieldType::get_array_info(class_name, fd, CHECK_0); |
|
415 |
if (t == T_OBJECT) { |
|
416 |
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1+fd.dimension(), |
|
417 |
class_name->utf8_length()-2-fd.dimension(), |
|
418 |
CHECK_0); |
|
419 |
// naked oop "k" is OK here -- we assign back into it |
|
420 |
resolved_klass = SystemDictionary::find(strippedsym, |
|
421 |
class_loader, |
|
422 |
protection_domain, |
|
423 |
CHECK_0); |
|
424 |
if (resolved_klass != NULL) { |
|
425 |
resolved_klass = resolved_klass->array_klass(fd.dimension(), CHECK_0); |
|
426 |
} |
|
427 |
} else { |
|
428 |
resolved_klass = Universe::typeArrayKlassObj(t); |
|
429 |
resolved_klass = TypeArrayKlass::cast(resolved_klass)->array_klass(fd.dimension(), CHECK_0); |
|
430 |
} |
|
431 |
} |
|
432 |
} |
|
433 |
Handle result = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); |
|
434 |
return JNIHandles::make_local(THREAD, result()); |
|
435 |
C2V_END |
|
436 |
||
437 |
C2V_VMENTRY(jobject, resolveConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
438 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
439 |
oop result = cp->resolve_constant_at(index, CHECK_NULL); |
|
440 |
return JNIHandles::make_local(THREAD, result); |
|
441 |
C2V_END |
|
442 |
||
443 |
C2V_VMENTRY(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
444 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
445 |
oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); |
|
446 |
return JNIHandles::make_local(THREAD, result); |
|
447 |
C2V_END |
|
448 |
||
449 |
C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
450 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
451 |
return cp->name_and_type_ref_index_at(index); |
|
452 |
C2V_END |
|
453 |
||
454 |
C2V_VMENTRY(jobject, lookupNameInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which)) |
|
455 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
456 |
Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(which), CHECK_NULL); |
|
457 |
return JNIHandles::make_local(THREAD, sym()); |
|
458 |
C2V_END |
|
459 |
||
460 |
C2V_VMENTRY(jobject, lookupSignatureInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which)) |
|
461 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
462 |
Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(which), CHECK_NULL); |
|
463 |
return JNIHandles::make_local(THREAD, sym()); |
|
464 |
C2V_END |
|
465 |
||
466 |
C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
467 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
468 |
return cp->klass_ref_index_at(index); |
|
469 |
C2V_END |
|
470 |
||
471 |
C2V_VMENTRY(jobject, resolveTypeInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
472 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
473 |
Klass* resolved_klass = cp->klass_at(index, CHECK_NULL); |
|
474 |
Handle klass = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); |
|
475 |
return JNIHandles::make_local(THREAD, klass()); |
|
476 |
C2V_END |
|
477 |
||
478 |
C2V_VMENTRY(jobject, lookupKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
|
479 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
480 |
KlassHandle loading_klass(cp->pool_holder()); |
|
481 |
bool is_accessible = false; |
|
482 |
KlassHandle klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); |
|
483 |
Symbol* symbol = NULL; |
|
484 |
if (klass.is_null()) { |
|
485 |
symbol = cp->klass_name_at(index); |
|
486 |
} |
|
487 |
Handle result; |
|
488 |
if (!klass.is_null()) { |
|
489 |
result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); |
|
490 |
} else { |
|
491 |
result = java_lang_String::create_from_symbol(symbol, CHECK_NULL); |
|
492 |
} |
|
493 |
return JNIHandles::make_local(THREAD, result()); |
|
494 |
C2V_END |
|
495 |
||
496 |
C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
497 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
498 |
oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index); |
|
499 |
return JNIHandles::make_local(THREAD, appendix_oop); |
|
500 |
C2V_END |
|
501 |
||
502 |
C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
|
503 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
504 |
instanceKlassHandle pool_holder(cp->pool_holder()); |
|
505 |
Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); |
|
506 |
methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder); |
|
507 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
508 |
return JNIHandles::make_local(THREAD, result); |
|
509 |
C2V_END |
|
510 |
||
511 |
C2V_VMENTRY(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
512 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
513 |
return cp->remap_instruction_operand_from_cache(index); |
|
514 |
C2V_END |
|
515 |
||
516 |
C2V_VMENTRY(jobject, resolveFieldInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode, jlongArray info_handle)) |
|
517 |
ResourceMark rm; |
|
518 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
519 |
Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF); |
|
520 |
fieldDescriptor fd; |
|
521 |
LinkInfo link_info(cp, index, CHECK_0); |
|
522 |
LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_0); |
|
523 |
typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle); |
|
524 |
assert(info != NULL && info->length() == 2, "must be"); |
|
525 |
info->long_at_put(0, (jlong) fd.access_flags().as_int()); |
|
526 |
info->long_at_put(1, (jlong) fd.offset()); |
|
527 |
oop field_holder = CompilerToVM::get_jvmci_type(fd.field_holder(), CHECK_NULL); |
|
528 |
return JNIHandles::make_local(THREAD, field_holder); |
|
529 |
C2V_END |
|
530 |
||
531 |
C2V_VMENTRY(jint, getVtableIndexForInterfaceMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) |
|
532 |
ResourceMark rm; |
|
533 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
|
534 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
535 |
if (klass->is_interface()) { |
|
536 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", klass->external_name())); |
|
537 |
} |
|
538 |
if (!method->method_holder()->is_interface()) { |
|
539 |
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())); |
|
540 |
} |
|
33632 | 541 |
if (!InstanceKlass::cast(klass)->is_linked()) { |
542 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name())); |
|
33160 | 543 |
} |
544 |
return LinkResolver::vtable_index_of_interface_method(klass, method); |
|
545 |
C2V_END |
|
546 |
||
547 |
C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) |
|
548 |
Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); |
|
549 |
Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type); |
|
550 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
551 |
||
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33593
diff
changeset
|
552 |
if (recv_klass->is_array_klass() || (InstanceKlass::cast(recv_klass)->is_linked())) { |
33160 | 553 |
Klass* holder_klass = method->method_holder(); |
554 |
Symbol* method_name = method->name(); |
|
555 |
Symbol* method_signature = method->signature(); |
|
556 |
||
557 |
if (holder_klass->is_interface()) { |
|
558 |
// do link-time resolution to check all access rules. |
|
34238 | 559 |
LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true); |
33160 | 560 |
methodHandle resolved_method = LinkResolver::linktime_resolve_interface_method_or_null(link_info); |
561 |
if (resolved_method.is_null() || resolved_method->is_private()) { |
|
562 |
return NULL; |
|
563 |
} |
|
564 |
assert(recv_klass->is_subtype_of(holder_klass), ""); |
|
565 |
// do actual lookup |
|
566 |
methodHandle sel_method = LinkResolver::lookup_instance_method_in_klasses(recv_klass, resolved_method->name(), resolved_method->signature(), CHECK_AND_CLEAR_0); |
|
567 |
oop result = CompilerToVM::get_jvmci_method(sel_method, CHECK_NULL); |
|
568 |
return JNIHandles::make_local(THREAD, result); |
|
569 |
} else { |
|
570 |
// do link-time resolution to check all access rules. |
|
34238 | 571 |
LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true); |
33160 | 572 |
methodHandle resolved_method = LinkResolver::linktime_resolve_virtual_method_or_null(link_info); |
573 |
if (resolved_method.is_null()) { |
|
574 |
return NULL; |
|
575 |
} |
|
576 |
// do actual lookup (see LinkResolver::runtime_resolve_virtual_method) |
|
577 |
int vtable_index = Method::invalid_vtable_index; |
|
578 |
Method* selected_method; |
|
579 |
||
580 |
if (resolved_method->method_holder()->is_interface()) { // miranda method |
|
581 |
vtable_index = LinkResolver::vtable_index_of_interface_method(holder_klass, resolved_method); |
|
582 |
assert(vtable_index >= 0 , "we should have valid vtable index at this point"); |
|
583 |
||
584 |
InstanceKlass* inst = InstanceKlass::cast(recv_klass); |
|
585 |
selected_method = inst->method_at_vtable(vtable_index); |
|
586 |
} else { |
|
587 |
// at this point we are sure that resolved_method is virtual and not |
|
588 |
// a miranda method; therefore, it must have a valid vtable index. |
|
589 |
assert(!resolved_method->has_itable_index(), ""); |
|
590 |
vtable_index = resolved_method->vtable_index(); |
|
591 |
// We could get a negative vtable_index for final methods, |
|
592 |
// because as an optimization they are they are never put in the vtable, |
|
593 |
// unless they override an existing method. |
|
594 |
// If we do get a negative, it means the resolved method is the the selected |
|
595 |
// method, and it can never be changed by an override. |
|
596 |
if (vtable_index == Method::nonvirtual_vtable_index) { |
|
597 |
assert(resolved_method->can_be_statically_bound(), "cannot override this method"); |
|
598 |
selected_method = resolved_method(); |
|
599 |
} else { |
|
600 |
// recv_klass might be an arrayKlassOop but all vtables start at |
|
601 |
// the same place. The cast is to avoid virtual call and assertion. |
|
602 |
InstanceKlass* inst = (InstanceKlass*)recv_klass; |
|
603 |
selected_method = inst->method_at_vtable(vtable_index); |
|
604 |
} |
|
605 |
} |
|
606 |
oop result = CompilerToVM::get_jvmci_method(selected_method, CHECK_NULL); |
|
607 |
return JNIHandles::make_local(THREAD, result); |
|
608 |
} |
|
609 |
} |
|
610 |
return NULL; |
|
611 |
C2V_END |
|
612 |
||
613 |
C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject jvmci_type)) |
|
614 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
|
615 |
assert(klass != NULL, "method must not be called for primitive types"); |
|
616 |
return Dependencies::find_finalizable_subclass(klass) != NULL; |
|
617 |
C2V_END |
|
618 |
||
619 |
C2V_VMENTRY(jobject, getClassInitializer, (JNIEnv *, jobject, jobject jvmci_type)) |
|
620 |
InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type); |
|
621 |
oop result = CompilerToVM::get_jvmci_method(klass->class_initializer(), CHECK_NULL); |
|
622 |
return JNIHandles::make_local(THREAD, result); |
|
623 |
C2V_END |
|
624 |
||
625 |
C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr)) |
|
626 |
address target_addr = (address) addr; |
|
627 |
if (target_addr != 0x0) { |
|
628 |
int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int)); |
|
629 |
int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int)); |
|
630 |
return MAX2(ABS(off_low), ABS(off_high)); |
|
631 |
} |
|
632 |
return -1; |
|
633 |
C2V_END |
|
634 |
||
635 |
C2V_VMENTRY(void, doNotInlineOrCompile,(JNIEnv *, jobject, jobject jvmci_method)) |
|
636 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
637 |
method->set_not_c1_compilable(); |
|
638 |
method->set_not_c2_compilable(); |
|
639 |
method->set_dont_inline(true); |
|
640 |
C2V_END |
|
641 |
||
642 |
C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log)) |
|
643 |
ResourceMark rm; |
|
644 |
HandleMark hm; |
|
645 |
Handle target_handle = JNIHandles::resolve(target); |
|
646 |
Handle compiled_code_handle = JNIHandles::resolve(compiled_code); |
|
647 |
CodeBlob* cb = NULL; |
|
648 |
Handle installed_code_handle = JNIHandles::resolve(installed_code); |
|
649 |
Handle speculation_log_handle = JNIHandles::resolve(speculation_log); |
|
650 |
||
651 |
JVMCICompiler* compiler = JVMCICompiler::instance(CHECK_JNI_ERR); |
|
652 |
||
653 |
TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer()); |
|
654 |
CodeInstaller installer; |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
655 |
JVMCIEnv::CodeInstallResult result = installer.install(compiler, target_handle, compiled_code_handle, cb, installed_code_handle, speculation_log_handle, CHECK_0); |
33160 | 656 |
|
657 |
if (PrintCodeCacheOnCompilation) { |
|
658 |
stringStream s; |
|
659 |
// Dump code cache into a buffer before locking the tty, |
|
660 |
{ |
|
661 |
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
|
662 |
CodeCache::print_summary(&s, false); |
|
663 |
} |
|
664 |
ttyLocker ttyl; |
|
665 |
tty->print_raw_cr(s.as_string()); |
|
666 |
} |
|
667 |
||
668 |
if (result != JVMCIEnv::ok) { |
|
669 |
assert(cb == NULL, "should be"); |
|
670 |
} else { |
|
671 |
if (!installed_code_handle.is_null()) { |
|
672 |
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
|
673 |
nmethod::invalidate_installed_code(installed_code_handle, CHECK_0); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
674 |
{ |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
675 |
// Ensure that all updates to the InstalledCode fields are consistent. |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
676 |
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
677 |
InstalledCode::set_address(installed_code_handle, (jlong) cb); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
678 |
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
|
679 |
if (cb->is_nmethod()) { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
680 |
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
|
681 |
} else { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
682 |
InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->code_begin()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
683 |
} |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
684 |
if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
685 |
HotSpotInstalledCode::set_size(installed_code_handle, cb->size()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
686 |
HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
687 |
HotSpotInstalledCode::set_codeSize(installed_code_handle, cb->code_size()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
688 |
} |
33160 | 689 |
} |
690 |
nmethod* nm = cb->as_nmethod_or_null(); |
|
691 |
if (nm != NULL && installed_code_handle->is_scavengable()) { |
|
692 |
assert(nm->detect_scavenge_root_oops(), "nm should be scavengable if installed_code is scavengable"); |
|
693 |
if (!UseG1GC) { |
|
694 |
assert(nm->on_scavenge_root_list(), "nm should be on scavengable list"); |
|
695 |
} |
|
696 |
} |
|
697 |
} |
|
698 |
} |
|
699 |
return result; |
|
700 |
C2V_END |
|
701 |
||
702 |
C2V_VMENTRY(jint, getMetadata, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject metadata)) |
|
703 |
ResourceMark rm; |
|
704 |
HandleMark hm; |
|
705 |
||
706 |
Handle target_handle = JNIHandles::resolve(target); |
|
707 |
Handle compiled_code_handle = JNIHandles::resolve(compiled_code); |
|
708 |
Handle metadata_handle = JNIHandles::resolve(metadata); |
|
709 |
||
710 |
HotSpotOopMap::klass()->initialize(thread); |
|
711 |
||
712 |
CodeMetadata code_metadata; |
|
713 |
CodeBlob *cb = NULL; |
|
714 |
CodeInstaller installer; |
|
715 |
||
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
716 |
JVMCIEnv::CodeInstallResult result = installer.gather_metadata(target_handle, compiled_code_handle, code_metadata, CHECK_0); //cb, pc_descs, nr_pc_descs, scopes_descs, scopes_size, reloc_buffer); |
33160 | 717 |
if (result != JVMCIEnv::ok) { |
718 |
return result; |
|
719 |
} |
|
720 |
||
721 |
if (code_metadata.get_nr_pc_desc() > 0) { |
|
722 |
typeArrayHandle pcArrayOop = oopFactory::new_byteArray(sizeof(PcDesc) * code_metadata.get_nr_pc_desc(), CHECK_(JVMCIEnv::cache_full)); |
|
723 |
memcpy(pcArrayOop->byte_at_addr(0), code_metadata.get_pc_desc(), sizeof(PcDesc) * code_metadata.get_nr_pc_desc()); |
|
724 |
HotSpotMetaData::set_pcDescBytes(metadata_handle, pcArrayOop()); |
|
725 |
} |
|
726 |
||
727 |
if (code_metadata.get_scopes_size() > 0) { |
|
728 |
typeArrayHandle scopesArrayOop = oopFactory::new_byteArray(code_metadata.get_scopes_size(), CHECK_(JVMCIEnv::cache_full)); |
|
729 |
memcpy(scopesArrayOop->byte_at_addr(0), code_metadata.get_scopes_desc(), code_metadata.get_scopes_size()); |
|
730 |
HotSpotMetaData::set_scopesDescBytes(metadata_handle, scopesArrayOop()); |
|
731 |
} |
|
732 |
||
733 |
RelocBuffer* reloc_buffer = code_metadata.get_reloc_buffer(); |
|
734 |
typeArrayHandle relocArrayOop = oopFactory::new_byteArray((int) reloc_buffer->size(), CHECK_(JVMCIEnv::cache_full)); |
|
735 |
if (reloc_buffer->size() > 0) { |
|
736 |
memcpy(relocArrayOop->byte_at_addr(0), reloc_buffer->begin(), reloc_buffer->size()); |
|
737 |
} |
|
738 |
HotSpotMetaData::set_relocBytes(metadata_handle, relocArrayOop()); |
|
739 |
||
740 |
const OopMapSet* oopMapSet = installer.oopMapSet(); |
|
741 |
{ |
|
742 |
ResourceMark mark; |
|
743 |
ImmutableOopMapBuilder builder(oopMapSet); |
|
744 |
int oopmap_size = builder.heap_size(); |
|
745 |
typeArrayHandle oopMapArrayHandle = oopFactory::new_byteArray(oopmap_size, CHECK_(JVMCIEnv::cache_full)); |
|
746 |
builder.generate_into((address) oopMapArrayHandle->byte_at_addr(0)); |
|
747 |
HotSpotMetaData::set_oopMaps(metadata_handle, oopMapArrayHandle()); |
|
748 |
} |
|
749 |
||
750 |
HotSpotMetaData::set_metadata(metadata_handle, NULL); |
|
751 |
||
752 |
ExceptionHandlerTable* handler = code_metadata.get_exception_table(); |
|
753 |
int table_size = handler->size_in_bytes(); |
|
754 |
typeArrayHandle exceptionArrayOop = oopFactory::new_byteArray(table_size, CHECK_(JVMCIEnv::cache_full)); |
|
755 |
||
756 |
if (table_size > 0) { |
|
757 |
handler->copy_bytes_to((address) exceptionArrayOop->byte_at_addr(0)); |
|
758 |
} |
|
759 |
HotSpotMetaData::set_exceptionBytes(metadata_handle, exceptionArrayOop()); |
|
760 |
||
761 |
return result; |
|
762 |
C2V_END |
|
763 |
||
764 |
C2V_VMENTRY(void, notifyCompilationStatistics, (JNIEnv *jniEnv, jobject, jint id, jobject hotspot_method, jboolean osr, jint processedBytecodes, jlong time, jlong timeUnitsPerSecond, jobject installed_code)) |
|
765 |
JVMCICompiler* compiler = JVMCICompiler::instance(CHECK); |
|
766 |
CompilerStatistics* stats = compiler->stats(); |
|
767 |
||
768 |
elapsedTimer timer = elapsedTimer(time, timeUnitsPerSecond); |
|
769 |
if (osr) { |
|
770 |
stats->_osr.update(timer, processedBytecodes); |
|
771 |
} else { |
|
772 |
stats->_standard.update(timer, processedBytecodes); |
|
773 |
} |
|
774 |
Handle installed_code_handle = JNIHandles::resolve(installed_code); |
|
775 |
if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) { |
|
776 |
stats->_nmethods_size += HotSpotInstalledCode::size(installed_code_handle); |
|
777 |
stats->_nmethods_code_size += HotSpotInstalledCode::codeSize(installed_code_handle); |
|
778 |
} |
|
779 |
||
780 |
if (CITimeEach) { |
|
781 |
methodHandle method = CompilerToVM::asMethod(hotspot_method); |
|
782 |
float bytes_per_sec = 1.0 * processedBytecodes / timer.seconds(); |
|
783 |
tty->print_cr("%3d seconds: %f bytes/sec: %f (bytes %d)", |
|
784 |
id, timer.seconds(), bytes_per_sec, processedBytecodes); |
|
785 |
} |
|
786 |
C2V_END |
|
787 |
||
788 |
C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject)) |
|
789 |
JVMCICompiler* compiler = JVMCICompiler::instance(CHECK); |
|
790 |
CompilerStatistics* stats = compiler->stats(); |
|
791 |
stats->_standard.reset(); |
|
792 |
stats->_osr.reset(); |
|
793 |
C2V_END |
|
794 |
||
33632 | 795 |
C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jobject installedCode)) |
33160 | 796 |
ResourceMark rm; |
797 |
HandleMark hm; |
|
798 |
||
33632 | 799 |
if (installedCode == NULL) { |
800 |
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "installedCode is null"); |
|
801 |
} |
|
802 |
||
803 |
jlong codeBlob = InstalledCode::address(installedCode); |
|
804 |
if (codeBlob == 0L) { |
|
805 |
return NULL; |
|
806 |
} |
|
807 |
||
33160 | 808 |
CodeBlob* cb = (CodeBlob*) (address) codeBlob; |
809 |
if (cb == NULL) { |
|
810 |
return NULL; |
|
811 |
} |
|
812 |
||
813 |
// We don't want the stringStream buffer to resize during disassembly as it |
|
814 |
// uses scoped resource memory. If a nested function called during disassembly uses |
|
815 |
// a ResourceMark and the buffer expands within the scope of the mark, |
|
816 |
// the buffer becomes garbage when that scope is exited. Experience shows that |
|
817 |
// the disassembled code is typically about 10x the code size so a fixed buffer |
|
818 |
// sized to 20x code size plus a fixed amount for header info should be sufficient. |
|
819 |
int bufferSize = cb->code_size() * 20 + 1024; |
|
820 |
char* buffer = NEW_RESOURCE_ARRAY(char, bufferSize); |
|
821 |
stringStream st(buffer, bufferSize); |
|
822 |
if (cb->is_nmethod()) { |
|
823 |
nmethod* nm = (nmethod*) cb; |
|
824 |
if (!nm->is_alive()) { |
|
825 |
return NULL; |
|
826 |
} |
|
827 |
Disassembler::decode(nm, &st); |
|
828 |
} else { |
|
829 |
Disassembler::decode(cb, &st); |
|
830 |
} |
|
831 |
if (st.size() <= 0) { |
|
832 |
return NULL; |
|
833 |
} |
|
834 |
||
835 |
Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
|
836 |
return JNIHandles::make_local(THREAD, result()); |
|
837 |
C2V_END |
|
838 |
||
839 |
C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv*, jobject, jobject jvmci_method, int bci)) |
|
840 |
ResourceMark rm; |
|
841 |
HandleMark hm; |
|
842 |
||
843 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
844 |
oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); |
|
845 |
return JNIHandles::make_local(THREAD, element); |
|
846 |
C2V_END |
|
847 |
||
848 |
C2V_VMENTRY(jobject, executeInstalledCode, (JNIEnv*, jobject, jobject args, jobject hotspotInstalledCode)) |
|
849 |
ResourceMark rm; |
|
850 |
HandleMark hm; |
|
851 |
||
852 |
jlong nmethodValue = InstalledCode::address(hotspotInstalledCode); |
|
853 |
if (nmethodValue == 0L) { |
|
854 |
THROW_NULL(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException()); |
|
855 |
} |
|
856 |
nmethod* nm = (nmethod*) (address) nmethodValue; |
|
857 |
methodHandle mh = nm->method(); |
|
858 |
Symbol* signature = mh->signature(); |
|
859 |
JavaCallArguments jca(mh->size_of_parameters()); |
|
860 |
||
861 |
JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
|
862 |
JavaValue result(jap.get_ret_type()); |
|
863 |
jca.set_alternative_target(nm); |
|
864 |
JavaCalls::call(&result, mh, &jca, CHECK_NULL); |
|
865 |
||
866 |
if (jap.get_ret_type() == T_VOID) { |
|
867 |
return NULL; |
|
868 |
} else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) { |
|
869 |
return JNIHandles::make_local(THREAD, (oop) result.get_jobject()); |
|
870 |
} else { |
|
871 |
jvalue *value = (jvalue *) result.get_value_addr(); |
|
872 |
// Narrow the value down if required (Important on big endian machines) |
|
873 |
switch (jap.get_ret_type()) { |
|
874 |
case T_BOOLEAN: |
|
875 |
value->z = (jboolean) value->i; |
|
876 |
break; |
|
877 |
case T_BYTE: |
|
878 |
value->b = (jbyte) value->i; |
|
879 |
break; |
|
880 |
case T_CHAR: |
|
881 |
value->c = (jchar) value->i; |
|
882 |
break; |
|
883 |
case T_SHORT: |
|
884 |
value->s = (jshort) value->i; |
|
885 |
break; |
|
886 |
} |
|
887 |
oop o = java_lang_boxing_object::create(jap.get_ret_type(), value, CHECK_NULL); |
|
888 |
return JNIHandles::make_local(THREAD, o); |
|
889 |
} |
|
890 |
C2V_END |
|
891 |
||
892 |
C2V_VMENTRY(jlongArray, getLineNumberTable, (JNIEnv *, jobject, jobject jvmci_method)) |
|
893 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
894 |
if (!method->has_linenumber_table()) { |
|
895 |
return NULL; |
|
896 |
} |
|
897 |
u2 num_entries = 0; |
|
898 |
CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table()); |
|
899 |
while (streamForSize.read_pair()) { |
|
900 |
num_entries++; |
|
901 |
} |
|
902 |
||
903 |
CompressedLineNumberReadStream stream(method->compressed_linenumber_table()); |
|
904 |
typeArrayOop result = oopFactory::new_longArray(2 * num_entries, CHECK_NULL); |
|
905 |
||
906 |
int i = 0; |
|
907 |
jlong value; |
|
908 |
while (stream.read_pair()) { |
|
909 |
value = ((long) stream.bci()); |
|
910 |
result->long_at_put(i, value); |
|
911 |
value = ((long) stream.line()); |
|
912 |
result->long_at_put(i + 1, value); |
|
913 |
i += 2; |
|
914 |
} |
|
915 |
||
916 |
return (jlongArray) JNIHandles::make_local(THREAD, result); |
|
917 |
C2V_END |
|
918 |
||
919 |
C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jobject jvmci_method)) |
|
920 |
ResourceMark rm; |
|
921 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
922 |
if (!method->has_localvariable_table()) { |
|
923 |
return 0; |
|
924 |
} |
|
925 |
return (jlong) (address) method->localvariable_table_start(); |
|
926 |
C2V_END |
|
927 |
||
928 |
C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jobject jvmci_method)) |
|
929 |
ResourceMark rm; |
|
930 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
931 |
return method->localvariable_table_length(); |
|
932 |
C2V_END |
|
933 |
||
934 |
C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jobject jvmci_method)) |
|
935 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
936 |
MethodCounters* mcs = method->method_counters(); |
|
937 |
if (mcs != NULL) { |
|
938 |
mcs->clear_counters(); |
|
939 |
} |
|
940 |
NOT_PRODUCT(method->set_compiled_invocation_count(0)); |
|
941 |
||
942 |
nmethod* code = method->code(); |
|
943 |
if (code != NULL) { |
|
944 |
code->make_not_entrant(); |
|
945 |
} |
|
946 |
||
947 |
MethodData* method_data = method->method_data(); |
|
948 |
if (method_data == NULL) { |
|
949 |
ClassLoaderData* loader_data = method->method_holder()->class_loader_data(); |
|
950 |
method_data = MethodData::allocate(loader_data, method, CHECK); |
|
951 |
method->set_method_data(method_data); |
|
952 |
} else { |
|
953 |
method_data->initialize(); |
|
954 |
} |
|
955 |
C2V_END |
|
956 |
||
957 |
||
33632 | 958 |
C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject installed_code)) |
959 |
Handle installed_code_handle = JNIHandles::resolve(installed_code); |
|
35092
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
960 |
nmethod::invalidate_installed_code(installed_code_handle, CHECK); |
33160 | 961 |
C2V_END |
962 |
||
963 |
C2V_VMENTRY(jobject, readUncompressedOop, (JNIEnv*, jobject, jlong addr)) |
|
964 |
oop ret = oopDesc::load_decode_heap_oop((oop*)(address)addr); |
|
965 |
return JNIHandles::make_local(THREAD, ret); |
|
966 |
C2V_END |
|
967 |
||
968 |
C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject)) |
|
969 |
typeArrayOop arrayOop = oopFactory::new_longArray(JVMCICounterSize, CHECK_NULL); |
|
970 |
JavaThread::collect_counters(arrayOop); |
|
971 |
return (jlongArray) JNIHandles::make_local(THREAD, arrayOop); |
|
972 |
C2V_END |
|
973 |
||
974 |
C2V_VMENTRY(int, allocateCompileId, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci)) |
|
975 |
HandleMark hm; |
|
976 |
ResourceMark rm; |
|
977 |
if (JNIHandles::resolve(jvmci_method) == NULL) { |
|
978 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
979 |
} |
|
980 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
981 |
if (entry_bci >= method->code_size() || entry_bci < -1) { |
|
982 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Unexpected bci %d", entry_bci)); |
|
983 |
} |
|
984 |
return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci); |
|
985 |
C2V_END |
|
986 |
||
987 |
||
988 |
C2V_VMENTRY(jboolean, isMature, (JNIEnv*, jobject, jlong metaspace_method_data)) |
|
989 |
MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data); |
|
990 |
return mdo != NULL && mdo->is_mature(); |
|
991 |
C2V_END |
|
992 |
||
993 |
C2V_VMENTRY(jboolean, hasCompiledCodeForOSR, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci, int comp_level)) |
|
994 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
995 |
return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL; |
|
996 |
C2V_END |
|
997 |
||
998 |
C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong symbol)) |
|
999 |
Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)symbol, CHECK_NULL); |
|
1000 |
return JNIHandles::make_local(THREAD, sym()); |
|
1001 |
C2V_END |
|
1002 |
||
1003 |
bool matches(jobjectArray methods, Method* method) { |
|
1004 |
objArrayOop methods_oop = (objArrayOop) JNIHandles::resolve(methods); |
|
1005 |
||
1006 |
for (int i = 0; i < methods_oop->length(); i++) { |
|
33632 | 1007 |
oop resolved = methods_oop->obj_at(i); |
1008 |
if (resolved->is_a(HotSpotResolvedJavaMethodImpl::klass()) && CompilerToVM::asMethod(resolved) == method) { |
|
33160 | 1009 |
return true; |
1010 |
} |
|
1011 |
} |
|
1012 |
return false; |
|
1013 |
} |
|
1014 |
||
1015 |
C2V_VMENTRY(jobject, getNextStackFrame, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jobjectArray methods, jint initialSkip)) |
|
1016 |
ResourceMark rm; |
|
1017 |
||
1018 |
if (!thread->has_last_Java_frame()) return NULL; |
|
1019 |
Handle result = HotSpotStackFrameReference::klass()->allocate_instance(thread); |
|
1020 |
HotSpotStackFrameReference::klass()->initialize(thread); |
|
1021 |
||
1022 |
StackFrameStream fst(thread); |
|
1023 |
if (hs_frame != NULL) { |
|
1024 |
// look for the correct stack frame if one is given |
|
1025 |
intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame); |
|
1026 |
while (fst.current()->sp() != stack_pointer && !fst.is_done()) { |
|
1027 |
fst.next(); |
|
1028 |
} |
|
1029 |
if (fst.current()->sp() != stack_pointer) { |
|
1030 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "stack frame not found") |
|
1031 |
} |
|
1032 |
} |
|
1033 |
||
1034 |
int frame_number = 0; |
|
1035 |
vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1036 |
if (hs_frame != NULL) { |
|
1037 |
// look for the correct vframe within the stack frame if one is given |
|
1038 |
int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame); |
|
1039 |
while (frame_number < last_frame_number) { |
|
1040 |
if (vf->is_top()) { |
|
1041 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "invalid frame number") |
|
1042 |
} |
|
1043 |
vf = vf->sender(); |
|
1044 |
frame_number ++; |
|
1045 |
} |
|
1046 |
// move one frame forward |
|
1047 |
if (vf->is_top()) { |
|
1048 |
if (fst.is_done()) { |
|
1049 |
return NULL; |
|
1050 |
} |
|
1051 |
fst.next(); |
|
1052 |
vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1053 |
frame_number = 0; |
|
1054 |
} else { |
|
1055 |
vf = vf->sender(); |
|
1056 |
frame_number++; |
|
1057 |
} |
|
1058 |
} |
|
1059 |
||
1060 |
while (true) { |
|
1061 |
// look for the given method |
|
1062 |
while (true) { |
|
1063 |
StackValueCollection* locals = NULL; |
|
1064 |
if (vf->is_compiled_frame()) { |
|
1065 |
// compiled method frame |
|
1066 |
compiledVFrame* cvf = compiledVFrame::cast(vf); |
|
1067 |
if (methods == NULL || matches(methods, cvf->method())) { |
|
1068 |
if (initialSkip > 0) { |
|
1069 |
initialSkip --; |
|
1070 |
} else { |
|
1071 |
ScopeDesc* scope = cvf->scope(); |
|
1072 |
// native wrapper do not have a scope |
|
1073 |
if (scope != NULL && scope->objects() != NULL) { |
|
1074 |
bool realloc_failures = Deoptimization::realloc_objects(thread, fst.current(), scope->objects(), THREAD); |
|
1075 |
Deoptimization::reassign_fields(fst.current(), fst.register_map(), scope->objects(), realloc_failures, false); |
|
1076 |
||
1077 |
GrowableArray<ScopeValue*>* local_values = scope->locals(); |
|
1078 |
typeArrayHandle array = oopFactory::new_boolArray(local_values->length(), thread); |
|
1079 |
for (int i = 0; i < local_values->length(); i++) { |
|
1080 |
ScopeValue* value = local_values->at(i); |
|
1081 |
if (value->is_object()) { |
|
1082 |
array->bool_at_put(i, true); |
|
1083 |
} |
|
1084 |
} |
|
1085 |
HotSpotStackFrameReference::set_localIsVirtual(result, array()); |
|
1086 |
} else { |
|
1087 |
HotSpotStackFrameReference::set_localIsVirtual(result, NULL); |
|
1088 |
} |
|
1089 |
||
1090 |
locals = cvf->locals(); |
|
1091 |
HotSpotStackFrameReference::set_bci(result, cvf->bci()); |
|
1092 |
oop method = CompilerToVM::get_jvmci_method(cvf->method(), CHECK_NULL); |
|
1093 |
HotSpotStackFrameReference::set_method(result, method); |
|
1094 |
} |
|
1095 |
} |
|
1096 |
} else if (vf->is_interpreted_frame()) { |
|
1097 |
// interpreted method frame |
|
1098 |
interpretedVFrame* ivf = interpretedVFrame::cast(vf); |
|
1099 |
if (methods == NULL || matches(methods, ivf->method())) { |
|
1100 |
if (initialSkip > 0) { |
|
1101 |
initialSkip --; |
|
1102 |
} else { |
|
1103 |
locals = ivf->locals(); |
|
1104 |
HotSpotStackFrameReference::set_bci(result, ivf->bci()); |
|
1105 |
oop method = CompilerToVM::get_jvmci_method(ivf->method(), CHECK_NULL); |
|
1106 |
HotSpotStackFrameReference::set_method(result, method); |
|
1107 |
HotSpotStackFrameReference::set_localIsVirtual(result, NULL); |
|
1108 |
} |
|
1109 |
} |
|
1110 |
} |
|
1111 |
||
1112 |
// locals != NULL means that we found a matching frame and result is already partially initialized |
|
1113 |
if (locals != NULL) { |
|
1114 |
HotSpotStackFrameReference::set_compilerToVM(result, JNIHandles::resolve(compilerToVM)); |
|
1115 |
HotSpotStackFrameReference::set_stackPointer(result, (jlong) fst.current()->sp()); |
|
1116 |
HotSpotStackFrameReference::set_frameNumber(result, frame_number); |
|
1117 |
||
1118 |
// initialize the locals array |
|
1119 |
objArrayHandle array = oopFactory::new_objectArray(locals->size(), thread); |
|
1120 |
for (int i = 0; i < locals->size(); i++) { |
|
1121 |
StackValue* var = locals->at(i); |
|
1122 |
if (var->type() == T_OBJECT) { |
|
1123 |
array->obj_at_put(i, locals->at(i)->get_obj()()); |
|
1124 |
} |
|
1125 |
} |
|
1126 |
HotSpotStackFrameReference::set_locals(result, array()); |
|
1127 |
||
1128 |
return JNIHandles::make_local(thread, result()); |
|
1129 |
} |
|
1130 |
||
1131 |
if (vf->is_top()) { |
|
1132 |
break; |
|
1133 |
} |
|
1134 |
frame_number++; |
|
1135 |
vf = vf->sender(); |
|
1136 |
} // end of vframe loop |
|
1137 |
||
1138 |
if (fst.is_done()) { |
|
1139 |
break; |
|
1140 |
} |
|
1141 |
fst.next(); |
|
1142 |
vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1143 |
frame_number = 0; |
|
1144 |
} // end of frame loop |
|
1145 |
||
1146 |
// the end was reached without finding a matching method |
|
1147 |
return NULL; |
|
1148 |
C2V_END |
|
1149 |
||
1150 |
C2V_VMENTRY(void, resolveInvokeDynamicInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
1151 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
1152 |
CallInfo callInfo; |
|
1153 |
LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokedynamic, CHECK); |
|
1154 |
ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index); |
|
1155 |
cp_cache_entry->set_dynamic_call(cp, callInfo); |
|
1156 |
C2V_END |
|
1157 |
||
1158 |
C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
1159 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
1160 |
CallInfo callInfo; |
|
1161 |
LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); |
|
1162 |
ConstantPoolCacheEntry* cp_cache_entry = cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index)); |
|
1163 |
cp_cache_entry->set_method_handle(cp, callInfo); |
|
1164 |
C2V_END |
|
1165 |
||
1166 |
C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject)) |
|
1167 |
//see compute_recording_non_safepoints in debugInfroRec.cpp |
|
1168 |
if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
|
1169 |
return true; |
|
1170 |
} |
|
1171 |
return DebugNonSafepoints; |
|
1172 |
C2V_END |
|
1173 |
||
1174 |
// public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate); |
|
1175 |
C2V_VMENTRY(void, materializeVirtualObjects, (JNIEnv*, jobject, jobject hs_frame, bool invalidate)) |
|
1176 |
ResourceMark rm; |
|
1177 |
||
1178 |
if (hs_frame == NULL) { |
|
1179 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), "stack frame is null") |
|
1180 |
} |
|
1181 |
||
1182 |
HotSpotStackFrameReference::klass()->initialize(thread); |
|
1183 |
||
1184 |
// look for the given stack frame |
|
1185 |
StackFrameStream fst(thread); |
|
1186 |
intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame); |
|
1187 |
while (fst.current()->sp() != stack_pointer && !fst.is_done()) { |
|
1188 |
fst.next(); |
|
1189 |
} |
|
1190 |
if (fst.current()->sp() != stack_pointer) { |
|
1191 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found") |
|
1192 |
} |
|
1193 |
||
1194 |
if (invalidate) { |
|
1195 |
if (!fst.current()->is_compiled_frame()) { |
|
1196 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1197 |
} |
|
1198 |
assert(fst.current()->cb()->is_nmethod(), "nmethod expected"); |
|
1199 |
((nmethod*) fst.current()->cb())->make_not_entrant(); |
|
1200 |
} |
|
1201 |
Deoptimization::deoptimize(thread, *fst.current(), fst.register_map(), Deoptimization::Reason_none); |
|
1202 |
// look for the frame again as it has been updated by deopt (pc, deopt state...) |
|
1203 |
StackFrameStream fstAfterDeopt(thread); |
|
1204 |
while (fstAfterDeopt.current()->sp() != stack_pointer && !fstAfterDeopt.is_done()) { |
|
1205 |
fstAfterDeopt.next(); |
|
1206 |
} |
|
1207 |
if (fstAfterDeopt.current()->sp() != stack_pointer) { |
|
1208 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found after deopt") |
|
1209 |
} |
|
1210 |
||
1211 |
vframe* vf = vframe::new_vframe(fstAfterDeopt.current(), fstAfterDeopt.register_map(), thread); |
|
1212 |
if (!vf->is_compiled_frame()) { |
|
1213 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1214 |
} |
|
1215 |
||
1216 |
GrowableArray<compiledVFrame*>* virtualFrames = new GrowableArray<compiledVFrame*>(10); |
|
1217 |
while (true) { |
|
1218 |
assert(vf->is_compiled_frame(), "Wrong frame type"); |
|
1219 |
virtualFrames->push(compiledVFrame::cast(vf)); |
|
1220 |
if (vf->is_top()) { |
|
1221 |
break; |
|
1222 |
} |
|
1223 |
vf = vf->sender(); |
|
1224 |
} |
|
1225 |
||
1226 |
int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame); |
|
1227 |
if (last_frame_number >= virtualFrames->length()) { |
|
1228 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "invalid frame number") |
|
1229 |
} |
|
1230 |
||
1231 |
// Reallocate the non-escaping objects and restore their fields. |
|
1232 |
assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope"); |
|
1233 |
GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects(); |
|
1234 |
||
1235 |
if (objects == NULL) { |
|
1236 |
// no objects to materialize |
|
1237 |
return; |
|
1238 |
} |
|
1239 |
||
1240 |
bool realloc_failures = Deoptimization::realloc_objects(thread, fstAfterDeopt.current(), objects, THREAD); |
|
1241 |
Deoptimization::reassign_fields(fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, realloc_failures, false); |
|
1242 |
||
1243 |
for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) { |
|
1244 |
compiledVFrame* cvf = virtualFrames->at(frame_index); |
|
1245 |
||
1246 |
GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals(); |
|
1247 |
StackValueCollection* locals = cvf->locals(); |
|
1248 |
||
1249 |
if (locals != NULL) { |
|
1250 |
for (int i2 = 0; i2 < locals->size(); i2++) { |
|
1251 |
StackValue* var = locals->at(i2); |
|
1252 |
if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) { |
|
1253 |
jvalue val; |
|
1254 |
val.l = (jobject) locals->at(i2)->get_obj()(); |
|
1255 |
cvf->update_local(T_OBJECT, i2, val); |
|
1256 |
} |
|
1257 |
} |
|
1258 |
} |
|
1259 |
} |
|
1260 |
||
1261 |
// all locals are materialized by now |
|
1262 |
HotSpotStackFrameReference::set_localIsVirtual(hs_frame, NULL); |
|
1263 |
||
1264 |
// update the locals array |
|
1265 |
objArrayHandle array = HotSpotStackFrameReference::locals(hs_frame); |
|
1266 |
StackValueCollection* locals = virtualFrames->at(last_frame_number)->locals(); |
|
1267 |
for (int i = 0; i < locals->size(); i++) { |
|
1268 |
StackValue* var = locals->at(i); |
|
1269 |
if (var->type() == T_OBJECT) { |
|
1270 |
array->obj_at_put(i, locals->at(i)->get_obj()()); |
|
1271 |
} |
|
1272 |
} |
|
1273 |
C2V_END |
|
1274 |
||
1275 |
C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length)) |
|
1276 |
if (bytes == NULL) { |
|
1277 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1278 |
} |
|
1279 |
typeArrayOop array = (typeArrayOop) JNIHandles::resolve(bytes); |
|
1280 |
||
1281 |
// Check if offset and length are non negative. |
|
1282 |
if (offset < 0 || length < 0) { |
|
1283 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
1284 |
} |
|
1285 |
// Check if the range is valid. |
|
1286 |
if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) { |
|
1287 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
1288 |
} |
|
1289 |
while (length > 0) { |
|
1290 |
jbyte* start = array->byte_at_addr(offset); |
|
1291 |
tty->write((char*) start, MIN2(length, O_BUFLEN)); |
|
1292 |
length -= O_BUFLEN; |
|
1293 |
offset += O_BUFLEN; |
|
1294 |
} |
|
1295 |
C2V_END |
|
1296 |
||
1297 |
C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject)) |
|
1298 |
tty->flush(); |
|
1299 |
C2V_END |
|
1300 |
||
33632 | 1301 |
C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position)) |
1302 |
ResourceMark rm; |
|
1303 |
MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data); |
|
1304 |
ProfileData* profile_data = mdo->data_at(position); |
|
1305 |
if (mdo->is_valid(profile_data)) { |
|
1306 |
return profile_data->size_in_bytes(); |
|
1307 |
} |
|
1308 |
DataLayout* data = mdo->extra_data_base(); |
|
1309 |
DataLayout* end = mdo->extra_data_limit(); |
|
1310 |
for (;; data = mdo->next_extra(data)) { |
|
1311 |
assert(data < end, "moved past end of extra data"); |
|
1312 |
profile_data = data->data_in(); |
|
1313 |
if (mdo->dp_to_di(profile_data->dp()) == position) { |
|
1314 |
return profile_data->size_in_bytes(); |
|
1315 |
} |
|
1316 |
} |
|
1317 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position)); |
|
1318 |
C2V_END |
|
1319 |
||
33160 | 1320 |
|
1321 |
#define CC (char*) /*cast a literal from (const char*)*/ |
|
1322 |
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) |
|
1323 |
||
1324 |
#define STRING "Ljava/lang/String;" |
|
1325 |
#define OBJECT "Ljava/lang/Object;" |
|
1326 |
#define CLASS "Ljava/lang/Class;" |
|
1327 |
#define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
|
1328 |
#define INSTALLED_CODE "Ljdk/vm/ci/code/InstalledCode;" |
|
1329 |
#define TARGET_DESCRIPTION "Ljdk/vm/ci/code/TargetDescription;" |
|
1330 |
#define RESOLVED_METHOD "Ljdk/vm/ci/meta/ResolvedJavaMethod;" |
|
1331 |
#define HS_RESOLVED_METHOD "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;" |
|
1332 |
#define HS_RESOLVED_KLASS "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;" |
|
1333 |
#define HS_CONSTANT_POOL "Ljdk/vm/ci/hotspot/HotSpotConstantPool;" |
|
1334 |
#define HS_COMPILED_CODE "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;" |
|
33632 | 1335 |
#define HS_CONFIG "Ljdk/vm/ci/hotspot/HotSpotVMConfig;" |
33160 | 1336 |
#define HS_METADATA "Ljdk/vm/ci/hotspot/HotSpotMetaData;" |
1337 |
#define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;" |
|
33632 | 1338 |
#define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;" |
33160 | 1339 |
#define METASPACE_METHOD_DATA "J" |
1340 |
||
1341 |
JNINativeMethod CompilerToVM::methods[] = { |
|
1342 |
{CC"getBytecode", CC"("HS_RESOLVED_METHOD")[B", FN_PTR(getBytecode)}, |
|
1343 |
{CC"getExceptionTableStart", CC"("HS_RESOLVED_METHOD")J", FN_PTR(getExceptionTableStart)}, |
|
1344 |
{CC"getExceptionTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getExceptionTableLength)}, |
|
1345 |
{CC"findUniqueConcreteMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")"HS_RESOLVED_METHOD, FN_PTR(findUniqueConcreteMethod)}, |
|
1346 |
{CC"getImplementor", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_KLASS, FN_PTR(getImplementor)}, |
|
1347 |
{CC"getStackTraceElement", CC"("HS_RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, |
|
1348 |
{CC"methodIsIgnoredBySecurityStackWalk", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(methodIsIgnoredBySecurityStackWalk)}, |
|
1349 |
{CC"doNotInlineOrCompile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(doNotInlineOrCompile)}, |
|
1350 |
{CC"canInlineMethod", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(canInlineMethod)}, |
|
1351 |
{CC"shouldInlineMethod", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(shouldInlineMethod)}, |
|
1352 |
{CC"lookupType", CC"("STRING CLASS"Z)"HS_RESOLVED_KLASS, FN_PTR(lookupType)}, |
|
1353 |
{CC"lookupNameInPool", CC"("HS_CONSTANT_POOL"I)"STRING, FN_PTR(lookupNameInPool)}, |
|
1354 |
{CC"lookupNameAndTypeRefIndexInPool", CC"("HS_CONSTANT_POOL"I)I", FN_PTR(lookupNameAndTypeRefIndexInPool)}, |
|
1355 |
{CC"lookupSignatureInPool", CC"("HS_CONSTANT_POOL"I)"STRING, FN_PTR(lookupSignatureInPool)}, |
|
1356 |
{CC"lookupKlassRefIndexInPool", CC"("HS_CONSTANT_POOL"I)I", FN_PTR(lookupKlassRefIndexInPool)}, |
|
1357 |
{CC"lookupKlassInPool", CC"("HS_CONSTANT_POOL"I)Ljava/lang/Object;", FN_PTR(lookupKlassInPool)}, |
|
1358 |
{CC"lookupAppendixInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(lookupAppendixInPool)}, |
|
1359 |
{CC"lookupMethodInPool", CC"("HS_CONSTANT_POOL"IB)"HS_RESOLVED_METHOD, FN_PTR(lookupMethodInPool)}, |
|
1360 |
{CC"constantPoolRemapInstructionOperandFromCache", CC"("HS_CONSTANT_POOL"I)I", FN_PTR(constantPoolRemapInstructionOperandFromCache)}, |
|
1361 |
{CC"resolveConstantInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolveConstantInPool)}, |
|
1362 |
{CC"resolvePossiblyCachedConstantInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)}, |
|
1363 |
{CC"resolveTypeInPool", CC"("HS_CONSTANT_POOL"I)"HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)}, |
|
1364 |
{CC"resolveFieldInPool", CC"("HS_CONSTANT_POOL"IB[J)"HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)}, |
|
1365 |
{CC"resolveInvokeDynamicInPool", CC"("HS_CONSTANT_POOL"I)V", FN_PTR(resolveInvokeDynamicInPool)}, |
|
1366 |
{CC"resolveInvokeHandleInPool", CC"("HS_CONSTANT_POOL"I)V", FN_PTR(resolveInvokeHandleInPool)}, |
|
1367 |
{CC"resolveMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD, FN_PTR(resolveMethod)}, |
|
1368 |
{CC"getVtableIndexForInterfaceMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")I", FN_PTR(getVtableIndexForInterfaceMethod)}, |
|
1369 |
{CC"getClassInitializer", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD, FN_PTR(getClassInitializer)}, |
|
1370 |
{CC"hasFinalizableSubclass", CC"("HS_RESOLVED_KLASS")Z", FN_PTR(hasFinalizableSubclass)}, |
|
1371 |
{CC"getMaxCallTargetOffset", CC"(J)J", FN_PTR(getMaxCallTargetOffset)}, |
|
1372 |
{CC"getResolvedJavaMethodAtSlot", CC"("CLASS"I)"HS_RESOLVED_METHOD, FN_PTR(getResolvedJavaMethodAtSlot)}, |
|
1373 |
{CC"getResolvedJavaMethod", CC"(Ljava/lang/Object;J)"HS_RESOLVED_METHOD, FN_PTR(getResolvedJavaMethod)}, |
|
1374 |
{CC"getConstantPool", CC"(Ljava/lang/Object;J)"HS_CONSTANT_POOL, FN_PTR(getConstantPool)}, |
|
1375 |
{CC"getResolvedJavaType", CC"(Ljava/lang/Object;JZ)"HS_RESOLVED_KLASS, FN_PTR(getResolvedJavaType)}, |
|
33632 | 1376 |
{CC"initializeConfiguration", CC"("HS_CONFIG")J", FN_PTR(initializeConfiguration)}, |
1377 |
{CC"installCode", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG")I", FN_PTR(installCode)}, |
|
33160 | 1378 |
{CC"getMetadata", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE HS_METADATA")I", FN_PTR(getMetadata)}, |
1379 |
{CC"notifyCompilationStatistics", CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V", FN_PTR(notifyCompilationStatistics)}, |
|
1380 |
{CC"resetCompilationStatistics", CC"()V", FN_PTR(resetCompilationStatistics)}, |
|
33632 | 1381 |
{CC"disassembleCodeBlob", CC"("INSTALLED_CODE")"STRING, FN_PTR(disassembleCodeBlob)}, |
33160 | 1382 |
{CC"executeInstalledCode", CC"(["OBJECT INSTALLED_CODE")"OBJECT, FN_PTR(executeInstalledCode)}, |
1383 |
{CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)}, |
|
1384 |
{CC"getLocalVariableTableStart", CC"("HS_RESOLVED_METHOD")J", FN_PTR(getLocalVariableTableStart)}, |
|
1385 |
{CC"getLocalVariableTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getLocalVariableTableLength)}, |
|
1386 |
{CC"reprofile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(reprofile)}, |
|
1387 |
{CC"invalidateInstalledCode", CC"("INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)}, |
|
1388 |
{CC"readUncompressedOop", CC"(J)"OBJECT, FN_PTR(readUncompressedOop)}, |
|
1389 |
{CC"collectCounters", CC"()[J", FN_PTR(collectCounters)}, |
|
1390 |
{CC"allocateCompileId", CC"("HS_RESOLVED_METHOD"I)I", FN_PTR(allocateCompileId)}, |
|
1391 |
{CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)}, |
|
1392 |
{CC"hasCompiledCodeForOSR", CC"("HS_RESOLVED_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)}, |
|
1393 |
{CC"getSymbol", CC"(J)"STRING, FN_PTR(getSymbol)}, |
|
33632 | 1394 |
{CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)}, |
33160 | 1395 |
{CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)}, |
1396 |
{CC"shouldDebugNonSafepoints", CC"()Z", FN_PTR(shouldDebugNonSafepoints)}, |
|
1397 |
{CC"writeDebugOutput", CC"([BII)V", FN_PTR(writeDebugOutput)}, |
|
1398 |
{CC"flushDebugOutput", CC"()V", FN_PTR(flushDebugOutput)}, |
|
33632 | 1399 |
{CC"methodDataProfileDataSize", CC"(JI)I", FN_PTR(methodDataProfileDataSize)}, |
33160 | 1400 |
}; |
1401 |
||
1402 |
int CompilerToVM::methods_count() { |
|
1403 |
return sizeof(methods) / sizeof(JNINativeMethod); |
|
1404 |
} |
|
1405 |