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