author | rkennke |
Thu, 15 Feb 2018 23:45:15 +0100 | |
changeset 49036 | bc92debe57e4 |
parent 48826 | c4d9d1b08e2e |
child 49164 | 7e958a8ebcd3 |
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" |
|
35498
392b50de06c6
8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents:
34317
diff
changeset
|
25 |
#include "classfile/javaClasses.inline.hpp" |
33160 | 26 |
#include "code/codeCache.hpp" |
27 |
#include "code/scopeDesc.hpp" |
|
28 |
#include "interpreter/linkResolver.hpp" |
|
29 |
#include "memory/oopFactory.hpp" |
|
37248 | 30 |
#include "memory/resourceArea.hpp" |
33160 | 31 |
#include "oops/generateOopMap.hpp" |
32 |
#include "oops/fieldStreams.hpp" |
|
33 |
#include "oops/oop.inline.hpp" |
|
34 |
#include "oops/objArrayOop.inline.hpp" |
|
49036
bc92debe57e4
8197999: Accessors in typeArrayOopDesc should use new Access API
rkennke
parents:
48826
diff
changeset
|
35 |
#include "oops/typeArrayOop.inline.hpp" |
33160 | 36 |
#include "runtime/fieldDescriptor.hpp" |
37 |
#include "runtime/javaCalls.hpp" |
|
38 |
#include "jvmci/jvmciRuntime.hpp" |
|
39 |
#include "compiler/abstractCompiler.hpp" |
|
40 |
#include "compiler/compileBroker.hpp" |
|
41 |
#include "compiler/compilerOracle.hpp" |
|
42 |
#include "compiler/disassembler.hpp" |
|
43 |
#include "compiler/oopMap.hpp" |
|
44 |
#include "jvmci/jvmciCompilerToVM.hpp" |
|
45 |
#include "jvmci/jvmciCompiler.hpp" |
|
46 |
#include "jvmci/jvmciEnv.hpp" |
|
47 |
#include "jvmci/jvmciJavaClasses.hpp" |
|
48 |
#include "jvmci/jvmciCodeInstaller.hpp" |
|
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
49 |
#include "jvmci/vmStructs_jvmci.hpp" |
33160 | 50 |
#include "gc/g1/heapRegion.hpp" |
51 |
#include "runtime/javaCalls.hpp" |
|
52 |
#include "runtime/deoptimization.hpp" |
|
37161
e881f320966e
8150015: Integrate TraceTime with Unified Logging more seamlessly
rehn
parents:
35913
diff
changeset
|
53 |
#include "runtime/timerTrace.hpp" |
33160 | 54 |
#include "runtime/vframe.hpp" |
55 |
#include "runtime/vframe_hp.hpp" |
|
56 |
#include "runtime/vmStructs.hpp" |
|
43939 | 57 |
#include "utilities/resourceHash.hpp" |
33160 | 58 |
|
59 |
||
44092 | 60 |
void JNIHandleMark::push_jni_handle_block() { |
61 |
JavaThread* thread = JavaThread::current(); |
|
62 |
if (thread != NULL) { |
|
63 |
// Allocate a new block for JNI handles. |
|
64 |
// Inlined code from jni_PushLocalFrame() |
|
65 |
JNIHandleBlock* java_handles = ((JavaThread*)thread)->active_handles(); |
|
66 |
JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread); |
|
67 |
assert(compile_handles != NULL && java_handles != NULL, "should not be NULL"); |
|
68 |
compile_handles->set_pop_frame_link(java_handles); |
|
69 |
thread->set_active_handles(compile_handles); |
|
70 |
} |
|
71 |
} |
|
72 |
||
73 |
void JNIHandleMark::pop_jni_handle_block() { |
|
74 |
JavaThread* thread = JavaThread::current(); |
|
75 |
if (thread != NULL) { |
|
76 |
// Release our JNI handle block |
|
77 |
JNIHandleBlock* compile_handles = thread->active_handles(); |
|
78 |
JNIHandleBlock* java_handles = compile_handles->pop_frame_link(); |
|
79 |
thread->set_active_handles(java_handles); |
|
80 |
compile_handles->set_pop_frame_link(NULL); |
|
81 |
JNIHandleBlock::release_block(compile_handles, thread); // may block |
|
82 |
} |
|
83 |
} |
|
84 |
||
33160 | 85 |
// Entry to native method implementation that transitions current thread to '_thread_in_vm'. |
86 |
#define C2V_VMENTRY(result_type, name, signature) \ |
|
87 |
JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
|
88 |
TRACE_jvmci_1("CompilerToVM::" #name); \ |
|
89 |
TRACE_CALL(result_type, jvmci_ ## name signature) \ |
|
90 |
JVMCI_VM_ENTRY_MARK; \ |
|
91 |
||
92 |
#define C2V_END } |
|
93 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33160
diff
changeset
|
94 |
oop CompilerToVM::get_jvmci_method(const methodHandle& method, TRAPS) { |
33160 | 95 |
if (method() != NULL) { |
96 |
JavaValue result(T_OBJECT); |
|
97 |
JavaCallArguments args; |
|
98 |
args.push_long((jlong) (address) method()); |
|
99 |
JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_NULL); |
|
100 |
||
101 |
return (oop)result.get_jobject(); |
|
102 |
} |
|
103 |
return NULL; |
|
104 |
} |
|
105 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
106 |
oop CompilerToVM::get_jvmci_type(Klass* klass, TRAPS) { |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
107 |
if (klass != NULL) { |
33160 | 108 |
JavaValue result(T_OBJECT); |
109 |
JavaCallArguments args; |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
110 |
args.push_oop(Handle(THREAD, klass->java_mirror())); |
33160 | 111 |
JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL); |
112 |
||
113 |
return (oop)result.get_jobject(); |
|
114 |
} |
|
115 |
return NULL; |
|
116 |
} |
|
117 |
||
44092 | 118 |
|
35899 | 119 |
int CompilerToVM::Data::Klass_vtable_start_offset; |
120 |
int CompilerToVM::Data::Klass_vtable_length_offset; |
|
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
121 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
122 |
int CompilerToVM::Data::Method_extra_stack_entries; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
123 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
124 |
address CompilerToVM::Data::SharedRuntime_ic_miss_stub; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
125 |
address CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
126 |
address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
127 |
address CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
128 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
129 |
size_t CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
130 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
131 |
CollectedHeap* CompilerToVM::Data::Universe_collectedHeap; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
132 |
int CompilerToVM::Data::Universe_base_vtable_size; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
133 |
address CompilerToVM::Data::Universe_narrow_oop_base; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
134 |
int CompilerToVM::Data::Universe_narrow_oop_shift; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
135 |
address CompilerToVM::Data::Universe_narrow_klass_base; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
136 |
int CompilerToVM::Data::Universe_narrow_klass_shift; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
137 |
void* CompilerToVM::Data::Universe_non_oop_bits; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
138 |
uintptr_t CompilerToVM::Data::Universe_verify_oop_mask; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
139 |
uintptr_t CompilerToVM::Data::Universe_verify_oop_bits; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
140 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
141 |
bool CompilerToVM::Data::_supports_inline_contig_alloc; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
142 |
HeapWord** CompilerToVM::Data::_heap_end_addr; |
41283
2615c024f3eb
8033552: Fix missing missing volatile specifiers in CAS operations in GC code
eosterlund
parents:
41051
diff
changeset
|
143 |
HeapWord* volatile* CompilerToVM::Data::_heap_top_addr; |
39441
7464b1552bf7
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents:
39423
diff
changeset
|
144 |
int CompilerToVM::Data::_max_oop_map_stack_offset; |
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
145 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
146 |
jbyte* CompilerToVM::Data::cardtable_start_address; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
147 |
int CompilerToVM::Data::cardtable_shift; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
148 |
|
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
|
149 |
int CompilerToVM::Data::vm_page_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
|
150 |
|
43939 | 151 |
int CompilerToVM::Data::sizeof_vtableEntry = sizeof(vtableEntry); |
152 |
int CompilerToVM::Data::sizeof_ExceptionTableElement = sizeof(ExceptionTableElement); |
|
153 |
int CompilerToVM::Data::sizeof_LocalVariableTableElement = sizeof(LocalVariableTableElement); |
|
154 |
int CompilerToVM::Data::sizeof_ConstantPool = sizeof(ConstantPool); |
|
155 |
int CompilerToVM::Data::sizeof_SymbolPointer = sizeof(Symbol*); |
|
156 |
int CompilerToVM::Data::sizeof_narrowKlass = sizeof(narrowKlass); |
|
157 |
int CompilerToVM::Data::sizeof_arrayOopDesc = sizeof(arrayOopDesc); |
|
158 |
int CompilerToVM::Data::sizeof_BasicLock = sizeof(BasicLock); |
|
159 |
||
38283
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
160 |
address CompilerToVM::Data::dsin; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
161 |
address CompilerToVM::Data::dcos; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
162 |
address CompilerToVM::Data::dtan; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
163 |
address CompilerToVM::Data::dexp; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
164 |
address CompilerToVM::Data::dlog; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
165 |
address CompilerToVM::Data::dlog10; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
166 |
address CompilerToVM::Data::dpow; |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
167 |
|
43939 | 168 |
address CompilerToVM::Data::symbol_init; |
169 |
address CompilerToVM::Data::symbol_clinit; |
|
170 |
||
171 |
void CompilerToVM::Data::initialize(TRAPS) { |
|
35899 | 172 |
Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset()); |
173 |
Klass_vtable_length_offset = in_bytes(Klass::vtable_length_offset()); |
|
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
174 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
175 |
Method_extra_stack_entries = Method::extra_stack_entries(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
176 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
177 |
SharedRuntime_ic_miss_stub = SharedRuntime::get_ic_miss_stub(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
178 |
SharedRuntime_handle_wrong_method_stub = SharedRuntime::get_handle_wrong_method_stub(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
179 |
SharedRuntime_deopt_blob_unpack = SharedRuntime::deopt_blob()->unpack(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
180 |
SharedRuntime_deopt_blob_uncommon_trap = SharedRuntime::deopt_blob()->uncommon_trap(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
181 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
182 |
ThreadLocalAllocBuffer_alignment_reserve = ThreadLocalAllocBuffer::alignment_reserve(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
183 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
184 |
Universe_collectedHeap = Universe::heap(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
185 |
Universe_base_vtable_size = Universe::base_vtable_size(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
186 |
Universe_narrow_oop_base = Universe::narrow_oop_base(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
187 |
Universe_narrow_oop_shift = Universe::narrow_oop_shift(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
188 |
Universe_narrow_klass_base = Universe::narrow_klass_base(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
189 |
Universe_narrow_klass_shift = Universe::narrow_klass_shift(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
190 |
Universe_non_oop_bits = Universe::non_oop_word(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
191 |
Universe_verify_oop_mask = Universe::verify_oop_mask(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
192 |
Universe_verify_oop_bits = Universe::verify_oop_bits(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
193 |
|
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
194 |
_supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc(); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
195 |
_heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1; |
41283
2615c024f3eb
8033552: Fix missing missing volatile specifiers in CAS operations in GC code
eosterlund
parents:
41051
diff
changeset
|
196 |
_heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord* volatile*) -1; |
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
197 |
|
39441
7464b1552bf7
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents:
39423
diff
changeset
|
198 |
_max_oop_map_stack_offset = (OopMapValue::register_mask - VMRegImpl::stack2reg(0)->value()) * VMRegImpl::stack_slot_size; |
7464b1552bf7
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents:
39423
diff
changeset
|
199 |
int max_oop_map_stack_index = _max_oop_map_stack_offset / VMRegImpl::stack_slot_size; |
7464b1552bf7
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents:
39423
diff
changeset
|
200 |
assert(OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index)), "should be valid"); |
7464b1552bf7
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents:
39423
diff
changeset
|
201 |
assert(!OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index + 1)), "should be invalid"); |
7464b1552bf7
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
never
parents:
39423
diff
changeset
|
202 |
|
43939 | 203 |
symbol_init = (address) vmSymbols::object_initializer_name(); |
204 |
symbol_clinit = (address) vmSymbols::class_initializer_name(); |
|
205 |
||
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
206 |
BarrierSet* bs = Universe::heap()->barrier_set(); |
46664
a1191772ea9d
8184269: JVMCI CompilerToVM::Data::initialize() should use BarrierSet fake RTTI to identify card table barrier sets
eosterlund
parents:
46633
diff
changeset
|
207 |
if (bs->is_a(BarrierSet::CardTableModRef)) { |
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
208 |
jbyte* base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
209 |
assert(base != 0, "unexpected byte_map_base"); |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
210 |
cardtable_start_address = base; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
211 |
cardtable_shift = CardTableModRefBS::card_shift; |
46664
a1191772ea9d
8184269: JVMCI CompilerToVM::Data::initialize() should use BarrierSet fake RTTI to identify card table barrier sets
eosterlund
parents:
46633
diff
changeset
|
212 |
} else { |
a1191772ea9d
8184269: JVMCI CompilerToVM::Data::initialize() should use BarrierSet fake RTTI to identify card table barrier sets
eosterlund
parents:
46633
diff
changeset
|
213 |
// No card mark barriers |
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
214 |
cardtable_start_address = 0; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
215 |
cardtable_shift = 0; |
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
216 |
} |
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
|
217 |
|
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
|
218 |
vm_page_size = os::vm_page_size(); |
38283
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
219 |
|
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
220 |
#define SET_TRIGFUNC(name) \ |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
221 |
if (StubRoutines::name() != NULL) { \ |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
222 |
name = StubRoutines::name(); \ |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
223 |
} else { \ |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
224 |
name = CAST_FROM_FN_PTR(address, SharedRuntime::name); \ |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
225 |
} |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
226 |
|
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
227 |
SET_TRIGFUNC(dsin); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
228 |
SET_TRIGFUNC(dcos); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
229 |
SET_TRIGFUNC(dtan); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
230 |
SET_TRIGFUNC(dexp); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
231 |
SET_TRIGFUNC(dlog10); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
232 |
SET_TRIGFUNC(dlog); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
233 |
SET_TRIGFUNC(dpow); |
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
234 |
|
4fb93f7c26fe
8156178: [JVMCI] expose StubRoutines trig functions
never
parents:
38139
diff
changeset
|
235 |
#undef SET_TRIGFUNC |
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
236 |
} |
33160 | 237 |
|
40878
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
238 |
objArrayHandle CompilerToVM::initialize_intrinsics(TRAPS) { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
239 |
objArrayHandle vmIntrinsics = oopFactory::new_objArray_handle(VMIntrinsicMethod::klass(), (vmIntrinsics::ID_LIMIT - 1), CHECK_(objArrayHandle())); |
40878
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
240 |
int index = 0; |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
241 |
// The intrinsics for a class are usually adjacent to each other. |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
242 |
// When they are, the string for the class name can be reused. |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
243 |
vmSymbols::SID kls_sid = vmSymbols::NO_SID; |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
244 |
Handle kls_str; |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
245 |
#define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n) |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
246 |
#define VM_SYMBOL_TO_STRING(s) \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
247 |
java_lang_String::create_from_symbol(vmSymbols::symbol_at(SID_ENUM(s)), CHECK_(objArrayHandle())) |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
248 |
#define VM_INTRINSIC_INFO(id, kls, name, sig, ignore_fcode) { \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
249 |
instanceHandle vmIntrinsicMethod = InstanceKlass::cast(VMIntrinsicMethod::klass())->allocate_instance_handle(CHECK_(objArrayHandle())); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
250 |
if (kls_sid != SID_ENUM(kls)) { \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
251 |
kls_str = VM_SYMBOL_TO_STRING(kls); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
252 |
kls_sid = SID_ENUM(kls); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
253 |
} \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
254 |
Handle name_str = VM_SYMBOL_TO_STRING(name); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
255 |
Handle sig_str = VM_SYMBOL_TO_STRING(sig); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
256 |
VMIntrinsicMethod::set_declaringClass(vmIntrinsicMethod, kls_str()); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
257 |
VMIntrinsicMethod::set_name(vmIntrinsicMethod, name_str()); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
258 |
VMIntrinsicMethod::set_descriptor(vmIntrinsicMethod, sig_str()); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
259 |
VMIntrinsicMethod::set_id(vmIntrinsicMethod, vmIntrinsics::id); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
260 |
vmIntrinsics->obj_at_put(index++, vmIntrinsicMethod()); \ |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
261 |
} |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
262 |
|
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
263 |
VM_INTRINSICS_DO(VM_INTRINSIC_INFO, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
264 |
#undef SID_ENUM |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
265 |
#undef VM_SYMBOL_TO_STRING |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
266 |
#undef VM_INTRINSIC_INFO |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
267 |
assert(index == vmIntrinsics::ID_LIMIT - 1, "must be"); |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
268 |
|
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
269 |
return vmIntrinsics; |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
270 |
} |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
271 |
|
43939 | 272 |
/** |
273 |
* The set of VM flags known to be used. |
|
274 |
*/ |
|
275 |
#define PREDEFINED_CONFIG_FLAGS(do_bool_flag, do_intx_flag, do_uintx_flag) \ |
|
276 |
do_intx_flag(AllocateInstancePrefetchLines) \ |
|
277 |
do_intx_flag(AllocatePrefetchDistance) \ |
|
278 |
do_intx_flag(AllocatePrefetchInstr) \ |
|
279 |
do_intx_flag(AllocatePrefetchLines) \ |
|
280 |
do_intx_flag(AllocatePrefetchStepSize) \ |
|
281 |
do_intx_flag(AllocatePrefetchStyle) \ |
|
282 |
do_intx_flag(BciProfileWidth) \ |
|
283 |
do_bool_flag(BootstrapJVMCI) \ |
|
284 |
do_bool_flag(CITime) \ |
|
285 |
do_bool_flag(CITimeEach) \ |
|
286 |
do_uintx_flag(CodeCacheSegmentSize) \ |
|
287 |
do_intx_flag(CodeEntryAlignment) \ |
|
288 |
do_bool_flag(CompactFields) \ |
|
289 |
NOT_PRODUCT(do_intx_flag(CompileTheWorldStartAt)) \ |
|
290 |
NOT_PRODUCT(do_intx_flag(CompileTheWorldStopAt)) \ |
|
291 |
do_intx_flag(ContendedPaddingWidth) \ |
|
292 |
do_bool_flag(DontCompileHugeMethods) \ |
|
293 |
do_bool_flag(EnableContended) \ |
|
294 |
do_intx_flag(FieldsAllocationStyle) \ |
|
295 |
do_bool_flag(FoldStableValues) \ |
|
296 |
do_bool_flag(ForceUnreachable) \ |
|
297 |
do_intx_flag(HugeMethodLimit) \ |
|
298 |
do_bool_flag(Inline) \ |
|
299 |
do_intx_flag(JVMCICounterSize) \ |
|
300 |
do_bool_flag(JVMCIPrintProperties) \ |
|
301 |
do_bool_flag(JVMCIUseFastLocking) \ |
|
302 |
do_intx_flag(MethodProfileWidth) \ |
|
303 |
do_intx_flag(ObjectAlignmentInBytes) \ |
|
304 |
do_bool_flag(PrintInlining) \ |
|
305 |
do_bool_flag(ReduceInitialCardMarks) \ |
|
306 |
do_bool_flag(RestrictContended) \ |
|
307 |
do_intx_flag(StackReservedPages) \ |
|
308 |
do_intx_flag(StackShadowPages) \ |
|
309 |
do_bool_flag(TLABStats) \ |
|
310 |
do_uintx_flag(TLABWasteIncrement) \ |
|
311 |
do_intx_flag(TypeProfileWidth) \ |
|
312 |
do_bool_flag(UseAESIntrinsics) \ |
|
313 |
X86_ONLY(do_intx_flag(UseAVX)) \ |
|
314 |
do_bool_flag(UseBiasedLocking) \ |
|
315 |
do_bool_flag(UseCRC32Intrinsics) \ |
|
316 |
do_bool_flag(UseCompressedClassPointers) \ |
|
317 |
do_bool_flag(UseCompressedOops) \ |
|
318 |
do_bool_flag(UseConcMarkSweepGC) \ |
|
319 |
X86_ONLY(do_bool_flag(UseCountLeadingZerosInstruction)) \ |
|
320 |
X86_ONLY(do_bool_flag(UseCountTrailingZerosInstruction)) \ |
|
321 |
do_bool_flag(UseG1GC) \ |
|
322 |
COMPILER2_PRESENT(do_bool_flag(UseMontgomeryMultiplyIntrinsic)) \ |
|
323 |
COMPILER2_PRESENT(do_bool_flag(UseMontgomerySquareIntrinsic)) \ |
|
324 |
COMPILER2_PRESENT(do_bool_flag(UseMulAddIntrinsic)) \ |
|
325 |
COMPILER2_PRESENT(do_bool_flag(UseMultiplyToLenIntrinsic)) \ |
|
326 |
do_bool_flag(UsePopCountInstruction) \ |
|
327 |
do_bool_flag(UseSHA1Intrinsics) \ |
|
328 |
do_bool_flag(UseSHA256Intrinsics) \ |
|
329 |
do_bool_flag(UseSHA512Intrinsics) \ |
|
330 |
do_intx_flag(UseSSE) \ |
|
331 |
COMPILER2_PRESENT(do_bool_flag(UseSquareToLenIntrinsic)) \ |
|
332 |
do_bool_flag(UseStackBanging) \ |
|
333 |
do_bool_flag(UseTLAB) \ |
|
334 |
do_bool_flag(VerifyOops) \ |
|
335 |
||
336 |
#define BOXED_BOOLEAN(name, value) oop name = ((jboolean)(value) ? boxedTrue() : boxedFalse()) |
|
337 |
#define BOXED_DOUBLE(name, value) oop name; do { jvalue p; p.d = (jdouble) (value); name = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL);} while(0) |
|
338 |
#define BOXED_LONG(name, value) \ |
|
339 |
oop name; \ |
|
340 |
do { \ |
|
341 |
jvalue p; p.j = (jlong) (value); \ |
|
342 |
Handle* e = longs.get(p.j); \ |
|
343 |
if (e == NULL) { \ |
|
46327 | 344 |
oop o = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL); \ |
345 |
Handle h(THREAD, o); \ |
|
43939 | 346 |
longs.put(p.j, h); \ |
347 |
name = h(); \ |
|
348 |
} else { \ |
|
349 |
name = (*e)(); \ |
|
350 |
} \ |
|
351 |
} while (0) |
|
352 |
||
353 |
#define CSTRING_TO_JSTRING(name, value) \ |
|
354 |
Handle name; \ |
|
355 |
do { \ |
|
356 |
if (value != NULL) { \ |
|
357 |
Handle* e = strings.get(value); \ |
|
358 |
if (e == NULL) { \ |
|
359 |
Handle h = java_lang_String::create_from_str(value, CHECK_NULL); \ |
|
360 |
strings.put(value, h); \ |
|
46327 | 361 |
name = h; \ |
43939 | 362 |
} else { \ |
46327 | 363 |
name = (*e); \ |
43939 | 364 |
} \ |
365 |
} \ |
|
366 |
} while (0) |
|
367 |
||
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
368 |
C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env)) |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
369 |
ResourceMark rm; |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
370 |
HandleMark hm; |
35123
b0b89d83bcf5
8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents:
35092
diff
changeset
|
371 |
|
43939 | 372 |
// Used to canonicalize Long and String values. |
373 |
ResourceHashtable<jlong, Handle> longs; |
|
374 |
ResourceHashtable<const char*, Handle, &CompilerToVM::cstring_hash, &CompilerToVM::cstring_equals> strings; |
|
375 |
||
376 |
jvalue prim; |
|
46327 | 377 |
prim.z = true; oop boxedTrueOop = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL); |
378 |
Handle boxedTrue(THREAD, boxedTrueOop); |
|
379 |
prim.z = false; oop boxedFalseOop = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL); |
|
380 |
Handle boxedFalse(THREAD, boxedFalseOop); |
|
43939 | 381 |
|
382 |
CompilerToVM::Data::initialize(CHECK_NULL); |
|
33160 | 383 |
|
40878
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
384 |
VMField::klass()->initialize(CHECK_NULL); |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
385 |
VMFlag::klass()->initialize(CHECK_NULL); |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
386 |
VMIntrinsicMethod::klass()->initialize(CHECK_NULL); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
387 |
|
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
388 |
int len = JVMCIVMStructs::localHotSpotVMStructs_count(); |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
389 |
objArrayHandle vmFields = oopFactory::new_objArray_handle(VMField::klass(), len, CHECK_NULL); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
390 |
for (int i = 0; i < len ; i++) { |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
391 |
VMStructEntry vmField = JVMCIVMStructs::localHotSpotVMStructs[i]; |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
392 |
instanceHandle vmFieldObj = InstanceKlass::cast(VMField::klass())->allocate_instance_handle(CHECK_NULL); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
393 |
size_t name_buf_len = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 /* "::" */; |
40878
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
394 |
char* name_buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, name_buf_len + 1); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
395 |
sprintf(name_buf, "%s::%s", vmField.typeName, vmField.fieldName); |
43939 | 396 |
CSTRING_TO_JSTRING(name, name_buf); |
397 |
CSTRING_TO_JSTRING(type, vmField.typeString); |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
398 |
VMField::set_name(vmFieldObj, name()); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
399 |
VMField::set_type(vmFieldObj, type()); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
400 |
VMField::set_offset(vmFieldObj, vmField.offset); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
401 |
VMField::set_address(vmFieldObj, (jlong) vmField.address); |
43939 | 402 |
if (vmField.isStatic && vmField.typeString != NULL) { |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
403 |
if (strcmp(vmField.typeString, "bool") == 0) { |
43939 | 404 |
BOXED_BOOLEAN(box, *(jbyte*) vmField.address); |
405 |
VMField::set_value(vmFieldObj, box); |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
406 |
} else if (strcmp(vmField.typeString, "int") == 0 || |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
407 |
strcmp(vmField.typeString, "jint") == 0) { |
43939 | 408 |
BOXED_LONG(box, *(jint*) vmField.address); |
409 |
VMField::set_value(vmFieldObj, box); |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
410 |
} else if (strcmp(vmField.typeString, "uint64_t") == 0) { |
43939 | 411 |
BOXED_LONG(box, *(uint64_t*) vmField.address); |
412 |
VMField::set_value(vmFieldObj, box); |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
413 |
} else if (strcmp(vmField.typeString, "address") == 0 || |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
414 |
strcmp(vmField.typeString, "intptr_t") == 0 || |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
415 |
strcmp(vmField.typeString, "uintptr_t") == 0 || |
47580 | 416 |
strcmp(vmField.typeString, "OopHandle") == 0 || |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
417 |
strcmp(vmField.typeString, "size_t") == 0 || |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
418 |
// All foo* types are addresses. |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
419 |
vmField.typeString[strlen(vmField.typeString) - 1] == '*') { |
43939 | 420 |
BOXED_LONG(box, *((address*) vmField.address)); |
421 |
VMField::set_value(vmFieldObj, box); |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
422 |
} else { |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
423 |
JVMCI_ERROR_NULL("VM field %s has unsupported type %s", name_buf, vmField.typeString); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
424 |
} |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
425 |
} |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
426 |
vmFields->obj_at_put(i, vmFieldObj()); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
427 |
} |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
428 |
|
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
429 |
int ints_len = JVMCIVMStructs::localHotSpotVMIntConstants_count(); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
430 |
int longs_len = JVMCIVMStructs::localHotSpotVMLongConstants_count(); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
431 |
len = ints_len + longs_len; |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
432 |
objArrayHandle vmConstants = oopFactory::new_objArray_handle(SystemDictionary::Object_klass(), len * 2, CHECK_NULL); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
433 |
int insert = 0; |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
434 |
for (int i = 0; i < ints_len ; i++) { |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
435 |
VMIntConstantEntry c = JVMCIVMStructs::localHotSpotVMIntConstants[i]; |
43939 | 436 |
CSTRING_TO_JSTRING(name, c.name); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
437 |
BOXED_LONG(value, c.value); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
438 |
vmConstants->obj_at_put(insert++, name()); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
439 |
vmConstants->obj_at_put(insert++, value); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
440 |
} |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
441 |
for (int i = 0; i < longs_len ; i++) { |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
442 |
VMLongConstantEntry c = JVMCIVMStructs::localHotSpotVMLongConstants[i]; |
43939 | 443 |
CSTRING_TO_JSTRING(name, c.name); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
444 |
BOXED_LONG(value, c.value); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
445 |
vmConstants->obj_at_put(insert++, name()); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
446 |
vmConstants->obj_at_put(insert++, value); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
447 |
} |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
448 |
assert(insert == len * 2, "must be"); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
449 |
|
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
450 |
len = JVMCIVMStructs::localHotSpotVMAddresses_count(); |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
451 |
objArrayHandle vmAddresses = oopFactory::new_objArray_handle(SystemDictionary::Object_klass(), len * 2, CHECK_NULL); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
452 |
for (int i = 0; i < len ; i++) { |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
453 |
VMAddressEntry a = JVMCIVMStructs::localHotSpotVMAddresses[i]; |
43939 | 454 |
CSTRING_TO_JSTRING(name, a.name); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
455 |
BOXED_LONG(value, a.value); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
456 |
vmAddresses->obj_at_put(i * 2, name()); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
457 |
vmAddresses->obj_at_put(i * 2 + 1, value); |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
458 |
} |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
459 |
|
43939 | 460 |
#define COUNT_FLAG(ignore) +1 |
461 |
#ifdef ASSERT |
|
462 |
#define CHECK_FLAG(type, name) { \ |
|
463 |
Flag* flag = Flag::find_flag(#name, strlen(#name), /*allow_locked*/ true, /* return_flag */ true); \ |
|
464 |
assert(flag != NULL, "No such flag named " #name); \ |
|
465 |
assert(flag->is_##type(), "Flag " #name " is not of type " #type); \ |
|
466 |
} |
|
467 |
#else |
|
468 |
#define CHECK_FLAG(type, name) |
|
469 |
#endif |
|
470 |
||
471 |
#define ADD_FLAG(type, name, convert) { \ |
|
472 |
CHECK_FLAG(type, name) \ |
|
473 |
instanceHandle vmFlagObj = InstanceKlass::cast(VMFlag::klass())->allocate_instance_handle(CHECK_NULL); \ |
|
474 |
CSTRING_TO_JSTRING(fname, #name); \ |
|
475 |
CSTRING_TO_JSTRING(ftype, #type); \ |
|
476 |
VMFlag::set_name(vmFlagObj, fname()); \ |
|
477 |
VMFlag::set_type(vmFlagObj, ftype()); \ |
|
478 |
convert(value, name); \ |
|
479 |
VMFlag::set_value(vmFlagObj, value); \ |
|
480 |
vmFlags->obj_at_put(i++, vmFlagObj()); \ |
|
481 |
} |
|
482 |
#define ADD_BOOL_FLAG(name) ADD_FLAG(bool, name, BOXED_BOOLEAN) |
|
483 |
#define ADD_INTX_FLAG(name) ADD_FLAG(intx, name, BOXED_LONG) |
|
484 |
#define ADD_UINTX_FLAG(name) ADD_FLAG(uintx, name, BOXED_LONG) |
|
485 |
||
486 |
len = 0 + PREDEFINED_CONFIG_FLAGS(COUNT_FLAG, COUNT_FLAG, COUNT_FLAG); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
487 |
objArrayHandle vmFlags = oopFactory::new_objArray_handle(VMFlag::klass(), len, CHECK_NULL); |
43939 | 488 |
int i = 0; |
489 |
PREDEFINED_CONFIG_FLAGS(ADD_BOOL_FLAG, ADD_INTX_FLAG, ADD_UINTX_FLAG) |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
490 |
|
40878
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
491 |
objArrayHandle vmIntrinsics = CompilerToVM::initialize_intrinsics(CHECK_NULL); |
5d87104b10d5
8164358: [JVMCI] expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI
dnsimon
parents:
40872
diff
changeset
|
492 |
|
43939 | 493 |
objArrayOop data = oopFactory::new_objArray(SystemDictionary::Object_klass(), 5, CHECK_NULL); |
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
494 |
data->obj_at_put(0, vmFields()); |
43939 | 495 |
data->obj_at_put(1, vmConstants()); |
496 |
data->obj_at_put(2, vmAddresses()); |
|
497 |
data->obj_at_put(3, vmFlags()); |
|
498 |
data->obj_at_put(4, vmIntrinsics()); |
|
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
499 |
|
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
500 |
return (jobjectArray) JNIHandles::make_local(THREAD, data); |
43939 | 501 |
#undef COUNT_FLAG |
502 |
#undef ADD_FLAG |
|
503 |
#undef ADD_BOOL_FLAG |
|
504 |
#undef ADD_INTX_FLAG |
|
505 |
#undef ADD_UINTX_FLAG |
|
506 |
#undef CHECK_FLAG |
|
507 |
C2V_END |
|
508 |
||
509 |
C2V_VMENTRY(jobject, getFlagValue, (JNIEnv *, jobject c2vm, jobject name_handle)) |
|
510 |
#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); |
|
511 |
#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 | 512 |
Handle name(THREAD, JNIHandles::resolve(name_handle)); |
43939 | 513 |
if (name.is_null()) { |
514 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
515 |
} |
|
516 |
ResourceMark rm; |
|
517 |
const char* cstring = java_lang_String::as_utf8_string(name()); |
|
518 |
Flag* flag = Flag::find_flag(cstring, strlen(cstring), /* allow_locked */ true, /* return_flag */ true); |
|
519 |
if (flag == NULL) { |
|
520 |
return c2vm; |
|
521 |
} |
|
522 |
if (flag->is_bool()) { |
|
523 |
jvalue prim; |
|
524 |
prim.z = flag->get_bool(); |
|
525 |
oop box = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL); |
|
526 |
return JNIHandles::make_local(THREAD, box); |
|
527 |
} else if (flag->is_ccstr()) { |
|
528 |
Handle value = java_lang_String::create_from_str(flag->get_ccstr(), CHECK_NULL); |
|
529 |
return JNIHandles::make_local(THREAD, value()); |
|
530 |
} else if (flag->is_intx()) { |
|
531 |
RETURN_BOXED_LONG(flag->get_intx()); |
|
532 |
} else if (flag->is_int()) { |
|
533 |
RETURN_BOXED_LONG(flag->get_int()); |
|
534 |
} else if (flag->is_uint()) { |
|
535 |
RETURN_BOXED_LONG(flag->get_uint()); |
|
536 |
} else if (flag->is_uint64_t()) { |
|
537 |
RETURN_BOXED_LONG(flag->get_uint64_t()); |
|
538 |
} else if (flag->is_size_t()) { |
|
539 |
RETURN_BOXED_LONG(flag->get_size_t()); |
|
540 |
} else if (flag->is_uintx()) { |
|
541 |
RETURN_BOXED_LONG(flag->get_uintx()); |
|
542 |
} else if (flag->is_double()) { |
|
543 |
RETURN_BOXED_DOUBLE(flag->get_double()); |
|
544 |
} else { |
|
545 |
JVMCI_ERROR_NULL("VM flag %s has unsupported type %s", flag->_name, flag->_type); |
|
546 |
} |
|
547 |
C2V_END |
|
548 |
||
39423
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
549 |
#undef BOXED_LONG |
0f8dc3693499
8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents:
39421
diff
changeset
|
550 |
#undef BOXED_DOUBLE |
43939 | 551 |
#undef CSTRING_TO_JSTRING |
33160 | 552 |
|
553 |
C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jobject jvmci_method)) |
|
554 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
555 |
ResourceMark rm; |
|
556 |
||
557 |
int code_size = method->code_size(); |
|
558 |
typeArrayOop reconstituted_code = oopFactory::new_byteArray(code_size, CHECK_NULL); |
|
559 |
||
560 |
guarantee(method->method_holder()->is_rewritten(), "Method's holder should be rewritten"); |
|
561 |
// iterate over all bytecodes and replace non-Java bytecodes |
|
562 |
||
563 |
for (BytecodeStream s(method); s.next() != Bytecodes::_illegal; ) { |
|
564 |
Bytecodes::Code code = s.code(); |
|
565 |
Bytecodes::Code raw_code = s.raw_code(); |
|
566 |
int bci = s.bci(); |
|
567 |
int len = s.instruction_size(); |
|
568 |
||
569 |
// Restore original byte code. |
|
570 |
reconstituted_code->byte_at_put(bci, (jbyte) (s.is_wide()? Bytecodes::_wide : code)); |
|
571 |
if (len > 1) { |
|
572 |
memcpy(reconstituted_code->byte_at_addr(bci + 1), s.bcp()+1, len-1); |
|
573 |
} |
|
574 |
||
575 |
if (len > 1) { |
|
576 |
// Restore the big-endian constant pool indexes. |
|
577 |
// Cf. Rewriter::scan_method |
|
578 |
switch (code) { |
|
579 |
case Bytecodes::_getstatic: |
|
580 |
case Bytecodes::_putstatic: |
|
581 |
case Bytecodes::_getfield: |
|
582 |
case Bytecodes::_putfield: |
|
583 |
case Bytecodes::_invokevirtual: |
|
584 |
case Bytecodes::_invokespecial: |
|
585 |
case Bytecodes::_invokestatic: |
|
586 |
case Bytecodes::_invokeinterface: |
|
587 |
case Bytecodes::_invokehandle: { |
|
588 |
int cp_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
589 |
Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index); |
|
590 |
break; |
|
591 |
} |
|
592 |
||
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
593 |
case Bytecodes::_invokedynamic: { |
33160 | 594 |
int cp_index = Bytes::get_native_u4((address) reconstituted_code->byte_at_addr(bci + 1)); |
595 |
Bytes::put_Java_u4((address) reconstituted_code->byte_at_addr(bci + 1), (u4) cp_index); |
|
596 |
break; |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
597 |
} |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
598 |
|
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
599 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
600 |
break; |
33160 | 601 |
} |
602 |
||
603 |
// Not all ldc byte code are rewritten. |
|
604 |
switch (raw_code) { |
|
605 |
case Bytecodes::_fast_aldc: { |
|
606 |
int cpc_index = reconstituted_code->byte_at(bci + 1) & 0xff; |
|
607 |
int cp_index = method->constants()->object_to_cp_index(cpc_index); |
|
608 |
assert(cp_index < method->constants()->length(), "sanity check"); |
|
609 |
reconstituted_code->byte_at_put(bci + 1, (jbyte) cp_index); |
|
610 |
break; |
|
611 |
} |
|
612 |
||
613 |
case Bytecodes::_fast_aldc_w: { |
|
614 |
int cpc_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1)); |
|
615 |
int cp_index = method->constants()->object_to_cp_index(cpc_index); |
|
616 |
assert(cp_index < method->constants()->length(), "sanity check"); |
|
617 |
Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index); |
|
618 |
break; |
|
619 |
} |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
620 |
|
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
621 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
622 |
break; |
33160 | 623 |
} |
624 |
} |
|
625 |
} |
|
626 |
||
627 |
return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code); |
|
628 |
C2V_END |
|
629 |
||
630 |
C2V_VMENTRY(jint, getExceptionTableLength, (JNIEnv *, jobject, jobject jvmci_method)) |
|
631 |
ResourceMark rm; |
|
632 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
633 |
return method->exception_table_length(); |
|
634 |
C2V_END |
|
635 |
||
636 |
C2V_VMENTRY(jlong, getExceptionTableStart, (JNIEnv *, jobject, jobject jvmci_method)) |
|
637 |
ResourceMark rm; |
|
638 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
639 |
if (method->exception_table_length() == 0) { |
|
640 |
return 0L; |
|
641 |
} |
|
642 |
return (jlong) (address) method->exception_table_start(); |
|
643 |
C2V_END |
|
644 |
||
41325 | 645 |
C2V_VMENTRY(jobject, asResolvedJavaMethod, (JNIEnv *, jobject, jobject executable_handle)) |
646 |
oop executable = JNIHandles::resolve(executable_handle); |
|
647 |
oop mirror = NULL; |
|
648 |
int slot = 0; |
|
649 |
||
650 |
if (executable->klass() == SystemDictionary::reflect_Constructor_klass()) { |
|
651 |
mirror = java_lang_reflect_Constructor::clazz(executable); |
|
652 |
slot = java_lang_reflect_Constructor::slot(executable); |
|
653 |
} else { |
|
654 |
assert(executable->klass() == SystemDictionary::reflect_Method_klass(), "wrong type"); |
|
655 |
mirror = java_lang_reflect_Method::clazz(executable); |
|
656 |
slot = java_lang_reflect_Method::slot(executable); |
|
657 |
} |
|
658 |
Klass* holder = java_lang_Class::as_Klass(mirror); |
|
33160 | 659 |
methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot); |
660 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
661 |
return JNIHandles::make_local(THREAD, result); |
|
662 |
} |
|
663 |
||
664 |
C2V_VMENTRY(jobject, getResolvedJavaMethod, (JNIEnv *, jobject, jobject base, jlong offset)) |
|
665 |
methodHandle method; |
|
666 |
oop base_object = JNIHandles::resolve(base); |
|
667 |
if (base_object == NULL) { |
|
668 |
method = *((Method**)(offset)); |
|
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46481
diff
changeset
|
669 |
} else if (base_object->is_a(SystemDictionary::ResolvedMethodName_klass())) { |
33160 | 670 |
method = (Method*) (intptr_t) base_object->long_field(offset); |
671 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
672 |
method = *((Method**)(HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object) + offset)); |
|
673 |
} else { |
|
674 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
675 |
err_msg("Unexpected type: %s", base_object->klass()->external_name())); |
|
676 |
} |
|
677 |
assert (method.is_null() || method->is_method(), "invalid read"); |
|
678 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
679 |
return JNIHandles::make_local(THREAD, result); |
|
680 |
} |
|
681 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
682 |
C2V_VMENTRY(jobject, getConstantPool, (JNIEnv *, jobject, jobject object_handle)) |
33160 | 683 |
constantPoolHandle cp; |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
684 |
oop object = JNIHandles::resolve(object_handle); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
685 |
if (object == NULL) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
686 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
33160 | 687 |
} |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
688 |
if (object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
689 |
cp = CompilerToVM::asMethod(object)->constMethod()->constants(); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
690 |
} else if (object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
691 |
cp = InstanceKlass::cast(CompilerToVM::asKlass(object))->constants(); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
692 |
} else { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
693 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
694 |
err_msg("Unexpected type: %s", object->klass()->external_name())); |
33160 | 695 |
} |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
696 |
assert(!cp.is_null(), "npe"); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
697 |
JavaValue method_result(T_OBJECT); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
698 |
JavaCallArguments args; |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
699 |
args.push_long((jlong) (address) cp()); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
39441
diff
changeset
|
700 |
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
|
701 |
return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject()); |
33160 | 702 |
} |
703 |
||
704 |
C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed)) |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
705 |
Klass* klass = NULL; |
33160 | 706 |
oop base_object = JNIHandles::resolve(base); |
707 |
jlong base_address = 0; |
|
708 |
if (base_object != NULL && offset == oopDesc::klass_offset_in_bytes()) { |
|
709 |
klass = base_object->klass(); |
|
710 |
} else if (!compressed) { |
|
711 |
if (base_object != NULL) { |
|
712 |
if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
|
713 |
base_address = HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object); |
|
714 |
} else if (base_object->is_a(SystemDictionary::HotSpotConstantPool_klass())) { |
|
715 |
base_address = HotSpotConstantPool::metaspaceConstantPool(base_object); |
|
716 |
} else if (base_object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
|
717 |
base_address = (jlong) CompilerToVM::asKlass(base_object); |
|
718 |
} else if (base_object->is_a(SystemDictionary::Class_klass())) { |
|
719 |
base_address = (jlong) (address) base_object; |
|
720 |
} else { |
|
721 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
722 |
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); |
|
723 |
} |
|
724 |
} |
|
725 |
klass = *((Klass**) (intptr_t) (base_address + offset)); |
|
726 |
} else { |
|
727 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
|
728 |
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false")); |
|
729 |
} |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
730 |
assert (klass == NULL || klass->is_klass(), "invalid read"); |
33160 | 731 |
oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); |
732 |
return JNIHandles::make_local(THREAD, result); |
|
733 |
} |
|
734 |
||
735 |
C2V_VMENTRY(jobject, findUniqueConcreteMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) |
|
736 |
ResourceMark rm; |
|
737 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
738 |
Klass* holder = CompilerToVM::asKlass(jvmci_type); |
33160 | 739 |
if (holder->is_interface()) { |
740 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", holder->external_name())); |
|
741 |
} |
|
742 |
||
743 |
methodHandle ucm; |
|
744 |
{ |
|
745 |
MutexLocker locker(Compile_lock); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
746 |
ucm = Dependencies::find_unique_concrete_method(holder, method()); |
33160 | 747 |
} |
748 |
oop result = CompilerToVM::get_jvmci_method(ucm, CHECK_NULL); |
|
749 |
return JNIHandles::make_local(THREAD, result); |
|
750 |
C2V_END |
|
751 |
||
752 |
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
|
753 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
754 |
if (!klass->is_interface()) { |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
755 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
756 |
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
|
757 |
} |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
758 |
InstanceKlass* iklass = InstanceKlass::cast(klass); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
759 |
oop implementor = CompilerToVM::get_jvmci_type(iklass->implementor(), CHECK_NULL); |
33160 | 760 |
return JNIHandles::make_local(THREAD, implementor); |
761 |
C2V_END |
|
762 |
||
763 |
C2V_VMENTRY(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv *, jobject, jobject jvmci_method)) |
|
764 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
765 |
return method->is_ignored_by_security_stack_walk(); |
|
766 |
C2V_END |
|
767 |
||
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
768 |
C2V_VMENTRY(jboolean, isCompilable,(JNIEnv *, jobject, jobject jvmci_method)) |
33160 | 769 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
48826 | 770 |
constantPoolHandle cp = method->constMethod()->constants(); |
771 |
assert(!cp.is_null(), "npe"); |
|
772 |
// don't inline method when constant pool contains a CONSTANT_Dynamic |
|
773 |
return !method->is_not_compilable(CompLevel_full_optimization) && !cp->has_dynamic_constant(); |
|
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
774 |
C2V_END |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
775 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
776 |
C2V_VMENTRY(jboolean, hasNeverInlineDirective,(JNIEnv *, jobject, jobject jvmci_method)) |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
777 |
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
|
778 |
return !Inline || CompilerOracle::should_not_inline(method) || method->dont_inline(); |
33160 | 779 |
C2V_END |
780 |
||
781 |
C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jobject jvmci_method)) |
|
782 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
783 |
return CompilerOracle::should_inline(method) || method->force_inline(); |
|
784 |
C2V_END |
|
785 |
||
786 |
C2V_VMENTRY(jobject, lookupType, (JNIEnv*, jobject, jstring jname, jclass accessing_class, jboolean resolve)) |
|
787 |
ResourceMark rm; |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
788 |
Handle name(THREAD, JNIHandles::resolve(jname)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
789 |
Symbol* class_name = java_lang_String::as_symbol(name(), CHECK_0); |
33160 | 790 |
if (java_lang_String::length(name()) <= 1) { |
791 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Primitive type %s should be handled in Java code", class_name->as_C_string())); |
|
792 |
} |
|
793 |
||
794 |
Klass* resolved_klass = NULL; |
|
795 |
if (JNIHandles::resolve(accessing_class) == NULL) { |
|
796 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
797 |
} |
|
798 |
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
|
799 |
Handle class_loader(THREAD, accessing_klass->class_loader()); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
800 |
Handle protection_domain(THREAD, accessing_klass->protection_domain()); |
33160 | 801 |
|
802 |
if (resolve) { |
|
803 |
resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0); |
|
804 |
} else { |
|
805 |
if (class_name->byte_at(0) == 'L' && |
|
806 |
class_name->byte_at(class_name->utf8_length()-1) == ';') { |
|
807 |
// This is a name from a signature. Strip off the trimmings. |
|
808 |
// Call recursive to keep scope of strippedsym. |
|
809 |
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1, |
|
810 |
class_name->utf8_length()-2, |
|
811 |
CHECK_0); |
|
812 |
resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_0); |
|
813 |
} else if (FieldType::is_array(class_name)) { |
|
814 |
FieldArrayInfo fd; |
|
815 |
// dimension and object_key in FieldArrayInfo are assigned as a side-effect |
|
816 |
// of this call |
|
817 |
BasicType t = FieldType::get_array_info(class_name, fd, CHECK_0); |
|
818 |
if (t == T_OBJECT) { |
|
819 |
TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1+fd.dimension(), |
|
820 |
class_name->utf8_length()-2-fd.dimension(), |
|
821 |
CHECK_0); |
|
822 |
// naked oop "k" is OK here -- we assign back into it |
|
823 |
resolved_klass = SystemDictionary::find(strippedsym, |
|
824 |
class_loader, |
|
825 |
protection_domain, |
|
826 |
CHECK_0); |
|
827 |
if (resolved_klass != NULL) { |
|
828 |
resolved_klass = resolved_klass->array_klass(fd.dimension(), CHECK_0); |
|
829 |
} |
|
830 |
} else { |
|
831 |
resolved_klass = Universe::typeArrayKlassObj(t); |
|
832 |
resolved_klass = TypeArrayKlass::cast(resolved_klass)->array_klass(fd.dimension(), CHECK_0); |
|
833 |
} |
|
834 |
} |
|
835 |
} |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
836 |
oop result = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
837 |
return JNIHandles::make_local(THREAD, result); |
33160 | 838 |
C2V_END |
839 |
||
840 |
C2V_VMENTRY(jobject, resolveConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
841 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
842 |
oop result = cp->resolve_constant_at(index, CHECK_NULL); |
|
843 |
return JNIHandles::make_local(THREAD, result); |
|
844 |
C2V_END |
|
845 |
||
846 |
C2V_VMENTRY(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
847 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
848 |
oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); |
|
849 |
return JNIHandles::make_local(THREAD, result); |
|
850 |
C2V_END |
|
851 |
||
852 |
C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
853 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
854 |
return cp->name_and_type_ref_index_at(index); |
|
855 |
C2V_END |
|
856 |
||
857 |
C2V_VMENTRY(jobject, lookupNameInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which)) |
|
858 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
859 |
Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(which), CHECK_NULL); |
|
860 |
return JNIHandles::make_local(THREAD, sym()); |
|
861 |
C2V_END |
|
862 |
||
863 |
C2V_VMENTRY(jobject, lookupSignatureInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which)) |
|
864 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
865 |
Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(which), CHECK_NULL); |
|
866 |
return JNIHandles::make_local(THREAD, sym()); |
|
867 |
C2V_END |
|
868 |
||
869 |
C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
870 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
871 |
return cp->klass_ref_index_at(index); |
|
872 |
C2V_END |
|
873 |
||
874 |
C2V_VMENTRY(jobject, resolveTypeInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
875 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
876 |
Klass* resolved_klass = cp->klass_at(index, CHECK_NULL); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
877 |
oop klass = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
878 |
return JNIHandles::make_local(THREAD, klass); |
33160 | 879 |
C2V_END |
880 |
||
881 |
C2V_VMENTRY(jobject, lookupKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
|
882 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
883 |
Klass* loading_klass = cp->pool_holder(); |
33160 | 884 |
bool is_accessible = false; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
885 |
Klass* klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); |
33160 | 886 |
Symbol* symbol = NULL; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
887 |
if (klass == NULL) { |
33160 | 888 |
symbol = cp->klass_name_at(index); |
889 |
} |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
890 |
oop result_oop; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
891 |
if (klass != NULL) { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
892 |
result_oop = CompilerToVM::get_jvmci_type(klass, CHECK_NULL); |
33160 | 893 |
} else { |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
894 |
Handle result = java_lang_String::create_from_symbol(symbol, CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
895 |
result_oop = result(); |
33160 | 896 |
} |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
897 |
return JNIHandles::make_local(THREAD, result_oop); |
33160 | 898 |
C2V_END |
899 |
||
900 |
C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
901 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
902 |
oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index); |
|
903 |
return JNIHandles::make_local(THREAD, appendix_oop); |
|
904 |
C2V_END |
|
905 |
||
906 |
C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
|
907 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
908 |
InstanceKlass* pool_holder = cp->pool_holder(); |
33160 | 909 |
Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); |
910 |
methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder); |
|
911 |
oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL); |
|
912 |
return JNIHandles::make_local(THREAD, result); |
|
913 |
C2V_END |
|
914 |
||
915 |
C2V_VMENTRY(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
916 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
917 |
return cp->remap_instruction_operand_from_cache(index); |
|
918 |
C2V_END |
|
919 |
||
43939 | 920 |
C2V_VMENTRY(jobject, resolveFieldInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jobject jvmci_method, jbyte opcode, jintArray info_handle)) |
33160 | 921 |
ResourceMark rm; |
922 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
923 |
Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF); |
|
924 |
fieldDescriptor fd; |
|
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38719
diff
changeset
|
925 |
LinkInfo link_info(cp, index, (jvmci_method != NULL) ? CompilerToVM::asMethod(jvmci_method) : NULL, CHECK_0); |
33160 | 926 |
LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_0); |
927 |
typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle); |
|
43939 | 928 |
if (info == NULL || info->length() != 3) { |
929 |
JVMCI_ERROR_NULL("info must not be null and have a length of 3"); |
|
930 |
} |
|
931 |
info->int_at_put(0, fd.access_flags().as_int()); |
|
932 |
info->int_at_put(1, fd.offset()); |
|
933 |
info->int_at_put(2, fd.index()); |
|
33160 | 934 |
oop field_holder = CompilerToVM::get_jvmci_type(fd.field_holder(), CHECK_NULL); |
935 |
return JNIHandles::make_local(THREAD, field_holder); |
|
936 |
C2V_END |
|
937 |
||
938 |
C2V_VMENTRY(jint, getVtableIndexForInterfaceMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) |
|
939 |
ResourceMark rm; |
|
940 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
|
941 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
942 |
if (klass->is_interface()) { |
|
943 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", klass->external_name())); |
|
944 |
} |
|
945 |
if (!method->method_holder()->is_interface()) { |
|
946 |
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())); |
|
947 |
} |
|
33632 | 948 |
if (!InstanceKlass::cast(klass)->is_linked()) { |
949 |
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name())); |
|
33160 | 950 |
} |
951 |
return LinkResolver::vtable_index_of_interface_method(klass, method); |
|
952 |
C2V_END |
|
953 |
||
954 |
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
|
955 |
Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
956 |
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
|
957 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
33160 | 958 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
959 |
Klass* resolved = method->method_holder(); |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
960 |
Symbol* h_name = method->name(); |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
961 |
Symbol* h_signature = method->signature(); |
33160 | 962 |
|
41051
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
963 |
if (MethodHandles::is_signature_polymorphic_method(method())) { |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
964 |
// 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
|
965 |
return NULL; |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
966 |
} |
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
967 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
968 |
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
|
969 |
methodHandle m; |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
970 |
// 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
|
971 |
// 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
|
972 |
if (recv_klass->is_array_klass() || |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
973 |
(InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface())) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
974 |
if (resolved->is_interface()) { |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
975 |
m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info); |
33160 | 976 |
} else { |
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
977 |
m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); |
33160 | 978 |
} |
979 |
} |
|
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
980 |
|
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
981 |
if (m.is_null()) { |
41051
77740a69b211
8161550: [JVMCI] Crash: assert(sig_bt[member_arg_pos] == T_OBJECT)
never
parents:
40878
diff
changeset
|
982 |
// 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
|
983 |
return NULL; |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
984 |
} |
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
985 |
|
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38133
diff
changeset
|
986 |
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
|
987 |
return JNIHandles::make_local(THREAD, result); |
33160 | 988 |
C2V_END |
989 |
||
990 |
C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject jvmci_type)) |
|
991 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
|
992 |
assert(klass != NULL, "method must not be called for primitive types"); |
|
993 |
return Dependencies::find_finalizable_subclass(klass) != NULL; |
|
994 |
C2V_END |
|
995 |
||
996 |
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
|
997 |
Klass* klass = CompilerToVM::asKlass(jvmci_type); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
998 |
if (!klass->is_instance_klass()) { |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
999 |
return NULL; |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
1000 |
} |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
1001 |
InstanceKlass* iklass = InstanceKlass::cast(klass); |
614068b0ddd7
8193930: [JVMCI] calling ResolvedTypeType.getClassInitializer on an array type crashes
dnsimon
parents:
48400
diff
changeset
|
1002 |
oop result = CompilerToVM::get_jvmci_method(iklass->class_initializer(), CHECK_NULL); |
33160 | 1003 |
return JNIHandles::make_local(THREAD, result); |
1004 |
C2V_END |
|
1005 |
||
1006 |
C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr)) |
|
1007 |
address target_addr = (address) addr; |
|
1008 |
if (target_addr != 0x0) { |
|
1009 |
int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int)); |
|
1010 |
int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int)); |
|
1011 |
return MAX2(ABS(off_low), ABS(off_high)); |
|
1012 |
} |
|
1013 |
return -1; |
|
1014 |
C2V_END |
|
1015 |
||
47793
3dcd54513db1
8186478: [JVMCI] rename HotSpotResolvedJavaMethod#setNotInlineableOrCompileable
dnsimon
parents:
47765
diff
changeset
|
1016 |
C2V_VMENTRY(void, setNotInlinableOrCompilable,(JNIEnv *, jobject, jobject jvmci_method)) |
33160 | 1017 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
1018 |
method->set_not_c1_compilable(); |
|
1019 |
method->set_not_c2_compilable(); |
|
1020 |
method->set_dont_inline(true); |
|
1021 |
C2V_END |
|
1022 |
||
1023 |
C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log)) |
|
1024 |
ResourceMark rm; |
|
1025 |
HandleMark hm; |
|
44092 | 1026 |
JNIHandleMark jni_hm; |
1027 |
||
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1028 |
Handle target_handle(THREAD, JNIHandles::resolve(target)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1029 |
Handle compiled_code_handle(THREAD, JNIHandles::resolve(compiled_code)); |
33160 | 1030 |
CodeBlob* cb = NULL; |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1031 |
Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1032 |
Handle speculation_log_handle(THREAD, JNIHandles::resolve(speculation_log)); |
33160 | 1033 |
|
47796
47629b00daa9
8187315: [JVMCI] hosted use of JVMCI can crash VM under -Xint
dnsimon
parents:
47794
diff
changeset
|
1034 |
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK_JNI_ERR); |
33160 | 1035 |
|
1036 |
TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer()); |
|
42650 | 1037 |
bool is_immutable_PIC = HotSpotCompiledCode::isImmutablePIC(compiled_code_handle) > 0; |
1038 |
CodeInstaller installer(is_immutable_PIC); |
|
34153
cbcfa2a6fe0b
8139589: [JVMCI] throw exceptions in faulty code installation operations
twisti
parents:
33632
diff
changeset
|
1039 |
JVMCIEnv::CodeInstallResult result = installer.install(compiler, target_handle, compiled_code_handle, cb, installed_code_handle, speculation_log_handle, CHECK_0); |
33160 | 1040 |
|
1041 |
if (PrintCodeCacheOnCompilation) { |
|
1042 |
stringStream s; |
|
1043 |
// Dump code cache into a buffer before locking the tty, |
|
1044 |
{ |
|
1045 |
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
|
1046 |
CodeCache::print_summary(&s, false); |
|
1047 |
} |
|
1048 |
ttyLocker ttyl; |
|
1049 |
tty->print_raw_cr(s.as_string()); |
|
1050 |
} |
|
1051 |
||
1052 |
if (result != JVMCIEnv::ok) { |
|
1053 |
assert(cb == NULL, "should be"); |
|
1054 |
} else { |
|
47794
e84aa2c71241
8188102: [JVMCI] Convert special JVMCI oops in nmethod to jweak values
dnsimon
parents:
47793
diff
changeset
|
1055 |
if (installed_code_handle.not_null()) { |
33160 | 1056 |
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
|
1057 |
nmethod::invalidate_installed_code(installed_code_handle, CHECK_0); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1058 |
{ |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1059 |
// Ensure that all updates to the InstalledCode fields are consistent. |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1060 |
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1061 |
InstalledCode::set_address(installed_code_handle, (jlong) cb); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1062 |
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
|
1063 |
if (cb->is_nmethod()) { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1064 |
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
|
1065 |
} else { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1066 |
InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->code_begin()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1067 |
} |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1068 |
if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) { |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1069 |
HotSpotInstalledCode::set_size(installed_code_handle, cb->size()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1070 |
HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1071 |
HotSpotInstalledCode::set_codeSize(installed_code_handle, cb->code_size()); |
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1072 |
} |
33160 | 1073 |
} |
1074 |
} |
|
1075 |
} |
|
1076 |
return result; |
|
1077 |
C2V_END |
|
1078 |
||
1079 |
C2V_VMENTRY(jint, getMetadata, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject metadata)) |
|
1080 |
ResourceMark rm; |
|
1081 |
HandleMark hm; |
|
1082 |
||
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1083 |
Handle target_handle(THREAD, JNIHandles::resolve(target)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1084 |
Handle compiled_code_handle(THREAD, JNIHandles::resolve(compiled_code)); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1085 |
Handle metadata_handle(THREAD, JNIHandles::resolve(metadata)); |
33160 | 1086 |
|
1087 |
CodeMetadata code_metadata; |
|
1088 |
CodeBlob *cb = NULL; |
|
42650 | 1089 |
CodeInstaller installer(true /* immutable PIC compilation */); |
33160 | 1090 |
|
38695 | 1091 |
JVMCIEnv::CodeInstallResult result = installer.gather_metadata(target_handle, compiled_code_handle, code_metadata, CHECK_0); |
33160 | 1092 |
if (result != JVMCIEnv::ok) { |
1093 |
return result; |
|
1094 |
} |
|
1095 |
||
1096 |
if (code_metadata.get_nr_pc_desc() > 0) { |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1097 |
typeArrayHandle pcArrayOop = oopFactory::new_byteArray_handle(sizeof(PcDesc) * code_metadata.get_nr_pc_desc(), CHECK_(JVMCIEnv::cache_full)); |
33160 | 1098 |
memcpy(pcArrayOop->byte_at_addr(0), code_metadata.get_pc_desc(), sizeof(PcDesc) * code_metadata.get_nr_pc_desc()); |
1099 |
HotSpotMetaData::set_pcDescBytes(metadata_handle, pcArrayOop()); |
|
1100 |
} |
|
1101 |
||
1102 |
if (code_metadata.get_scopes_size() > 0) { |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1103 |
typeArrayHandle scopesArrayOop = oopFactory::new_byteArray_handle(code_metadata.get_scopes_size(), CHECK_(JVMCIEnv::cache_full)); |
33160 | 1104 |
memcpy(scopesArrayOop->byte_at_addr(0), code_metadata.get_scopes_desc(), code_metadata.get_scopes_size()); |
1105 |
HotSpotMetaData::set_scopesDescBytes(metadata_handle, scopesArrayOop()); |
|
1106 |
} |
|
1107 |
||
1108 |
RelocBuffer* reloc_buffer = code_metadata.get_reloc_buffer(); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1109 |
typeArrayHandle relocArrayOop = oopFactory::new_byteArray_handle((int) reloc_buffer->size(), CHECK_(JVMCIEnv::cache_full)); |
33160 | 1110 |
if (reloc_buffer->size() > 0) { |
1111 |
memcpy(relocArrayOop->byte_at_addr(0), reloc_buffer->begin(), reloc_buffer->size()); |
|
1112 |
} |
|
1113 |
HotSpotMetaData::set_relocBytes(metadata_handle, relocArrayOop()); |
|
1114 |
||
1115 |
const OopMapSet* oopMapSet = installer.oopMapSet(); |
|
1116 |
{ |
|
1117 |
ResourceMark mark; |
|
1118 |
ImmutableOopMapBuilder builder(oopMapSet); |
|
1119 |
int oopmap_size = builder.heap_size(); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1120 |
typeArrayHandle oopMapArrayHandle = oopFactory::new_byteArray_handle(oopmap_size, CHECK_(JVMCIEnv::cache_full)); |
33160 | 1121 |
builder.generate_into((address) oopMapArrayHandle->byte_at_addr(0)); |
1122 |
HotSpotMetaData::set_oopMaps(metadata_handle, oopMapArrayHandle()); |
|
1123 |
} |
|
1124 |
||
42650 | 1125 |
AOTOopRecorder* recorder = code_metadata.get_oop_recorder(); |
1126 |
||
47668 | 1127 |
int nr_meta_refs = recorder->nr_meta_refs(); |
1128 |
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
|
1129 |
objArrayHandle metadataArrayHandle(THREAD, metadataArray); |
47668 | 1130 |
for (int i = 0; i < nr_meta_refs; ++i) { |
1131 |
jobject element = recorder->meta_element(i); |
|
1132 |
if (element == NULL) { |
|
1133 |
return JVMCIEnv::cache_full; |
|
1134 |
} |
|
1135 |
metadataArrayHandle->obj_at_put(i, JNIHandles::resolve(element)); |
|
42650 | 1136 |
} |
1137 |
HotSpotMetaData::set_metadata(metadata_handle, metadataArrayHandle()); |
|
33160 | 1138 |
|
1139 |
ExceptionHandlerTable* handler = code_metadata.get_exception_table(); |
|
1140 |
int table_size = handler->size_in_bytes(); |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1141 |
typeArrayHandle exceptionArrayOop = oopFactory::new_byteArray_handle(table_size, CHECK_(JVMCIEnv::cache_full)); |
33160 | 1142 |
|
1143 |
if (table_size > 0) { |
|
1144 |
handler->copy_bytes_to((address) exceptionArrayOop->byte_at_addr(0)); |
|
1145 |
} |
|
1146 |
HotSpotMetaData::set_exceptionBytes(metadata_handle, exceptionArrayOop()); |
|
1147 |
||
1148 |
return result; |
|
1149 |
C2V_END |
|
1150 |
||
1151 |
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
|
1152 |
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK); |
33160 | 1153 |
CompilerStatistics* stats = compiler->stats(); |
1154 |
stats->_standard.reset(); |
|
1155 |
stats->_osr.reset(); |
|
1156 |
C2V_END |
|
1157 |
||
33632 | 1158 |
C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jobject installedCode)) |
33160 | 1159 |
ResourceMark rm; |
1160 |
HandleMark hm; |
|
1161 |
||
33632 | 1162 |
if (installedCode == NULL) { |
1163 |
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "installedCode is null"); |
|
1164 |
} |
|
1165 |
||
1166 |
jlong codeBlob = InstalledCode::address(installedCode); |
|
1167 |
if (codeBlob == 0L) { |
|
1168 |
return NULL; |
|
1169 |
} |
|
1170 |
||
33160 | 1171 |
CodeBlob* cb = (CodeBlob*) (address) codeBlob; |
1172 |
if (cb == NULL) { |
|
1173 |
return NULL; |
|
1174 |
} |
|
1175 |
||
1176 |
// We don't want the stringStream buffer to resize during disassembly as it |
|
1177 |
// uses scoped resource memory. If a nested function called during disassembly uses |
|
1178 |
// a ResourceMark and the buffer expands within the scope of the mark, |
|
1179 |
// the buffer becomes garbage when that scope is exited. Experience shows that |
|
1180 |
// the disassembled code is typically about 10x the code size so a fixed buffer |
|
1181 |
// sized to 20x code size plus a fixed amount for header info should be sufficient. |
|
1182 |
int bufferSize = cb->code_size() * 20 + 1024; |
|
1183 |
char* buffer = NEW_RESOURCE_ARRAY(char, bufferSize); |
|
1184 |
stringStream st(buffer, bufferSize); |
|
1185 |
if (cb->is_nmethod()) { |
|
1186 |
nmethod* nm = (nmethod*) cb; |
|
1187 |
if (!nm->is_alive()) { |
|
1188 |
return NULL; |
|
1189 |
} |
|
1190 |
} |
|
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
|
1191 |
Disassembler::decode(cb, &st); |
33160 | 1192 |
if (st.size() <= 0) { |
1193 |
return NULL; |
|
1194 |
} |
|
1195 |
||
1196 |
Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
|
1197 |
return JNIHandles::make_local(THREAD, result()); |
|
1198 |
C2V_END |
|
1199 |
||
1200 |
C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv*, jobject, jobject jvmci_method, int bci)) |
|
1201 |
ResourceMark rm; |
|
1202 |
HandleMark hm; |
|
1203 |
||
1204 |
methodHandle method = CompilerToVM::asMethod(jvmci_method); |
|
1205 |
oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); |
|
1206 |
return JNIHandles::make_local(THREAD, element); |
|
1207 |
C2V_END |
|
1208 |
||
1209 |
C2V_VMENTRY(jobject, executeInstalledCode, (JNIEnv*, jobject, jobject args, jobject hotspotInstalledCode)) |
|
1210 |
ResourceMark rm; |
|
1211 |
HandleMark hm; |
|
1212 |
||
1213 |
jlong nmethodValue = InstalledCode::address(hotspotInstalledCode); |
|
1214 |
if (nmethodValue == 0L) { |
|
1215 |
THROW_NULL(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException()); |
|
1216 |
} |
|
1217 |
nmethod* nm = (nmethod*) (address) nmethodValue; |
|
1218 |
methodHandle mh = nm->method(); |
|
1219 |
Symbol* signature = mh->signature(); |
|
1220 |
JavaCallArguments jca(mh->size_of_parameters()); |
|
1221 |
||
1222 |
JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
|
1223 |
JavaValue result(jap.get_ret_type()); |
|
1224 |
jca.set_alternative_target(nm); |
|
1225 |
JavaCalls::call(&result, mh, &jca, CHECK_NULL); |
|
1226 |
||
1227 |
if (jap.get_ret_type() == T_VOID) { |
|
1228 |
return NULL; |
|
1229 |
} else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) { |
|
1230 |
return JNIHandles::make_local(THREAD, (oop) result.get_jobject()); |
|
1231 |
} else { |
|
1232 |
jvalue *value = (jvalue *) result.get_value_addr(); |
|
1233 |
// Narrow the value down if required (Important on big endian machines) |
|
1234 |
switch (jap.get_ret_type()) { |
|
1235 |
case T_BOOLEAN: |
|
1236 |
value->z = (jboolean) value->i; |
|
1237 |
break; |
|
1238 |
case T_BYTE: |
|
1239 |
value->b = (jbyte) value->i; |
|
1240 |
break; |
|
1241 |
case T_CHAR: |
|
1242 |
value->c = (jchar) value->i; |
|
1243 |
break; |
|
1244 |
case T_SHORT: |
|
1245 |
value->s = (jshort) value->i; |
|
1246 |
break; |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
1247 |
default: |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
1248 |
break; |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46505
diff
changeset
|
1249 |
} |
33160 | 1250 |
oop o = java_lang_boxing_object::create(jap.get_ret_type(), value, CHECK_NULL); |
1251 |
return JNIHandles::make_local(THREAD, o); |
|
1252 |
} |
|
1253 |
C2V_END |
|
1254 |
||
1255 |
C2V_VMENTRY(jlongArray, getLineNumberTable, (JNIEnv *, jobject, jobject jvmci_method)) |
|
1256 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
1257 |
if (!method->has_linenumber_table()) { |
|
1258 |
return NULL; |
|
1259 |
} |
|
1260 |
u2 num_entries = 0; |
|
1261 |
CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table()); |
|
1262 |
while (streamForSize.read_pair()) { |
|
1263 |
num_entries++; |
|
1264 |
} |
|
1265 |
||
1266 |
CompressedLineNumberReadStream stream(method->compressed_linenumber_table()); |
|
1267 |
typeArrayOop result = oopFactory::new_longArray(2 * num_entries, CHECK_NULL); |
|
1268 |
||
1269 |
int i = 0; |
|
1270 |
jlong value; |
|
1271 |
while (stream.read_pair()) { |
|
1272 |
value = ((long) stream.bci()); |
|
1273 |
result->long_at_put(i, value); |
|
1274 |
value = ((long) stream.line()); |
|
1275 |
result->long_at_put(i + 1, value); |
|
1276 |
i += 2; |
|
1277 |
} |
|
1278 |
||
1279 |
return (jlongArray) JNIHandles::make_local(THREAD, result); |
|
1280 |
C2V_END |
|
1281 |
||
1282 |
C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jobject jvmci_method)) |
|
1283 |
ResourceMark rm; |
|
1284 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
1285 |
if (!method->has_localvariable_table()) { |
|
1286 |
return 0; |
|
1287 |
} |
|
1288 |
return (jlong) (address) method->localvariable_table_start(); |
|
1289 |
C2V_END |
|
1290 |
||
1291 |
C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jobject jvmci_method)) |
|
1292 |
ResourceMark rm; |
|
1293 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
1294 |
return method->localvariable_table_length(); |
|
1295 |
C2V_END |
|
1296 |
||
1297 |
C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jobject jvmci_method)) |
|
1298 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
1299 |
MethodCounters* mcs = method->method_counters(); |
|
1300 |
if (mcs != NULL) { |
|
1301 |
mcs->clear_counters(); |
|
1302 |
} |
|
1303 |
NOT_PRODUCT(method->set_compiled_invocation_count(0)); |
|
1304 |
||
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
1305 |
CompiledMethod* code = method->code(); |
33160 | 1306 |
if (code != NULL) { |
1307 |
code->make_not_entrant(); |
|
1308 |
} |
|
1309 |
||
1310 |
MethodData* method_data = method->method_data(); |
|
1311 |
if (method_data == NULL) { |
|
1312 |
ClassLoaderData* loader_data = method->method_holder()->class_loader_data(); |
|
1313 |
method_data = MethodData::allocate(loader_data, method, CHECK); |
|
1314 |
method->set_method_data(method_data); |
|
1315 |
} else { |
|
1316 |
method_data->initialize(); |
|
1317 |
} |
|
1318 |
C2V_END |
|
1319 |
||
1320 |
||
33632 | 1321 |
C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject installed_code)) |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1322 |
Handle installed_code_handle(THREAD, JNIHandles::resolve(installed_code)); |
35092
82170e5767c3
8143571: [JVMCI] Double unregistering of nmethod during unloading
never
parents:
34317
diff
changeset
|
1323 |
nmethod::invalidate_installed_code(installed_code_handle, CHECK); |
33160 | 1324 |
C2V_END |
1325 |
||
1326 |
C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject)) |
|
1327 |
typeArrayOop arrayOop = oopFactory::new_longArray(JVMCICounterSize, CHECK_NULL); |
|
1328 |
JavaThread::collect_counters(arrayOop); |
|
1329 |
return (jlongArray) JNIHandles::make_local(THREAD, arrayOop); |
|
1330 |
C2V_END |
|
1331 |
||
1332 |
C2V_VMENTRY(int, allocateCompileId, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci)) |
|
1333 |
HandleMark hm; |
|
1334 |
ResourceMark rm; |
|
1335 |
if (JNIHandles::resolve(jvmci_method) == NULL) { |
|
1336 |
THROW_0(vmSymbols::java_lang_NullPointerException()); |
|
1337 |
} |
|
1338 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
1339 |
if (entry_bci >= method->code_size() || entry_bci < -1) { |
|
1340 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Unexpected bci %d", entry_bci)); |
|
1341 |
} |
|
1342 |
return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci); |
|
1343 |
C2V_END |
|
1344 |
||
1345 |
||
1346 |
C2V_VMENTRY(jboolean, isMature, (JNIEnv*, jobject, jlong metaspace_method_data)) |
|
1347 |
MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data); |
|
1348 |
return mdo != NULL && mdo->is_mature(); |
|
1349 |
C2V_END |
|
1350 |
||
1351 |
C2V_VMENTRY(jboolean, hasCompiledCodeForOSR, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci, int comp_level)) |
|
1352 |
Method* method = CompilerToVM::asMethod(jvmci_method); |
|
1353 |
return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL; |
|
1354 |
C2V_END |
|
1355 |
||
1356 |
C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong symbol)) |
|
1357 |
Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)symbol, CHECK_NULL); |
|
1358 |
return JNIHandles::make_local(THREAD, sym()); |
|
1359 |
C2V_END |
|
1360 |
||
1361 |
bool matches(jobjectArray methods, Method* method) { |
|
1362 |
objArrayOop methods_oop = (objArrayOop) JNIHandles::resolve(methods); |
|
1363 |
||
1364 |
for (int i = 0; i < methods_oop->length(); i++) { |
|
33632 | 1365 |
oop resolved = methods_oop->obj_at(i); |
1366 |
if (resolved->is_a(HotSpotResolvedJavaMethodImpl::klass()) && CompilerToVM::asMethod(resolved) == method) { |
|
33160 | 1367 |
return true; |
1368 |
} |
|
1369 |
} |
|
1370 |
return false; |
|
1371 |
} |
|
1372 |
||
1373 |
C2V_VMENTRY(jobject, getNextStackFrame, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jobjectArray methods, jint initialSkip)) |
|
1374 |
ResourceMark rm; |
|
1375 |
||
1376 |
if (!thread->has_last_Java_frame()) return NULL; |
|
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1377 |
Handle result = HotSpotStackFrameReference::klass()->allocate_instance_handle(CHECK_NULL); |
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1378 |
HotSpotStackFrameReference::klass()->initialize(CHECK_NULL); |
33160 | 1379 |
|
1380 |
StackFrameStream fst(thread); |
|
1381 |
if (hs_frame != NULL) { |
|
1382 |
// look for the correct stack frame if one is given |
|
1383 |
intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame); |
|
1384 |
while (fst.current()->sp() != stack_pointer && !fst.is_done()) { |
|
1385 |
fst.next(); |
|
1386 |
} |
|
1387 |
if (fst.current()->sp() != stack_pointer) { |
|
1388 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "stack frame not found") |
|
1389 |
} |
|
1390 |
} |
|
1391 |
||
1392 |
int frame_number = 0; |
|
1393 |
vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1394 |
if (hs_frame != NULL) { |
|
1395 |
// look for the correct vframe within the stack frame if one is given |
|
1396 |
int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame); |
|
1397 |
while (frame_number < last_frame_number) { |
|
1398 |
if (vf->is_top()) { |
|
1399 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "invalid frame number") |
|
1400 |
} |
|
1401 |
vf = vf->sender(); |
|
1402 |
frame_number ++; |
|
1403 |
} |
|
1404 |
// move one frame forward |
|
1405 |
if (vf->is_top()) { |
|
1406 |
if (fst.is_done()) { |
|
1407 |
return NULL; |
|
1408 |
} |
|
1409 |
fst.next(); |
|
1410 |
vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1411 |
frame_number = 0; |
|
1412 |
} else { |
|
1413 |
vf = vf->sender(); |
|
1414 |
frame_number++; |
|
1415 |
} |
|
1416 |
} |
|
1417 |
||
1418 |
while (true) { |
|
1419 |
// look for the given method |
|
1420 |
while (true) { |
|
1421 |
StackValueCollection* locals = NULL; |
|
1422 |
if (vf->is_compiled_frame()) { |
|
1423 |
// compiled method frame |
|
1424 |
compiledVFrame* cvf = compiledVFrame::cast(vf); |
|
1425 |
if (methods == NULL || matches(methods, cvf->method())) { |
|
1426 |
if (initialSkip > 0) { |
|
1427 |
initialSkip --; |
|
1428 |
} else { |
|
1429 |
ScopeDesc* scope = cvf->scope(); |
|
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1430 |
// native wrappers do not have a scope |
33160 | 1431 |
if (scope != NULL && scope->objects() != NULL) { |
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1432 |
bool realloc_failures = Deoptimization::realloc_objects(thread, fst.current(), scope->objects(), CHECK_NULL); |
33160 | 1433 |
Deoptimization::reassign_fields(fst.current(), fst.register_map(), scope->objects(), realloc_failures, false); |
1434 |
||
1435 |
GrowableArray<ScopeValue*>* local_values = scope->locals(); |
|
48605
00d8c8d696e9
8194991: Null pointer dereference caused by c2v_getNextStackFrame
dlong
parents:
48400
diff
changeset
|
1436 |
assert(local_values != NULL, "NULL locals"); |
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1437 |
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
|
1438 |
typeArrayHandle array(THREAD, array_oop); |
33160 | 1439 |
for (int i = 0; i < local_values->length(); i++) { |
1440 |
ScopeValue* value = local_values->at(i); |
|
1441 |
if (value->is_object()) { |
|
1442 |
array->bool_at_put(i, true); |
|
1443 |
} |
|
1444 |
} |
|
1445 |
HotSpotStackFrameReference::set_localIsVirtual(result, array()); |
|
1446 |
} else { |
|
1447 |
HotSpotStackFrameReference::set_localIsVirtual(result, NULL); |
|
1448 |
} |
|
1449 |
||
1450 |
locals = cvf->locals(); |
|
1451 |
HotSpotStackFrameReference::set_bci(result, cvf->bci()); |
|
1452 |
oop method = CompilerToVM::get_jvmci_method(cvf->method(), CHECK_NULL); |
|
1453 |
HotSpotStackFrameReference::set_method(result, method); |
|
1454 |
} |
|
1455 |
} |
|
1456 |
} else if (vf->is_interpreted_frame()) { |
|
1457 |
// interpreted method frame |
|
1458 |
interpretedVFrame* ivf = interpretedVFrame::cast(vf); |
|
1459 |
if (methods == NULL || matches(methods, ivf->method())) { |
|
1460 |
if (initialSkip > 0) { |
|
1461 |
initialSkip --; |
|
1462 |
} else { |
|
1463 |
locals = ivf->locals(); |
|
1464 |
HotSpotStackFrameReference::set_bci(result, ivf->bci()); |
|
1465 |
oop method = CompilerToVM::get_jvmci_method(ivf->method(), CHECK_NULL); |
|
1466 |
HotSpotStackFrameReference::set_method(result, method); |
|
1467 |
HotSpotStackFrameReference::set_localIsVirtual(result, NULL); |
|
1468 |
} |
|
1469 |
} |
|
1470 |
} |
|
1471 |
||
1472 |
// locals != NULL means that we found a matching frame and result is already partially initialized |
|
1473 |
if (locals != NULL) { |
|
1474 |
HotSpotStackFrameReference::set_compilerToVM(result, JNIHandles::resolve(compilerToVM)); |
|
1475 |
HotSpotStackFrameReference::set_stackPointer(result, (jlong) fst.current()->sp()); |
|
1476 |
HotSpotStackFrameReference::set_frameNumber(result, frame_number); |
|
1477 |
||
1478 |
// initialize the locals array |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1479 |
objArrayOop array_oop = oopFactory::new_objectArray(locals->size(), CHECK_NULL); |
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1480 |
objArrayHandle array(THREAD, array_oop); |
33160 | 1481 |
for (int i = 0; i < locals->size(); i++) { |
1482 |
StackValue* var = locals->at(i); |
|
1483 |
if (var->type() == T_OBJECT) { |
|
1484 |
array->obj_at_put(i, locals->at(i)->get_obj()()); |
|
1485 |
} |
|
1486 |
} |
|
1487 |
HotSpotStackFrameReference::set_locals(result, array()); |
|
1488 |
||
1489 |
return JNIHandles::make_local(thread, result()); |
|
1490 |
} |
|
1491 |
||
1492 |
if (vf->is_top()) { |
|
1493 |
break; |
|
1494 |
} |
|
1495 |
frame_number++; |
|
1496 |
vf = vf->sender(); |
|
1497 |
} // end of vframe loop |
|
1498 |
||
1499 |
if (fst.is_done()) { |
|
1500 |
break; |
|
1501 |
} |
|
1502 |
fst.next(); |
|
1503 |
vf = vframe::new_vframe(fst.current(), fst.register_map(), thread); |
|
1504 |
frame_number = 0; |
|
1505 |
} // end of frame loop |
|
1506 |
||
1507 |
// the end was reached without finding a matching method |
|
1508 |
return NULL; |
|
1509 |
C2V_END |
|
1510 |
||
1511 |
C2V_VMENTRY(void, resolveInvokeDynamicInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
1512 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
1513 |
CallInfo callInfo; |
|
1514 |
LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokedynamic, CHECK); |
|
1515 |
ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index); |
|
1516 |
cp_cache_entry->set_dynamic_call(cp, callInfo); |
|
1517 |
C2V_END |
|
1518 |
||
1519 |
C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
|
1520 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
1521 |
Klass* holder = cp->klass_ref_at(index, CHECK); |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1522 |
Symbol* name = cp->name_ref_at(index); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
1523 |
if (MethodHandles::is_signature_polymorphic_name(holder, name)) { |
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1524 |
CallInfo callInfo; |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1525 |
LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
1526 |
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
|
1527 |
cp_cache_entry->set_method_handle(cp, callInfo); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1528 |
} |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1529 |
C2V_END |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1530 |
|
47668 | 1531 |
C2V_VMENTRY(jint, isResolvedInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) |
1532 |
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); |
|
1533 |
ConstantPoolCacheEntry* cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index)); |
|
1534 |
if (cp_cache_entry->is_resolved(Bytecodes::_invokehandle)) { |
|
1535 |
// MethodHandle.invoke* --> LambdaForm? |
|
1536 |
ResourceMark rm; |
|
1537 |
||
1538 |
LinkInfo link_info(cp, index, CATCH); |
|
1539 |
||
1540 |
Klass* resolved_klass = link_info.resolved_klass(); |
|
1541 |
||
1542 |
Symbol* name_sym = cp->name_ref_at(index); |
|
1543 |
||
1544 |
vmassert(MethodHandles::is_method_handle_invoke_name(resolved_klass, name_sym), "!"); |
|
1545 |
vmassert(MethodHandles::is_signature_polymorphic_name(resolved_klass, name_sym), "!"); |
|
1546 |
||
1547 |
methodHandle adapter_method(cp_cache_entry->f1_as_method()); |
|
1548 |
||
1549 |
methodHandle resolved_method(adapter_method); |
|
1550 |
||
1551 |
// Can we treat it as a regular invokevirtual? |
|
1552 |
if (resolved_method->method_holder() == resolved_klass && resolved_method->name() == name_sym) { |
|
1553 |
vmassert(!resolved_method->is_static(),"!"); |
|
1554 |
vmassert(MethodHandles::is_signature_polymorphic_method(resolved_method()),"!"); |
|
1555 |
vmassert(!MethodHandles::is_signature_polymorphic_static(resolved_method->intrinsic_id()), "!"); |
|
1556 |
vmassert(cp_cache_entry->appendix_if_resolved(cp) == NULL, "!"); |
|
1557 |
vmassert(cp_cache_entry->method_type_if_resolved(cp) == NULL, "!"); |
|
1558 |
||
1559 |
methodHandle m(LinkResolver::linktime_resolve_virtual_method_or_null(link_info)); |
|
1560 |
vmassert(m == resolved_method, "!!"); |
|
1561 |
return -1; |
|
1562 |
} |
|
1563 |
||
1564 |
return Bytecodes::_invokevirtual; |
|
1565 |
} |
|
1566 |
if (cp_cache_entry->is_resolved(Bytecodes::_invokedynamic)) { |
|
1567 |
return Bytecodes::_invokedynamic; |
|
1568 |
} |
|
1569 |
return -1; |
|
1570 |
C2V_END |
|
1571 |
||
1572 |
||
40872
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1573 |
C2V_VMENTRY(jobject, getSignaturePolymorphicHolders, (JNIEnv*, jobject)) |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1574 |
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
|
1575 |
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
|
1576 |
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
|
1577 |
holders->obj_at_put(0, mh()); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1578 |
holders->obj_at_put(1, vh()); |
6364f752fdc5
8164214: [JVMCI] include VarHandle in signature polymorphic method test
dnsimon
parents:
40372
diff
changeset
|
1579 |
return JNIHandles::make_local(THREAD, holders()); |
33160 | 1580 |
C2V_END |
1581 |
||
1582 |
C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject)) |
|
1583 |
//see compute_recording_non_safepoints in debugInfroRec.cpp |
|
1584 |
if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
|
1585 |
return true; |
|
1586 |
} |
|
1587 |
return DebugNonSafepoints; |
|
1588 |
C2V_END |
|
1589 |
||
1590 |
// public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate); |
|
1591 |
C2V_VMENTRY(void, materializeVirtualObjects, (JNIEnv*, jobject, jobject hs_frame, bool invalidate)) |
|
1592 |
ResourceMark rm; |
|
1593 |
||
1594 |
if (hs_frame == NULL) { |
|
1595 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), "stack frame is null") |
|
1596 |
} |
|
1597 |
||
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1598 |
HotSpotStackFrameReference::klass()->initialize(CHECK); |
33160 | 1599 |
|
1600 |
// look for the given stack frame |
|
1601 |
StackFrameStream fst(thread); |
|
1602 |
intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame); |
|
1603 |
while (fst.current()->sp() != stack_pointer && !fst.is_done()) { |
|
1604 |
fst.next(); |
|
1605 |
} |
|
1606 |
if (fst.current()->sp() != stack_pointer) { |
|
1607 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found") |
|
1608 |
} |
|
1609 |
||
1610 |
if (invalidate) { |
|
1611 |
if (!fst.current()->is_compiled_frame()) { |
|
1612 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1613 |
} |
|
1614 |
assert(fst.current()->cb()->is_nmethod(), "nmethod expected"); |
|
1615 |
((nmethod*) fst.current()->cb())->make_not_entrant(); |
|
1616 |
} |
|
1617 |
Deoptimization::deoptimize(thread, *fst.current(), fst.register_map(), Deoptimization::Reason_none); |
|
1618 |
// look for the frame again as it has been updated by deopt (pc, deopt state...) |
|
1619 |
StackFrameStream fstAfterDeopt(thread); |
|
1620 |
while (fstAfterDeopt.current()->sp() != stack_pointer && !fstAfterDeopt.is_done()) { |
|
1621 |
fstAfterDeopt.next(); |
|
1622 |
} |
|
1623 |
if (fstAfterDeopt.current()->sp() != stack_pointer) { |
|
1624 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found after deopt") |
|
1625 |
} |
|
1626 |
||
1627 |
vframe* vf = vframe::new_vframe(fstAfterDeopt.current(), fstAfterDeopt.register_map(), thread); |
|
1628 |
if (!vf->is_compiled_frame()) { |
|
1629 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected") |
|
1630 |
} |
|
1631 |
||
1632 |
GrowableArray<compiledVFrame*>* virtualFrames = new GrowableArray<compiledVFrame*>(10); |
|
1633 |
while (true) { |
|
1634 |
assert(vf->is_compiled_frame(), "Wrong frame type"); |
|
1635 |
virtualFrames->push(compiledVFrame::cast(vf)); |
|
1636 |
if (vf->is_top()) { |
|
1637 |
break; |
|
1638 |
} |
|
1639 |
vf = vf->sender(); |
|
1640 |
} |
|
1641 |
||
1642 |
int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame); |
|
1643 |
if (last_frame_number >= virtualFrames->length()) { |
|
1644 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "invalid frame number") |
|
1645 |
} |
|
1646 |
||
1647 |
// Reallocate the non-escaping objects and restore their fields. |
|
1648 |
assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope"); |
|
1649 |
GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects(); |
|
1650 |
||
1651 |
if (objects == NULL) { |
|
1652 |
// no objects to materialize |
|
1653 |
return; |
|
1654 |
} |
|
1655 |
||
46794
aa0b86e09f9a
8185790: [JVMCI] getNextStackFrame and materializeVirtualObjects need to forward exceptions
kvn
parents:
46664
diff
changeset
|
1656 |
bool realloc_failures = Deoptimization::realloc_objects(thread, fstAfterDeopt.current(), objects, CHECK); |
33160 | 1657 |
Deoptimization::reassign_fields(fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, realloc_failures, false); |
1658 |
||
1659 |
for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) { |
|
1660 |
compiledVFrame* cvf = virtualFrames->at(frame_index); |
|
1661 |
||
1662 |
GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals(); |
|
1663 |
StackValueCollection* locals = cvf->locals(); |
|
1664 |
if (locals != NULL) { |
|
1665 |
for (int i2 = 0; i2 < locals->size(); i2++) { |
|
1666 |
StackValue* var = locals->at(i2); |
|
1667 |
if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) { |
|
1668 |
jvalue val; |
|
1669 |
val.l = (jobject) locals->at(i2)->get_obj()(); |
|
1670 |
cvf->update_local(T_OBJECT, i2, val); |
|
1671 |
} |
|
1672 |
} |
|
1673 |
} |
|
48792
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1674 |
|
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1675 |
GrowableArray<ScopeValue*>* scopeExpressions = cvf->scope()->expressions(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1676 |
StackValueCollection* expressions = cvf->expressions(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1677 |
if (expressions != NULL) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1678 |
for (int i2 = 0; i2 < expressions->size(); i2++) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1679 |
StackValue* var = expressions->at(i2); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1680 |
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
|
1681 |
jvalue val; |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1682 |
val.l = (jobject) expressions->at(i2)->get_obj()(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1683 |
cvf->update_stack(T_OBJECT, i2, val); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1684 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1685 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1686 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1687 |
|
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1688 |
GrowableArray<MonitorValue*>* scopeMonitors = cvf->scope()->monitors(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1689 |
GrowableArray<MonitorInfo*>* monitors = cvf->monitors(); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1690 |
if (monitors != NULL) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1691 |
for (int i2 = 0; i2 < monitors->length(); i2++) { |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1692 |
cvf->update_monitor(i2, monitors->at(i2)); |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1693 |
} |
d2920683b2ea
8192004: InspectedFrame.materializeVirtualObjects only updates locals with new objects
never
parents:
48480
diff
changeset
|
1694 |
} |
33160 | 1695 |
} |
1696 |
||
1697 |
// all locals are materialized by now |
|
1698 |
HotSpotStackFrameReference::set_localIsVirtual(hs_frame, NULL); |
|
1699 |
||
1700 |
// update the locals array |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1701 |
objArrayHandle array(THREAD, HotSpotStackFrameReference::locals(hs_frame)); |
33160 | 1702 |
StackValueCollection* locals = virtualFrames->at(last_frame_number)->locals(); |
1703 |
for (int i = 0; i < locals->size(); i++) { |
|
1704 |
StackValue* var = locals->at(i); |
|
1705 |
if (var->type() == T_OBJECT) { |
|
1706 |
array->obj_at_put(i, locals->at(i)->get_obj()()); |
|
1707 |
} |
|
1708 |
} |
|
1709 |
C2V_END |
|
1710 |
||
1711 |
C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length)) |
|
1712 |
if (bytes == NULL) { |
|
1713 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1714 |
} |
|
1715 |
typeArrayOop array = (typeArrayOop) JNIHandles::resolve(bytes); |
|
1716 |
||
1717 |
// Check if offset and length are non negative. |
|
1718 |
if (offset < 0 || length < 0) { |
|
1719 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
1720 |
} |
|
1721 |
// Check if the range is valid. |
|
1722 |
if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) { |
|
1723 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
1724 |
} |
|
1725 |
while (length > 0) { |
|
1726 |
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
|
1727 |
tty->write((char*) start, MIN2(length, (jint)O_BUFLEN)); |
33160 | 1728 |
length -= O_BUFLEN; |
1729 |
offset += O_BUFLEN; |
|
1730 |
} |
|
1731 |
C2V_END |
|
1732 |
||
1733 |
C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject)) |
|
1734 |
tty->flush(); |
|
1735 |
C2V_END |
|
1736 |
||
33632 | 1737 |
C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position)) |
1738 |
ResourceMark rm; |
|
1739 |
MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data); |
|
1740 |
ProfileData* profile_data = mdo->data_at(position); |
|
1741 |
if (mdo->is_valid(profile_data)) { |
|
1742 |
return profile_data->size_in_bytes(); |
|
1743 |
} |
|
1744 |
DataLayout* data = mdo->extra_data_base(); |
|
1745 |
DataLayout* end = mdo->extra_data_limit(); |
|
1746 |
for (;; data = mdo->next_extra(data)) { |
|
1747 |
assert(data < end, "moved past end of extra data"); |
|
1748 |
profile_data = data->data_in(); |
|
1749 |
if (mdo->dp_to_di(profile_data->dp()) == position) { |
|
1750 |
return profile_data->size_in_bytes(); |
|
1751 |
} |
|
1752 |
} |
|
1753 |
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position)); |
|
1754 |
C2V_END |
|
1755 |
||
42650 | 1756 |
C2V_VMENTRY(jlong, getFingerprint, (JNIEnv*, jobject, jlong metaspace_klass)) |
1757 |
Klass *k = CompilerToVM::asKlass(metaspace_klass); |
|
1758 |
if (k->is_instance_klass()) { |
|
1759 |
return InstanceKlass::cast(k)->get_stored_fingerprint(); |
|
1760 |
} else { |
|
1761 |
return 0; |
|
1762 |
} |
|
1763 |
C2V_END |
|
1764 |
||
45626
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1765 |
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
|
1766 |
InstanceKlass* k = InstanceKlass::cast(CompilerToVM::asKlass(jvmci_type)); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1767 |
InstanceKlass* host = k->host_klass(); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1768 |
oop result = CompilerToVM::get_jvmci_type(host, CHECK_NULL); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1769 |
return JNIHandles::make_local(THREAD, result); |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1770 |
C2V_END |
c4ea64135530
8182310: [AOT][JVMCI] Get host class of VM anonymous class
dnsimon
parents:
44092
diff
changeset
|
1771 |
|
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
|
1772 |
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
|
1773 |
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
|
1774 |
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
|
1775 |
} |
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
|
1776 |
|
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
|
1777 |
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
|
1778 |
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
|
1779 |
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
|
1780 |
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
|
1781 |
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
|
1782 |
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
|
1783 |
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
|
1784 |
|
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
|
1785 |
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
|
1786 |
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
|
1787 |
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
|
1788 |
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
|
1789 |
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
|
1790 |
|
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
|
1791 |
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
|
1792 |
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
|
1793 |
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
|
1794 |
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
|
1795 |
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
|
1796 |
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
|
1797 |
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
|
1798 |
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
|
1799 |
|
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
|
1800 |
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
|
1801 |
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
|
1802 |
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
|
1803 |
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
|
1804 |
} |
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
|
1805 |
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
|
1806 |
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
|
1807 |
|
41325 | 1808 |
C2V_VMENTRY(void, compileToBytecode, (JNIEnv*, jobject, jobject lambda_form_handle)) |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
1809 |
Handle lambda_form(THREAD, JNIHandles::resolve_non_null(lambda_form_handle)); |
41325 | 1810 |
if (lambda_form->is_a(SystemDictionary::LambdaForm_klass())) { |
1811 |
TempNewSymbol compileToBytecode = SymbolTable::new_symbol("compileToBytecode", CHECK); |
|
1812 |
JavaValue result(T_VOID); |
|
1813 |
JavaCalls::call_special(&result, lambda_form, SystemDictionary::LambdaForm_klass(), compileToBytecode, vmSymbols::void_method_signature(), CHECK); |
|
1814 |
} else { |
|
1815 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
1816 |
err_msg("Unexpected type: %s", lambda_form->klass()->external_name())); |
|
1817 |
} |
|
1818 |
C2V_END |
|
33160 | 1819 |
|
1820 |
#define CC (char*) /*cast a literal from (const char*)*/ |
|
1821 |
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) |
|
1822 |
||
1823 |
#define STRING "Ljava/lang/String;" |
|
1824 |
#define OBJECT "Ljava/lang/Object;" |
|
1825 |
#define CLASS "Ljava/lang/Class;" |
|
41325 | 1826 |
#define EXECUTABLE "Ljava/lang/reflect/Executable;" |
33160 | 1827 |
#define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
1828 |
#define INSTALLED_CODE "Ljdk/vm/ci/code/InstalledCode;" |
|
1829 |
#define TARGET_DESCRIPTION "Ljdk/vm/ci/code/TargetDescription;" |
|
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
|
1830 |
#define BYTECODE_FRAME "Ljdk/vm/ci/code/BytecodeFrame;" |
33160 | 1831 |
#define RESOLVED_METHOD "Ljdk/vm/ci/meta/ResolvedJavaMethod;" |
1832 |
#define HS_RESOLVED_METHOD "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;" |
|
1833 |
#define HS_RESOLVED_KLASS "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;" |
|
1834 |
#define HS_CONSTANT_POOL "Ljdk/vm/ci/hotspot/HotSpotConstantPool;" |
|
1835 |
#define HS_COMPILED_CODE "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;" |
|
33632 | 1836 |
#define HS_CONFIG "Ljdk/vm/ci/hotspot/HotSpotVMConfig;" |
33160 | 1837 |
#define HS_METADATA "Ljdk/vm/ci/hotspot/HotSpotMetaData;" |
1838 |
#define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;" |
|
33632 | 1839 |
#define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;" |
33160 | 1840 |
#define METASPACE_METHOD_DATA "J" |
1841 |
||
1842 |
JNINativeMethod CompilerToVM::methods[] = { |
|
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1843 |
{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
|
1844 |
{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
|
1845 |
{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
|
1846 |
{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
|
1847 |
{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
|
1848 |
{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
|
1849 |
{CC "methodIsIgnoredBySecurityStackWalk", CC "(" HS_RESOLVED_METHOD ")Z", FN_PTR(methodIsIgnoredBySecurityStackWalk)}, |
47793
3dcd54513db1
8186478: [JVMCI] rename HotSpotResolvedJavaMethod#setNotInlineableOrCompileable
dnsimon
parents:
47765
diff
changeset
|
1850 |
{CC "setNotInlinableOrCompilable", CC "(" HS_RESOLVED_METHOD ")V", FN_PTR(setNotInlinableOrCompilable)}, |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
1851 |
{CC "isCompilable", CC "(" HS_RESOLVED_METHOD ")Z", FN_PTR(isCompilable)}, |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
42650
diff
changeset
|
1852 |
{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
|
1853 |
{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
|
1854 |
{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
|
1855 |
{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
|
1856 |
{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
|
1857 |
{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
|
1858 |
{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
|
1859 |
{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
|
1860 |
{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
|
1861 |
{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
|
1862 |
{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
|
1863 |
{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
|
1864 |
{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
|
1865 |
{CC "resolveTypeInPool", CC "(" HS_CONSTANT_POOL "I)" HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)}, |
43939 | 1866 |
{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
|
1867 |
{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
|
1868 |
{CC "resolveInvokeHandleInPool", CC "(" HS_CONSTANT_POOL "I)V", FN_PTR(resolveInvokeHandleInPool)}, |
47668 | 1869 |
{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
|
1870 |
{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
|
1871 |
{CC "getSignaturePolymorphicHolders", CC "()[" STRING, FN_PTR(getSignaturePolymorphicHolders)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1872 |
{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
|
1873 |
{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
|
1874 |
{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
|
1875 |
{CC "getMaxCallTargetOffset", CC "(J)J", FN_PTR(getMaxCallTargetOffset)}, |
41325 | 1876 |
{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
|
1877 |
{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
|
1878 |
{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
|
1879 |
{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
|
1880 |
{CC "readConfiguration", CC "()[" OBJECT, FN_PTR(readConfiguration)}, |
37282
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1881 |
{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
|
1882 |
{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
|
1883 |
{CC "resetCompilationStatistics", CC "()V", FN_PTR(resetCompilationStatistics)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1884 |
{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
|
1885 |
{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
|
1886 |
{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
|
1887 |
{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
|
1888 |
{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
|
1889 |
{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
|
1890 |
{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
|
1891 |
{CC "collectCounters", CC "()[J", FN_PTR(collectCounters)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1892 |
{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
|
1893 |
{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
|
1894 |
{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
|
1895 |
{CC "getSymbol", CC "(J)" STRING, FN_PTR(getSymbol)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1896 |
{CC "getNextStackFrame", CC "(" HS_STACK_FRAME_REF "[" RESOLVED_METHOD "I)" HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1897 |
{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
|
1898 |
{CC "shouldDebugNonSafepoints", CC "()Z", FN_PTR(shouldDebugNonSafepoints)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1899 |
{CC "writeDebugOutput", CC "([BII)V", FN_PTR(writeDebugOutput)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1900 |
{CC "flushDebugOutput", CC "()V", FN_PTR(flushDebugOutput)}, |
3f55e4b3231c
8150690: C++11 user-defined literal syntax in jvmciCompilerToVM.cpp.
rraghavan
parents:
36842
diff
changeset
|
1901 |
{CC "methodDataProfileDataSize", CC "(JI)I", FN_PTR(methodDataProfileDataSize)}, |
42650 | 1902 |
{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
|
1903 |
{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
|
1904 |
{CC "interpreterFrameSize", CC "(" BYTECODE_FRAME ")I", FN_PTR(interpreterFrameSize)}, |
41325 | 1905 |
{CC "compileToBytecode", CC "(" OBJECT ")V", FN_PTR(compileToBytecode)}, |
43939 | 1906 |
{CC "getFlagValue", CC "(" STRING ")" OBJECT, FN_PTR(getFlagValue)}, |
33160 | 1907 |
}; |
1908 |
||
1909 |
int CompilerToVM::methods_count() { |
|
1910 |
return sizeof(methods) / sizeof(JNINativeMethod); |
|
1911 |
} |