Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | fd71ca8c5f88 |
children | 41938af2b3d8 |
comparison
equal
deleted
inserted
replaced
6711:ae13cc658b80 | 6948:e522a00b91aa |
---|---|
23 | 23 |
24 #include "precompiled.hpp" | 24 #include "precompiled.hpp" |
25 #include "runtime/fieldDescriptor.hpp" | 25 #include "runtime/fieldDescriptor.hpp" |
26 #include "memory/oopFactory.hpp" | 26 #include "memory/oopFactory.hpp" |
27 #include "oops/generateOopMap.hpp" | 27 #include "oops/generateOopMap.hpp" |
28 #include "oops/fieldStreams.hpp" | |
28 #include "runtime/javaCalls.hpp" | 29 #include "runtime/javaCalls.hpp" |
29 #include "c1/c1_Runtime1.hpp" | 30 #include "c1/c1_Runtime1.hpp" |
30 #include "ci/ciMethodData.hpp" | 31 #include "ci/ciMethodData.hpp" |
31 #include "compiler/compileBroker.hpp" | 32 #include "compiler/compileBroker.hpp" |
33 #include "compiler/compilerOracle.hpp" | |
32 #include "graal/graalCompilerToVM.hpp" | 34 #include "graal/graalCompilerToVM.hpp" |
33 #include "graal/graalCompiler.hpp" | 35 #include "graal/graalCompiler.hpp" |
34 #include "graal/graalEnv.hpp" | 36 #include "graal/graalEnv.hpp" |
35 #include "graal/graalJavaAccess.hpp" | 37 #include "graal/graalJavaAccess.hpp" |
36 #include "graal/graalCodeInstaller.hpp" | 38 #include "graal/graalCodeInstaller.hpp" |
37 #include "graal/graalVMToCompiler.hpp" | 39 #include "graal/graalVMToCompiler.hpp" |
38 #include "graal/graalVmIds.hpp" | 40 #include "graal/graalVmIds.hpp" |
39 | 41 |
40 | 42 |
41 methodOop getMethodFromHotSpotMethod(jobject hotspot_method) { | 43 Method* getMethodFromHotSpotMethod(oop hotspot_method) { |
42 return getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); | 44 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass()), "sanity"); |
43 } | 45 return asMethod(HotSpotResolvedJavaMethod::metaspaceMethod(hotspot_method)); |
44 | |
45 methodOop getMethodFromHotSpotMethod(oop hotspot_method) { | |
46 return (methodOop)HotSpotResolvedJavaMethod::javaMirror(hotspot_method); | |
47 } | |
48 | |
49 methodDataOop getMethodDataFromHotSpotMethodData(jobject hotspot_method_data) { | |
50 return (methodDataOop)HotSpotMethodData::hotspotMirror(JNIHandles::resolve(hotspot_method_data)); | |
51 } | 46 } |
52 | 47 |
53 // Entry to native method implementation that transitions current thread to '_thread_in_vm'. | 48 // Entry to native method implementation that transitions current thread to '_thread_in_vm'. |
54 #define C2V_VMENTRY(result_type, name, signature) \ | 49 #define C2V_VMENTRY(result_type, name, signature) \ |
55 JNIEXPORT result_type JNICALL c2v_ ## name signature { \ | 50 JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
62 JNIEXPORT result_type JNICALL c2v_ ## name signature { \ | 57 JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
63 TRACE_graal_3("CompilerToVM::" #name); \ | 58 TRACE_graal_3("CompilerToVM::" #name); \ |
64 | 59 |
65 #define C2V_END } | 60 #define C2V_END } |
66 | 61 |
67 C2V_ENTRY(jbyteArray, getBytecode, (JNIEnv *env, jobject, jobject hotspot_method)) | 62 C2V_ENTRY(jbyteArray, initializeBytecode, (JNIEnv *env, jobject, jlong metaspace_method, jbyteArray result)) |
68 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 63 methodHandle method = asMethod(metaspace_method); |
64 ResourceMark rm; | |
69 | 65 |
70 // copy all bytecodes | |
71 int code_size = method->code_size(); | 66 int code_size = method->code_size(); |
72 jbyteArray result = env->NewByteArray(code_size); | 67 jbyte* reconstituted_code = NULL; |
73 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); | 68 |
74 | 69 // replace all breakpoints - must be done before undoing any rewriting |
70 if (method->number_of_breakpoints() > 0) { | |
71 reconstituted_code = NEW_RESOURCE_ARRAY(jbyte, code_size); | |
72 memcpy(reconstituted_code, (jbyte *) method->code_base(), code_size); | |
73 BreakpointInfo* bp = InstanceKlass::cast(method->method_holder())->breakpoints(); | |
74 for (; bp != NULL; bp = bp->next()) { | |
75 if (bp->match(method())) { | |
76 jbyte code = bp->orig_bytecode(); | |
77 reconstituted_code[bp->bci()] = code; | |
78 } | |
79 } | |
80 } | |
81 | |
75 // iterate over all bytecodes and replace non-Java bytecodes | 82 // iterate over all bytecodes and replace non-Java bytecodes |
76 if (RewriteBytecodes || RewriteFrequentPairs) { | 83 if (RewriteBytecodes || RewriteFrequentPairs || InstanceKlass::cast(method->method_holder())->is_rewritten()) { |
84 if (reconstituted_code == NULL) { | |
85 reconstituted_code = NEW_RESOURCE_ARRAY(jbyte, code_size); | |
86 memcpy(reconstituted_code, (jbyte *) method->code_base(), code_size); | |
87 } | |
77 BytecodeStream s(method); | 88 BytecodeStream s(method); |
78 while(!s.is_last_bytecode()) { | 89 while(!s.is_last_bytecode()) { |
79 s.next(); | 90 s.next(); |
80 Bytecodes::Code code = s.raw_code(); | 91 Bytecodes::Code opcode = s.raw_code(); |
81 if (!Bytecodes::is_java_code(code)) { | 92 if (!Bytecodes::is_java_code(opcode)) { |
82 jbyte original_code = Bytecodes::java_code(code); | 93 jbyte original_opcode = Bytecodes::java_code(opcode); |
83 env->SetByteArrayRegion(result, s.bci(), 1, &original_code); | 94 int bci = s.bci(); |
95 reconstituted_code[bci] = original_opcode; | |
96 if (opcode == Bytecodes::_fast_aldc_w) { | |
97 int cpci = Bytes::get_native_u2((address) reconstituted_code + bci + 1); | |
98 int i = method->constants()->object_to_cp_index(cpci); | |
99 assert(i < method->constants()->length(), "sanity check"); | |
100 Bytes::put_Java_u2((address) reconstituted_code + bci + 1, (u2)i); | |
101 } else if (opcode == Bytecodes::_fast_aldc) { | |
102 int cpci = reconstituted_code[bci + 1]; | |
103 int i = method->constants()->object_to_cp_index(cpci); | |
104 assert(i < method->constants()->length(), "sanity check"); | |
105 reconstituted_code[bci + 1] = (jbyte)i; | |
106 } | |
84 } | 107 } |
85 } | 108 } |
86 } | 109 } |
87 | 110 |
88 // replace all breakpoints | 111 if (reconstituted_code == NULL) { |
89 if (method->number_of_breakpoints() > 0) { | 112 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); |
90 BreakpointInfo* bp = instanceKlass::cast(method->method_holder())->breakpoints(); | 113 } else { |
91 for (; bp != NULL; bp = bp->next()) { | 114 env->SetByteArrayRegion(result, 0, code_size, reconstituted_code); |
92 if (bp->match(method())) { | |
93 jbyte code = bp->orig_bytecode(); | |
94 env->SetByteArrayRegion(result, bp->bci(), 1, &code); | |
95 } | |
96 } | |
97 } | 115 } |
98 | 116 |
99 return result; | 117 return result; |
100 C2V_END | 118 C2V_END |
101 | 119 |
102 C2V_VMENTRY(jstring, getSignature, (JNIEnv *env, jobject, jobject hotspot_method)) | 120 C2V_VMENTRY(jstring, getSignature, (JNIEnv *env, jobject, jlong metaspace_method)) |
103 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | 121 Method* method = asMethod(metaspace_method); |
104 assert(method != NULL && method->signature() != NULL, "signature required"); | 122 assert(method != NULL && method->signature() != NULL, "signature required"); |
105 return VmIds::toString<jstring>(method->signature(), THREAD); | 123 return VmIds::toString<jstring>(method->signature(), THREAD); |
106 C2V_END | 124 C2V_END |
107 | 125 |
108 C2V_VMENTRY(jobjectArray, getExceptionHandlers, (JNIEnv *, jobject, jobject hotspot_method)) | 126 C2V_VMENTRY(jobjectArray, initializeExceptionHandlers, (JNIEnv *, jobject, jlong metaspace_method, jobjectArray java_handlers)) |
109 ResourceMark rm; | 127 ResourceMark rm; |
110 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 128 methodHandle method = asMethod(metaspace_method); |
111 int handler_count = method->exception_table_length(); | 129 int handler_count = method->exception_table_length(); |
130 objArrayHandle array = (objArrayOop) JNIHandles::resolve(java_handlers); | |
131 assert(array->length() == handler_count, "wrong length"); | |
112 ExceptionTableElement* handlers = handler_count == 0 ? NULL : method->exception_table_start(); | 132 ExceptionTableElement* handlers = handler_count == 0 ? NULL : method->exception_table_start(); |
113 | |
114 instanceKlass::cast(ExceptionHandler::klass())->initialize(CHECK_NULL); | |
115 objArrayHandle array = oopFactory::new_objArray(SystemDictionary::ExceptionHandler_klass(), handler_count, CHECK_NULL); | |
116 | 133 |
117 for (int i = 0; i < handler_count; i++) { | 134 for (int i = 0; i < handler_count; i++) { |
118 ExceptionTableElement* handler = handlers + i; | 135 ExceptionTableElement* handler = handlers + i; |
119 Handle entry = instanceKlass::cast(ExceptionHandler::klass())->allocate_instance(CHECK_NULL); | 136 Handle entry = array->obj_at(i); |
137 assert(!entry.is_null(), "entry should not be null"); | |
120 ExceptionHandler::set_startBCI(entry, handler->start_pc); | 138 ExceptionHandler::set_startBCI(entry, handler->start_pc); |
121 ExceptionHandler::set_endBCI(entry, handler->end_pc); | 139 ExceptionHandler::set_endBCI(entry, handler->end_pc); |
122 ExceptionHandler::set_handlerBCI(entry, handler->handler_pc); | 140 ExceptionHandler::set_handlerBCI(entry, handler->handler_pc); |
123 int catch_class_index = handler->catch_type_index; | 141 int catch_class_index = handler->catch_type_index; |
124 ExceptionHandler::set_catchTypeCPI(entry, catch_class_index); | 142 ExceptionHandler::set_catchTypeCPI(entry, catch_class_index); |
125 | 143 |
126 if (catch_class_index == 0) { | 144 if (catch_class_index == 0) { |
127 ExceptionHandler::set_catchType(entry, NULL); | 145 ExceptionHandler::set_catchType(entry, NULL); |
128 } else { | 146 } else { |
129 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); | 147 ConstantPool* cp = InstanceKlass::cast(method->method_holder())->constants(); |
130 KlassHandle loading_klass = method->method_holder(); | 148 KlassHandle loading_klass = method->method_holder(); |
131 Handle catch_class = GraalCompiler::get_JavaType(cp, catch_class_index, loading_klass, CHECK_NULL); | 149 Handle catch_class = GraalCompiler::get_JavaType(cp, catch_class_index, loading_klass, CHECK_NULL); |
132 if (catch_class->klass() == HotSpotResolvedJavaType::klass() && java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { | 150 if (catch_class->klass() == HotSpotResolvedJavaType::klass() && java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { |
133 ExceptionHandler::set_catchType(entry, NULL); | 151 ExceptionHandler::set_catchType(entry, NULL); |
134 ExceptionHandler::set_catchTypeCPI(entry, 0); | 152 ExceptionHandler::set_catchTypeCPI(entry, 0); |
135 } else { | 153 } else { |
136 ExceptionHandler::set_catchType(entry, catch_class()); | 154 ExceptionHandler::set_catchType(entry, catch_class()); |
137 } | 155 } |
140 } | 158 } |
141 | 159 |
142 return (jobjectArray) JNIHandles::make_local(array()); | 160 return (jobjectArray) JNIHandles::make_local(array()); |
143 C2V_END | 161 C2V_END |
144 | 162 |
145 C2V_VMENTRY(jint, hasBalancedMonitors, (JNIEnv *, jobject, jobject hotspot_method)) | 163 C2V_VMENTRY(jint, hasBalancedMonitors, (JNIEnv *, jobject, jlong metaspace_method)) |
146 | 164 |
147 // Analyze the method to see if monitors are used properly. | 165 // Analyze the method to see if monitors are used properly. |
148 methodHandle method(THREAD, getMethodFromHotSpotMethod(hotspot_method)); | 166 methodHandle method(THREAD, asMethod(metaspace_method)); |
149 assert(method->has_monitor_bytecodes(), "should have checked this"); | 167 assert(method->has_monitor_bytecodes(), "should have checked this"); |
150 | 168 |
151 // Check to see if a previous compilation computed the monitor-matching analysis. | 169 // Check to see if a previous compilation computed the monitor-matching analysis. |
152 if (method->guaranteed_monitor_matching()) { | 170 if (method->guaranteed_monitor_matching()) { |
153 return true; | 171 return true; |
164 method->set_guaranteed_monitor_matching(); | 182 method->set_guaranteed_monitor_matching(); |
165 } | 183 } |
166 return true; | 184 return true; |
167 C2V_END | 185 C2V_END |
168 | 186 |
169 C2V_VMENTRY(jobject, getJavaMethod, (JNIEnv *, jobject, jobject reflection_method_handle)) | 187 C2V_VMENTRY(jlong, getMetaspaceMethod, (JNIEnv *, jobject, jobject reflection_method_handle, jobject resultHolder)) |
170 oop reflection_method = JNIHandles::resolve(reflection_method_handle); | 188 oop reflection_method = JNIHandles::resolve(reflection_method_handle); |
171 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); | 189 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); |
172 int slot = java_lang_reflect_Method::slot(reflection_method); | 190 int slot = java_lang_reflect_Method::slot(reflection_method); |
173 klassOop holder = java_lang_Class::as_klassOop(reflection_holder); | 191 Klass* holder = java_lang_Class::as_Klass(reflection_holder); |
174 methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot); | 192 methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot); |
175 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); | 193 Handle type = GraalCompiler::createHotSpotResolvedJavaType(method, CHECK_0); |
176 return JNIHandles::make_local(THREAD, ret()); | 194 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type()); |
195 return (jlong) (address) method(); | |
177 } | 196 } |
178 | 197 |
179 C2V_VMENTRY(jobject, getJavaField, (JNIEnv *, jobject, jobject reflection_field_handle)) | 198 C2V_VMENTRY(jobject, getJavaField, (JNIEnv *, jobject, jobject reflection_field_handle)) |
180 oop reflection_field = JNIHandles::resolve(reflection_field_handle); | 199 oop reflection_field = JNIHandles::resolve(reflection_field_handle); |
181 oop reflection_holder = java_lang_reflect_Field::clazz(reflection_field); | 200 oop reflection_holder = java_lang_reflect_Field::clazz(reflection_field); |
182 int slot = java_lang_reflect_Field::slot(reflection_field); | 201 int slot = java_lang_reflect_Field::slot(reflection_field); |
183 instanceKlass* holder = instanceKlass::cast(java_lang_Class::as_klassOop(reflection_holder)); | 202 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(reflection_holder)); |
184 | 203 |
185 int offset = holder->field_offset(slot); | 204 int offset = holder->field_offset(slot); |
186 int flags = holder->field_access_flags(slot); | 205 int flags = holder->field_access_flags(slot); |
187 Symbol* field_name = holder->field_name(slot); | 206 Symbol* field_name = holder->field_name(slot); |
188 Handle field_holder = GraalCompiler::get_JavaTypeFromClass(reflection_holder, CHECK_NULL); | 207 Handle field_holder = GraalCompiler::get_JavaTypeFromClass(reflection_holder, CHECK_NULL); |
190 | 209 |
191 Handle ret = GraalCompiler::get_JavaField(offset, flags, field_name, field_holder, field_type, CHECK_NULL); | 210 Handle ret = GraalCompiler::get_JavaField(offset, flags, field_name, field_holder, field_type, CHECK_NULL); |
192 return JNIHandles::make_local(THREAD, ret()); | 211 return JNIHandles::make_local(THREAD, ret()); |
193 } | 212 } |
194 | 213 |
195 C2V_VMENTRY(jobject, getUniqueConcreteMethod, (JNIEnv *, jobject, jobject hotspot_method)) | 214 C2V_VMENTRY(jlong, getUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_method, jobject resultHolder)) |
196 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 215 methodHandle method = asMethod(metaspace_method); |
197 KlassHandle holder = method->method_holder(); | 216 KlassHandle holder = method->method_holder(); |
198 if (holder->is_interface()) { | 217 if (holder->is_interface()) { |
199 // Cannot trust interfaces. Because of: | 218 // Cannot trust interfaces. Because of: |
200 // interface I { void foo(); } | 219 // interface I { void foo(); } |
201 // class A { public void foo() {} } | 220 // class A { public void foo() {} } |
202 // class B extends A implements I { } | 221 // class B extends A implements I { } |
203 // class C extends B { public void foo() { } } | 222 // class C extends B { public void foo() { } } |
204 // class D extends B { } | 223 // class D extends B { } |
205 // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo(). | 224 // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo(). |
206 return NULL; | 225 return 0L; |
207 } | 226 } |
208 methodHandle unique_concrete; | 227 methodHandle ucm; |
209 { | 228 { |
210 ResourceMark rm; | 229 ResourceMark rm; |
211 MutexLocker locker(Compile_lock); | 230 MutexLocker locker(Compile_lock); |
212 unique_concrete = Dependencies::find_unique_concrete_method(holder(), method()); | 231 ucm = Dependencies::find_unique_concrete_method(holder(), method()); |
213 } | 232 } |
214 if (unique_concrete.is_null()) { | 233 |
215 return NULL; | 234 if (ucm.is_null()) { |
216 } else { | 235 return 0L; |
217 Handle method_resolved = GraalCompiler::createHotSpotResolvedJavaMethod(unique_concrete, CHECK_NULL); | 236 } |
218 return JNIHandles::make_local(THREAD, method_resolved()); | 237 |
219 } | 238 Handle type = GraalCompiler::createHotSpotResolvedJavaType(ucm(), CHECK_0); |
220 C2V_END | 239 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type()); |
221 | 240 return (jlong) (address) ucm(); |
222 C2V_ENTRY(jint, getInvocationCount, (JNIEnv *, jobject, jobject hotspot_method)) | 241 C2V_END |
223 return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); | 242 |
224 C2V_END | 243 C2V_ENTRY(jint, getInvocationCount, (JNIEnv *, jobject, jlong metaspace_method)) |
225 | 244 Method* method = asMethod(metaspace_method); |
226 C2V_VMENTRY(jobject, getMethodData,(JNIEnv *, jobject, jobject hotspot_method)) | 245 return method->invocation_count(); |
227 | 246 C2V_END |
228 methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data(); | 247 |
229 if(method_data.is_null()) { | 248 C2V_VMENTRY(void, initializeMethod,(JNIEnv *, jobject, jlong metaspace_method, jobject hotspot_method)) |
230 return NULL; | 249 methodHandle method = asMethod(metaspace_method); |
231 } else { | 250 Handle name = VmIds::toString<Handle>(method->name(), CHECK); |
232 Handle graalMethodData = GraalCompiler::createHotSpotMethodData(method_data, CHECK_NULL); | 251 InstanceKlass::cast(HotSpotResolvedJavaMethod::klass())->initialize(CHECK); |
233 return JNIHandles::make_local(THREAD, graalMethodData()); | 252 HotSpotResolvedJavaMethod::set_name(hotspot_method, name()); |
234 } | 253 HotSpotResolvedJavaMethod::set_codeSize(hotspot_method, method->code_size()); |
254 HotSpotResolvedJavaMethod::set_exceptionHandlerCount(hotspot_method, method->exception_table_length()); | |
255 HotSpotResolvedJavaMethod::set_canBeInlined(hotspot_method, !method->is_not_compilable() && !CompilerOracle::should_not_inline(method)); | |
256 C2V_END | |
257 | |
258 C2V_VMENTRY(void, initializeMethodData,(JNIEnv *, jobject, jlong metaspace_method_data, jobject hotspot_method_data)) | |
259 MethodData* method_data = asMethodData(metaspace_method_data); | |
260 HotSpotMethodData::set_normalDataSize(hotspot_method_data, method_data->data_size()); | |
261 HotSpotMethodData::set_extraDataSize(hotspot_method_data, method_data->extra_data_size()); | |
235 C2V_END | 262 C2V_END |
236 | 263 |
237 // ------------------------------------------------------------------ | 264 // ------------------------------------------------------------------ |
238 // Adjust a CounterData count to be commensurate with | 265 // Adjust a CounterData count to be commensurate with |
239 // interpreter_invocation_count. If the MDO exists for | 266 // interpreter_invocation_count. If the MDO exists for |
240 // only 25% of the time the method exists, then the | 267 // only 25% of the time the method exists, then the |
241 // counts in the MDO should be scaled by 4X, so that | 268 // counts in the MDO should be scaled by 4X, so that |
242 // they can be usefully and stably compared against the | 269 // they can be usefully and stably compared against the |
243 // invocation counts in methods. | 270 // invocation counts in methods. |
244 int scale_count(methodDataOop method_data, int count) { | 271 int scale_count(MethodData* method_data, int count) { |
245 if (count > 0) { | 272 if (count > 0) { |
246 int counter_life; | 273 int counter_life; |
247 int method_life = method_data->method()->interpreter_invocation_count(); | 274 int method_life = method_data->method()->interpreter_invocation_count(); |
248 int current_mileage = methodDataOopDesc::mileage_of(method_data->method()); | 275 int current_mileage = MethodData::mileage_of(method_data->method()); |
249 int creation_mileage = method_data->creation_mileage(); | 276 int creation_mileage = method_data->creation_mileage(); |
250 counter_life = current_mileage - creation_mileage; | 277 counter_life = current_mileage - creation_mileage; |
251 | 278 |
252 // counter_life due to backedge_counter could be > method_life | 279 // counter_life due to backedge_counter could be > method_life |
253 if (counter_life > method_life) | 280 if (counter_life > method_life) |
258 } | 285 } |
259 } | 286 } |
260 return count; | 287 return count; |
261 } | 288 } |
262 | 289 |
263 C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jobject hotspot_method)) | 290 C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jlong metaspace_method)) |
264 nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); | 291 nmethod* code = (asMethod(metaspace_method))->code(); |
265 return code == NULL ? 0 : code->insts_size(); | 292 return code == NULL ? 0 : code->insts_size(); |
266 C2V_END | 293 C2V_END |
267 | 294 |
268 C2V_VMENTRY(jobject, lookupType, (JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve)) | 295 C2V_VMENTRY(jobject, lookupType, (JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve)) |
269 ResourceMark rm; | 296 ResourceMark rm; |
289 } else if (nameSymbol == vmSymbols::float_signature()) { | 316 } else if (nameSymbol == vmSymbols::float_signature()) { |
290 result = VMToCompiler::createPrimitiveJavaType((int) T_FLOAT, THREAD); | 317 result = VMToCompiler::createPrimitiveJavaType((int) T_FLOAT, THREAD); |
291 } else if (nameSymbol == vmSymbols::void_signature()) { | 318 } else if (nameSymbol == vmSymbols::void_signature()) { |
292 result = VMToCompiler::createPrimitiveJavaType((int) T_VOID, THREAD); | 319 result = VMToCompiler::createPrimitiveJavaType((int) T_VOID, THREAD); |
293 } else { | 320 } else { |
294 klassOop resolved_type = NULL; | 321 Klass* resolved_type = NULL; |
295 // if the name isn't in the symbol table then the class isn't loaded anyway... | 322 // if the name isn't in the symbol table then the class isn't loaded anyway... |
296 if (nameSymbol != NULL) { | 323 if (nameSymbol != NULL) { |
297 Handle classloader; | 324 Handle classloader; |
298 Handle protectionDomain; | 325 Handle protectionDomain; |
299 if (JNIHandles::resolve(accessingClass) != NULL) { | 326 if (JNIHandles::resolve(accessingClass) != NULL) { |
300 classloader = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->class_loader(); | 327 classloader = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(accessingClass))->class_loader(); |
301 protectionDomain = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->protection_domain(); | 328 protectionDomain = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(accessingClass))->protection_domain(); |
302 } | 329 } |
303 if (eagerResolve) { | 330 if (eagerResolve) { |
304 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); | 331 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); |
305 } else { | 332 } else { |
306 if (FieldType::is_obj(nameSymbol)) { | 333 if (FieldType::is_obj(nameSymbol)) { |
320 } | 347 } |
321 if (resolved_type != NULL) { | 348 if (resolved_type != NULL) { |
322 Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); | 349 Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); |
323 result = type(); | 350 result = type(); |
324 } else { | 351 } else { |
325 Handle type = VMToCompiler::createJavaType(name, THREAD); | 352 Handle type = VMToCompiler::createUnresolvedJavaType(name, THREAD); |
326 result = type(); | 353 result = type(); |
327 } | 354 } |
328 } | 355 } |
329 | 356 |
330 return JNIHandles::make_local(THREAD, result); | 357 return JNIHandles::make_local(THREAD, result); |
331 C2V_END | 358 C2V_END |
332 | 359 |
333 C2V_VMENTRY(jobject, lookupConstantInPool, (JNIEnv *env, jobject, jobject type, jint index)) | 360 C2V_VMENTRY(jobject, lookupConstantInPool, (JNIEnv *env, jobject, jobject type, jint index)) |
334 | 361 |
335 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); | 362 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
336 | 363 |
337 oop result = NULL; | 364 oop result = NULL; |
338 constantTag tag = cp->tag_at(index); | 365 constantTag tag = cp->tag_at(index); |
339 if (tag.is_int()) { | 366 if (tag.is_int()) { |
340 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_0); | 367 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_0); |
342 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_0); | 369 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_0); |
343 } else if (tag.is_float()) { | 370 } else if (tag.is_float()) { |
344 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_0); | 371 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_0); |
345 } else if (tag.is_double()) { | 372 } else if (tag.is_double()) { |
346 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_0); | 373 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_0); |
347 } else if (tag.is_string() || tag.is_unresolved_string()) { | 374 } else if (tag.is_string()) { |
348 oop string = NULL; | 375 oop string = NULL; |
349 if (cp->is_pseudo_string_at(index)) { | 376 if (cp->is_pseudo_string_at(index)) { |
350 string = cp->pseudo_string_at(index); | 377 int obj_index = cp->cp_to_object_index(index); |
378 string = cp->pseudo_string_at(index, obj_index); | |
351 } else { | 379 } else { |
352 string = cp->string_at(index, THREAD); | 380 string = cp->string_at(index, THREAD); |
353 if (HAS_PENDING_EXCEPTION) { | 381 if (HAS_PENDING_EXCEPTION) { |
354 CLEAR_PENDING_EXCEPTION; | 382 CLEAR_PENDING_EXCEPTION; |
355 // TODO: Gracefully exit compilation. | 383 // TODO: Gracefully exit compilation. |
364 } else if (tag.is_object()) { | 392 } else if (tag.is_object()) { |
365 oop obj = cp->object_at(index); | 393 oop obj = cp->object_at(index); |
366 assert(obj->is_instance(), "must be an instance"); | 394 assert(obj->is_instance(), "must be an instance"); |
367 result = VMToCompiler::createConstantObject(obj, CHECK_NULL); | 395 result = VMToCompiler::createConstantObject(obj, CHECK_NULL); |
368 } else { | 396 } else { |
397 tty->print("unknown constant pool tag at cpi %d in %s: ", index, cp->pool_holder()->name()->as_C_string()); | |
398 tag.print_on(tty); | |
369 ShouldNotReachHere(); | 399 ShouldNotReachHere(); |
370 } | 400 } |
371 | 401 |
372 return JNIHandles::make_local(THREAD, result); | 402 return JNIHandles::make_local(THREAD, result); |
373 C2V_END | 403 C2V_END |
374 | 404 |
375 C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode)) | 405 C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte opcode)) |
376 index = GraalCompiler::to_cp_index_u2(index); | 406 index = GraalCompiler::to_cp_index_u2(index); |
377 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); | 407 constantPoolHandle cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
378 instanceKlassHandle pool_holder(cp->pool_holder()); | 408 instanceKlassHandle pool_holder(cp->pool_holder()); |
379 | 409 |
380 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); | 410 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); |
381 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); | 411 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); |
382 if (!method.is_null()) { | 412 if (!method.is_null()) { |
383 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); | 413 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL); |
384 return JNIHandles::make_local(THREAD, ret()); | 414 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD)); |
385 } else { | 415 } else { |
386 // Get the method's name and signature. | 416 // Get the method's name and signature. |
387 Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL); | 417 Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL); |
388 Handle signature = VmIds::toString<Handle>(cp->signature_ref_at(index), CHECK_NULL); | 418 Handle signature = VmIds::toString<Handle>(cp->signature_ref_at(index), CHECK_NULL); |
389 int holder_index = cp->klass_ref_index_at(index); | 419 int holder_index = cp->klass_ref_index_at(index); |
390 Handle type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); | 420 Handle type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
391 return JNIHandles::make_local(THREAD, VMToCompiler::createJavaMethod(name, signature, type, THREAD)); | 421 return JNIHandles::make_local(THREAD, VMToCompiler::createUnresolvedJavaMethod(name, signature, type, THREAD)); |
392 } | 422 } |
393 C2V_END | 423 C2V_END |
394 | 424 |
395 C2V_VMENTRY(jobject, lookupTypeInPool, (JNIEnv *env, jobject, jobject type, jint index)) | 425 C2V_VMENTRY(jobject, lookupTypeInPool, (JNIEnv *env, jobject, jobject type, jint index)) |
396 | 426 |
397 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); | 427 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
398 Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); | 428 Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); |
399 return JNIHandles::make_local(THREAD, result()); | 429 return JNIHandles::make_local(THREAD, result()); |
400 C2V_END | 430 C2V_END |
401 | 431 |
402 C2V_VMENTRY(void, lookupReferencedTypeInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte op)) | 432 C2V_VMENTRY(void, lookupReferencedTypeInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte op)) |
403 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); | 433 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
404 int opcode = (op & 0xFF); | 434 int opcode = (op & 0xFF); |
405 if (opcode != Bytecodes::_checkcast && opcode != Bytecodes::_instanceof && opcode != Bytecodes::_new && opcode != Bytecodes::_anewarray | 435 if (opcode != Bytecodes::_checkcast && opcode != Bytecodes::_instanceof && opcode != Bytecodes::_new && opcode != Bytecodes::_anewarray |
406 && opcode != Bytecodes::_multianewarray && opcode != Bytecodes::_ldc && opcode != Bytecodes::_ldc_w && opcode != Bytecodes::_ldc2_w) | 436 && opcode != Bytecodes::_multianewarray && opcode != Bytecodes::_ldc && opcode != Bytecodes::_ldc_w && opcode != Bytecodes::_ldc2_w) |
407 { | 437 { |
408 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index)); | 438 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index)); |
412 index = cp->uncached_klass_ref_index_at(index); | 442 index = cp->uncached_klass_ref_index_at(index); |
413 tag = cp->tag_at(index); | 443 tag = cp->tag_at(index); |
414 } | 444 } |
415 | 445 |
416 if (tag.is_unresolved_klass() || tag.is_klass()) { | 446 if (tag.is_unresolved_klass() || tag.is_klass()) { |
417 klassOop klass = cp->klass_at(index, CHECK); | 447 Klass* klass = cp->klass_at(index, CHECK); |
418 if (klass->klass_part()->oop_is_instance()) { | 448 if (klass->oop_is_instance()) { |
419 instanceKlass::cast(klass)->initialize(CHECK); | 449 InstanceKlass::cast(klass)->initialize(CHECK); |
420 } | 450 } |
421 } | 451 } |
422 C2V_END | 452 C2V_END |
423 | 453 |
424 C2V_VMENTRY(jobject, lookupFieldInPool, (JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode)) | 454 C2V_VMENTRY(jobject, lookupFieldInPool, (JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte opcode)) |
425 ResourceMark rm; | 455 ResourceMark rm; |
426 | 456 |
427 index = GraalCompiler::to_cp_index_u2(index); | 457 index = GraalCompiler::to_cp_index_u2(index); |
428 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(constantPoolHolder)))->constants(); | 458 constantPoolHandle cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(constantPoolHolder)))->constants(); |
429 | 459 |
430 int nt_index = cp->name_and_type_ref_index_at(index); | 460 int nt_index = cp->name_and_type_ref_index_at(index); |
431 int sig_index = cp->signature_ref_index_at(nt_index); | 461 int sig_index = cp->signature_ref_index_at(nt_index); |
432 Symbol* signature = cp->symbol_at(sig_index); | 462 Symbol* signature = cp->symbol_at(sig_index); |
433 int name_index = cp->name_ref_index_at(nt_index); | 463 int name_index = cp->name_ref_index_at(nt_index); |
434 Symbol* name = cp->symbol_at(name_index); | 464 Symbol* name = cp->symbol_at(name_index); |
435 int holder_index = cp->klass_ref_index_at(index); | 465 int holder_index = cp->klass_ref_index_at(index); |
436 Handle holder = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); | 466 Handle holder = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
437 instanceKlassHandle holder_klass; | 467 instanceKlassHandle holder_klass; |
438 | 468 |
439 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); | 469 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF); |
440 int offset = -1; | 470 int offset = -1; |
441 AccessFlags flags; | 471 AccessFlags flags; |
442 BasicType basic_type; | 472 BasicType basic_type; |
443 if (holder->klass() == SystemDictionary::HotSpotResolvedJavaType_klass()) { | 473 if (holder->klass() == SystemDictionary::HotSpotResolvedJavaType_klass()) { |
444 FieldAccessInfo result; | 474 FieldAccessInfo result; |
448 if (HAS_PENDING_EXCEPTION) { | 478 if (HAS_PENDING_EXCEPTION) { |
449 CLEAR_PENDING_EXCEPTION; | 479 CLEAR_PENDING_EXCEPTION; |
450 } else { | 480 } else { |
451 offset = result.field_offset(); | 481 offset = result.field_offset(); |
452 flags = result.access_flags(); | 482 flags = result.access_flags(); |
453 holder_klass = result.klass()->as_klassOop(); | 483 holder_klass = result.klass()(); |
454 basic_type = result.field_type(); | 484 basic_type = result.field_type(); |
455 holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL); | 485 holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL); |
456 } | 486 } |
457 } | 487 } |
458 | 488 |
459 Handle type = GraalCompiler::get_JavaTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); | 489 Handle type = GraalCompiler::get_JavaTypeFromSignature(signature, cp->pool_holder(), CHECK_NULL); |
460 Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, THREAD); | 490 Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, THREAD); |
461 | 491 |
462 return JNIHandles::make_local(THREAD, field_handle()); | 492 return JNIHandles::make_local(THREAD, field_handle()); |
463 C2V_END | 493 C2V_END |
464 | 494 |
465 C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature)) | 495 C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature)) |
466 | 496 |
467 assert(JNIHandles::resolve(resolved_type) != NULL, ""); | 497 assert(JNIHandles::resolve(resolved_type) != NULL, ""); |
468 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(resolved_type)); | 498 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(resolved_type)); |
469 Symbol* name_symbol = VmIds::toSymbol(name); | 499 Symbol* name_symbol = VmIds::toSymbol(name); |
470 Symbol* signature_symbol = VmIds::toSymbol(signature); | 500 Symbol* signature_symbol = VmIds::toSymbol(signature); |
471 methodHandle method = klass->klass_part()->lookup_method(name_symbol, signature_symbol); | 501 methodHandle method = klass->lookup_method(name_symbol, signature_symbol); |
472 if (method == NULL) { | 502 if (method.is_null()) { |
473 if (TraceGraal >= 3) { | 503 if (TraceGraal >= 3) { |
474 ResourceMark rm; | 504 ResourceMark rm; |
475 tty->print_cr("Could not resolve method %s %s on klass %s", name_symbol->as_C_string(), signature_symbol->as_C_string(), klass->klass_part()->name()->as_C_string()); | 505 tty->print_cr("Could not resolve method %s %s on klass %s", name_symbol->as_C_string(), signature_symbol->as_C_string(), klass->name()->as_C_string()); |
476 } | 506 } |
477 return NULL; | 507 return NULL; |
478 } | 508 } |
479 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); | 509 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL); |
480 return JNIHandles::make_local(THREAD, ret()); | 510 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD)); |
481 C2V_END | 511 C2V_END |
482 | 512 |
483 C2V_VMENTRY(jboolean, isSubtypeOf, (JNIEnv *, jobject, jobject klass, jobject jother)) | 513 C2V_VMENTRY(jboolean, isSubtypeOf, (JNIEnv *, jobject, jobject klass, jobject jother)) |
484 oop other = JNIHandles::resolve(jother); | 514 oop other = JNIHandles::resolve(jother); |
485 assert(other->is_a(HotSpotResolvedJavaType::klass()), "resolved hotspot type expected"); | 515 assert(other->is_a(HotSpotResolvedJavaType::klass()), "resolved HotSpot type expected"); |
486 assert(JNIHandles::resolve(klass) != NULL, ""); | 516 assert(JNIHandles::resolve(klass) != NULL, ""); |
487 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); | 517 Klass* thisKlass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(klass)); |
488 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other)); | 518 Klass* otherKlass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(other)); |
489 if (thisKlass->klass_part()->oop_is_instance_slow()) { | 519 if (thisKlass->oop_is_instance()) { |
490 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); | 520 return InstanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
491 } else if (thisKlass->klass_part()->oop_is_array()) { | 521 } else if (thisKlass->oop_is_array()) { |
492 return arrayKlass::cast(thisKlass)->is_subtype_of(otherKlass); | 522 return ArrayKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
493 } else { | 523 } else { |
494 fatal("unexpected class type"); | 524 fatal("unexpected class type"); |
495 return false; | 525 return false; |
496 } | 526 } |
497 C2V_END | 527 C2V_END |
498 | 528 |
499 C2V_VMENTRY(jobject, getLeastCommonAncestor, (JNIEnv *, jobject, jobject this_type, jobject other_type)) | 529 C2V_VMENTRY(jobject, getLeastCommonAncestor, (JNIEnv *, jobject, jobject this_type, jobject other_type)) |
500 | 530 |
501 Klass* this_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(this_type))->klass_part(); | 531 Klass* this_klass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(this_type)); |
502 Klass* other_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other_type))->klass_part(); | 532 Klass* other_klass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(other_type)); |
503 Klass* lca = this_klass->LCA(other_klass); | 533 Klass* lca = this_klass->LCA(other_klass); |
504 | 534 |
505 return JNIHandles::make_local(GraalCompiler::get_JavaType(lca, THREAD)()); | 535 return JNIHandles::make_local(GraalCompiler::get_JavaType(lca, THREAD)()); |
506 C2V_END | 536 C2V_END |
507 | 537 |
508 C2V_VMENTRY(jobject, getComponentType, (JNIEnv *, jobject, jobject klass)) | 538 C2V_VMENTRY(jobject, getComponentType, (JNIEnv *, jobject, jobject klass)) |
509 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); | 539 KlassHandle array_klass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(klass)); |
510 if(array_klass->oop_is_typeArray()) { | 540 if(array_klass->oop_is_typeArray()) { |
511 BasicType t = typeArrayKlass::cast(array_klass())->element_type(); | 541 BasicType t = TypeArrayKlass::cast(array_klass())->element_type(); |
512 oop primitive_type = VMToCompiler::createPrimitiveJavaType((int) t, CHECK_NULL); | 542 oop primitive_type = VMToCompiler::createPrimitiveJavaType((int) t, CHECK_NULL); |
513 return JNIHandles::make_local(primitive_type); | 543 return JNIHandles::make_local(primitive_type); |
514 } | 544 } |
515 assert(array_klass->oop_is_objArray(), "just checking"); | 545 assert(array_klass->oop_is_objArray(), "just checking"); |
516 klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); | 546 Klass* element_type = ObjArrayKlass::cast(array_klass())->element_klass(); |
517 assert(JNIHandles::resolve(klass) != NULL, ""); | 547 assert(JNIHandles::resolve(klass) != NULL, ""); |
518 return JNIHandles::make_local(GraalCompiler::get_JavaType(element_type, THREAD)()); | 548 return JNIHandles::make_local(GraalCompiler::get_JavaType(element_type, THREAD)()); |
519 C2V_END | 549 C2V_END |
520 | 550 |
521 C2V_VMENTRY(jlong, getPrototypeMarkWord, (JNIEnv *, jobject, jobject klass)) | 551 C2V_VMENTRY(jlong, getPrototypeMarkWord, (JNIEnv *, jobject, jobject klass)) |
522 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); | 552 KlassHandle klass_handle(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(klass))); |
523 if (klass_handle->oop_is_array()) { | 553 if (klass_handle->oop_is_array()) { |
524 return (int32_t)(intptr_t) markOopDesc::prototype(); | 554 return (int32_t)(intptr_t) markOopDesc::prototype(); |
525 } else { | 555 } else { |
526 return (jlong) (intptr_t) klass_handle->prototype_header(); | 556 return (jlong) (intptr_t) klass_handle->prototype_header(); |
527 } | 557 } |
528 C2V_END | 558 C2V_END |
529 | 559 |
530 C2V_VMENTRY(jobject, getSuperType, (JNIEnv *, jobject, jobject klass)) | 560 C2V_VMENTRY(jobject, getSuperType, (JNIEnv *, jobject, jlong metaspace_klass)) |
531 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); | 561 KlassHandle klass_handle(asKlass(metaspace_klass)); |
532 klassOop k; | 562 Klass* k; |
533 | 563 |
534 if (klass_handle->oop_is_array()) { | 564 if (klass_handle->oop_is_array()) { |
535 k = SystemDictionary::Object_klass(); | 565 k = SystemDictionary::Object_klass(); |
536 } else { | 566 } else { |
537 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); | 567 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); |
544 return NULL; | 574 return NULL; |
545 } | 575 } |
546 C2V_END | 576 C2V_END |
547 | 577 |
548 C2V_VMENTRY(jobject, getUniqueConcreteSubtype, (JNIEnv *, jobject, jobject klass)) | 578 C2V_VMENTRY(jobject, getUniqueConcreteSubtype, (JNIEnv *, jobject, jobject klass)) |
549 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); | 579 KlassHandle klass_handle(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(klass))); |
550 Klass *up_cast = klass_handle->up_cast_abstract(); | 580 Klass *up_cast = klass_handle->up_cast_abstract(); |
551 if (!up_cast->is_interface() && up_cast->subklass() == NULL) { | 581 if (!up_cast->is_interface() && up_cast->subklass() == NULL) { |
552 return JNIHandles::make_local(GraalCompiler::get_JavaType(up_cast, THREAD)()); | 582 return JNIHandles::make_local(GraalCompiler::get_JavaType(up_cast, THREAD)()); |
553 } | 583 } |
554 return NULL; | 584 return NULL; |
555 C2V_END | 585 C2V_END |
556 | 586 |
557 C2V_VMENTRY(jboolean, isTypeInitialized,(JNIEnv *, jobject, jobject hotspot_klass)) | 587 C2V_VMENTRY(jboolean, isTypeInitialized,(JNIEnv *, jobject, jobject hotspot_klass)) |
558 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); | 588 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); |
559 assert(klass != NULL, "method must not be called for primitive types"); | 589 assert(klass != NULL, "method must not be called for primitive types"); |
560 return instanceKlass::cast(klass)->is_initialized(); | 590 return InstanceKlass::cast(klass)->is_initialized(); |
561 C2V_END | 591 C2V_END |
562 | 592 |
563 C2V_VMENTRY(void, initializeType, (JNIEnv *, jobject, jobject hotspot_klass)) | 593 C2V_VMENTRY(void, initializeType, (JNIEnv *, jobject, jobject hotspot_klass)) |
564 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); | 594 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); |
565 assert(klass != NULL, "method must not be called for primitive types"); | 595 assert(klass != NULL, "method must not be called for primitive types"); |
566 instanceKlass::cast(klass)->initialize(JavaThread::current()); | 596 InstanceKlass::cast(klass)->initialize(JavaThread::current()); |
567 C2V_END | 597 C2V_END |
568 | 598 |
569 C2V_VMENTRY(jobject, getArrayOf, (JNIEnv *, jobject, jobject klass)) | 599 C2V_VMENTRY(jobject, getArrayOf, (JNIEnv *, jobject, jobject klass)) |
570 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); | 600 KlassHandle klass_handle(java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(klass))); |
571 KlassHandle arr = klass_handle->array_klass(THREAD); | 601 KlassHandle arr = klass_handle->array_klass(THREAD); |
572 Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); | 602 Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); |
573 assert(arr->oop_is_array(), ""); | 603 assert(arr->oop_is_array(), ""); |
574 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotResolvedJavaType(arr, name, THREAD)()); | 604 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotResolvedJavaType(arr, name, THREAD)()); |
575 C2V_END | 605 C2V_END |
576 | 606 |
577 C2V_VMENTRY(jobject, getFields, (JNIEnv *, jobject, jobject klass)) | 607 C2V_VMENTRY(jobject, getInstanceFields, (JNIEnv *, jobject, jobject klass)) |
578 ResourceMark rm; | 608 ResourceMark rm; |
579 | 609 |
580 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); | 610 instanceKlassHandle k = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(klass)); |
581 class MyFieldClosure : public FieldClosure { | 611 GrowableArray<Handle> fields(k->java_fields_count()); |
582 public: | 612 |
583 instanceKlassHandle _holder; | 613 for (AllFieldStream fs(k()); !fs.done(); fs.next()) { |
584 Handle _resolved_type_holder; | 614 if (!fs.access_flags().is_static()) { |
585 GrowableArray<Handle> _field_array; | 615 Handle type = GraalCompiler::get_JavaTypeFromSignature(fs.signature(), k, Thread::current()); |
586 | 616 int flags = fs.access_flags().as_int(); |
587 MyFieldClosure(instanceKlassHandle& holder, Handle resolved_type_holder) : _holder(holder), _resolved_type_holder(resolved_type_holder) { } | 617 bool internal = fs.access_flags().is_internal(); |
588 | 618 Handle name = VmIds::toString<Handle>(fs.name(), Thread::current()); |
589 virtual void do_field(fieldDescriptor* fd) { | 619 Handle field = VMToCompiler::createJavaField(JNIHandles::resolve(klass), name, type, fs.offset(), flags, internal, Thread::current()); |
590 if (!Thread::current()->has_pending_exception()) { | 620 fields.append(field()); |
591 if (fd->field_holder() == _holder()) { | 621 } |
592 Handle type = GraalCompiler::get_JavaTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); | 622 } |
593 Handle field = VMToCompiler::createJavaField(_resolved_type_holder, VmIds::toString<Handle>(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); | 623 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::HotSpotResolvedJavaField_klass(), fields.length(), CHECK_NULL); |
594 _field_array.append(field()); | 624 for (int i = 0; i < fields.length(); ++i) { |
595 } | 625 field_array->obj_at_put(i, fields.at(i)()); |
596 } | |
597 } | |
598 }; | |
599 MyFieldClosure closure(k, JNIHandles::resolve(klass)); | |
600 k->do_nonstatic_fields(&closure); | |
601 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::ResolvedJavaField_klass(), closure._field_array.length(), CHECK_NULL); | |
602 for (int i=0; i<closure._field_array.length(); ++i) { | |
603 field_array->obj_at_put(i, closure._field_array.at(i)()); | |
604 } | 626 } |
605 return JNIHandles::make_local(field_array()); | 627 return JNIHandles::make_local(field_array()); |
606 C2V_END | 628 C2V_END |
607 | 629 |
608 C2V_VMENTRY(jobject, getPrimitiveArrayType, (JNIEnv *env, jobject, jobject kind)) | 630 C2V_VMENTRY(jobject, getPrimitiveArrayType, (JNIEnv *env, jobject, jobject kind)) |
657 | 679 |
658 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; | 680 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; |
659 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); | 681 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); |
660 | 682 |
661 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) | 683 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) |
662 if (JavaThread::current()->thread_state() != _thread_in_native) { | |
663 tty->print_cr("thread state: %d", JavaThread::current()->thread_state()); | |
664 } | |
665 #ifdef _WIN64 | 684 #ifdef _WIN64 |
666 set_boolean(env, config, "windowsOs", true); | 685 set_boolean(env, config, "windowsOs", true); |
667 #else | 686 #else |
668 set_boolean(env, config, "windowsOs", false); | 687 set_boolean(env, config, "windowsOs", false); |
669 #endif | 688 #endif |
681 set_int(env, config, "prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset())); | 700 set_int(env, config, "prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset())); |
682 set_int(env, config, "superCheckOffsetOffset", in_bytes(Klass::super_check_offset_offset())); | 701 set_int(env, config, "superCheckOffsetOffset", in_bytes(Klass::super_check_offset_offset())); |
683 set_int(env, config, "secondarySuperCacheOffset", in_bytes(Klass::secondary_super_cache_offset())); | 702 set_int(env, config, "secondarySuperCacheOffset", in_bytes(Klass::secondary_super_cache_offset())); |
684 set_int(env, config, "secondarySupersOffset", in_bytes(Klass::secondary_supers_offset())); | 703 set_int(env, config, "secondarySupersOffset", in_bytes(Klass::secondary_supers_offset())); |
685 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); | 704 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); |
686 set_int(env, config, "klassStateOffset", in_bytes(instanceKlass::init_state_offset())); | 705 set_int(env, config, "klassStateOffset", in_bytes(InstanceKlass::init_state_offset())); |
687 set_int(env, config, "klassStateFullyInitialized", (int)instanceKlass::fully_initialized); | 706 set_int(env, config, "klassStateFullyInitialized", (int)InstanceKlass::fully_initialized); |
688 set_int(env, config, "threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset())); | 707 set_int(env, config, "threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset())); |
689 set_int(env, config, "threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset())); | 708 set_int(env, config, "threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset())); |
690 set_int(env, config, "threadObjectOffset", in_bytes(JavaThread::threadObj_offset())); | 709 set_int(env, config, "threadObjectOffset", in_bytes(JavaThread::threadObj_offset())); |
691 set_int(env, config, "unlockedMask", (int) markOopDesc::unlocked_value); | 710 set_int(env, config, "unlockedMask", (int) markOopDesc::unlocked_value); |
692 set_int(env, config, "biasedLockMaskInPlace", (int) markOopDesc::biased_lock_mask_in_place); | 711 set_int(env, config, "biasedLockMaskInPlace", (int) markOopDesc::biased_lock_mask_in_place); |
693 set_int(env, config, "ageMaskInPlace", (int) markOopDesc::age_mask_in_place); | 712 set_int(env, config, "ageMaskInPlace", (int) markOopDesc::age_mask_in_place); |
694 set_int(env, config, "epochMaskInPlace", (int) markOopDesc::epoch_mask_in_place); | 713 set_int(env, config, "epochMaskInPlace", (int) markOopDesc::epoch_mask_in_place); |
695 set_int(env, config, "biasedLockPattern", (int) markOopDesc::biased_lock_pattern); | 714 set_int(env, config, "biasedLockPattern", (int) markOopDesc::biased_lock_pattern); |
715 set_int(env, config, "methodMaxLocalsOffset", in_bytes(Method::size_of_locals_offset())); | |
716 set_int(env, config, "methodMaxStackOffset", in_bytes(Method::max_stack_offset())); | |
717 set_int(env, config, "extraStackEntries", Method::extra_stack_entries()); | |
718 set_int(env, config, "methodAccessFlagsOffset", in_bytes(Method::access_flags_offset())); | |
719 set_int(env, config, "klassHasFinalizerFlag", JVM_ACC_HAS_FINALIZER); | |
696 set_int(env, config, "threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset())); | 720 set_int(env, config, "threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset())); |
697 set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); | 721 set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); |
698 set_int(env, config, "threadMultiNewArrayStorageOffset", in_bytes(JavaThread::graal_multinewarray_storage_offset())); | |
699 set_long(env, config, "safepointPollingAddress", (jlong)(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()))); | 722 set_long(env, config, "safepointPollingAddress", (jlong)(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()))); |
700 set_boolean(env, config, "isPollingPageFar", Assembler::is_polling_page_far()); | 723 set_boolean(env, config, "isPollingPageFar", Assembler::is_polling_page_far()); |
701 set_int(env, config, "classMirrorOffset", in_bytes(Klass::java_mirror_offset())); | 724 set_int(env, config, "classMirrorOffset", in_bytes(Klass::java_mirror_offset())); |
702 set_int(env, config, "runtimeCallStackSize", (jint)frame::arg_reg_save_area_bytes); | 725 set_int(env, config, "runtimeCallStackSize", (jint)frame::arg_reg_save_area_bytes); |
703 set_int(env, config, "klassModifierFlagsOffset", in_bytes(Klass::modifier_flags_offset())); | 726 set_int(env, config, "klassModifierFlagsOffset", in_bytes(Klass::modifier_flags_offset())); |
704 set_int(env, config, "klassOopOffset", java_lang_Class::klass_offset_in_bytes()); | 727 set_int(env, config, "klassAccessFlagsOffset", in_bytes(Klass::access_flags_offset())); |
705 set_int(env, config, "graalMirrorKlassOffset", in_bytes(Klass::graal_mirror_offset())); | 728 set_int(env, config, "klassOffset", java_lang_Class::klass_offset_in_bytes()); |
729 set_int(env, config, "graalMirrorInClassOffset", java_lang_Class::graal_mirror_offset_in_bytes()); | |
730 set_int(env, config, "methodDataOffset", in_bytes(Method::method_data_offset())); | |
706 set_int(env, config, "nmethodEntryOffset", nmethod::verified_entry_point_offset()); | 731 set_int(env, config, "nmethodEntryOffset", nmethod::verified_entry_point_offset()); |
707 set_int(env, config, "methodCompiledEntryOffset", in_bytes(methodOopDesc::from_compiled_offset())); | 732 set_int(env, config, "methodCompiledEntryOffset", in_bytes(Method::from_compiled_offset())); |
708 set_int(env, config, "basicLockSize", sizeof(BasicLock)); | 733 set_int(env, config, "basicLockSize", sizeof(BasicLock)); |
709 set_int(env, config, "basicLockDisplacedHeaderOffset", BasicLock::displaced_header_offset_in_bytes()); | 734 set_int(env, config, "basicLockDisplacedHeaderOffset", BasicLock::displaced_header_offset_in_bytes()); |
710 | 735 |
711 set_int(env, config, "methodDataOopDataOffset", in_bytes(methodDataOopDesc::data_offset())); | 736 set_int(env, config, "metaspaceArrayLengthOffset", Array<Klass*>::length_offset_in_bytes()); |
712 set_int(env, config, "methodDataOopTrapHistoryOffset", in_bytes(methodDataOopDesc::trap_history_offset())); | 737 set_int(env, config, "metaspaceArrayBaseOffset", Array<Klass*>::base_offset_in_bytes()); |
738 set_int(env, config, "methodDataOopDataOffset", in_bytes(MethodData::data_offset())); | |
739 set_int(env, config, "methodDataOopTrapHistoryOffset", in_bytes(MethodData::trap_history_offset())); | |
713 set_int(env, config, "dataLayoutHeaderSize", DataLayout::header_size_in_bytes()); | 740 set_int(env, config, "dataLayoutHeaderSize", DataLayout::header_size_in_bytes()); |
714 set_int(env, config, "dataLayoutTagOffset", in_bytes(DataLayout::tag_offset())); | 741 set_int(env, config, "dataLayoutTagOffset", in_bytes(DataLayout::tag_offset())); |
715 set_int(env, config, "dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset())); | 742 set_int(env, config, "dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset())); |
716 set_int(env, config, "dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset())); | 743 set_int(env, config, "dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset())); |
717 set_int(env, config, "dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0))); | 744 set_int(env, config, "dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0))); |
750 set_long(env, config, "arithmeticDremStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_arithmetic_drem_id))); | 777 set_long(env, config, "arithmeticDremStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_arithmetic_drem_id))); |
751 set_long(env, config, "arithmeticSinStub", VmIds::addStub(CAST_FROM_FN_PTR(address, SharedRuntime::dsin))); | 778 set_long(env, config, "arithmeticSinStub", VmIds::addStub(CAST_FROM_FN_PTR(address, SharedRuntime::dsin))); |
752 set_long(env, config, "arithmeticCosStub", VmIds::addStub(CAST_FROM_FN_PTR(address, SharedRuntime::dcos))); | 779 set_long(env, config, "arithmeticCosStub", VmIds::addStub(CAST_FROM_FN_PTR(address, SharedRuntime::dcos))); |
753 set_long(env, config, "arithmeticTanStub", VmIds::addStub(CAST_FROM_FN_PTR(address, SharedRuntime::dtan))); | 780 set_long(env, config, "arithmeticTanStub", VmIds::addStub(CAST_FROM_FN_PTR(address, SharedRuntime::dtan))); |
754 set_long(env, config, "logPrimitiveStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_log_primitive_id))); | 781 set_long(env, config, "logPrimitiveStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_log_primitive_id))); |
755 set_long(env, config, "logObjectStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_log_printf_id))); | 782 set_long(env, config, "logObjectStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_log_object_id))); |
756 set_long(env, config, "logPrintfStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_log_object_id))); | 783 set_long(env, config, "logPrintfStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_log_printf_id))); |
757 | 784 |
758 | 785 |
759 BarrierSet* bs = Universe::heap()->barrier_set(); | 786 BarrierSet* bs = Universe::heap()->barrier_set(); |
760 switch (bs->kind()) { | 787 switch (bs->kind()) { |
761 case BarrierSet::CardTableModRef: | 788 case BarrierSet::CardTableModRef: |
779 default: | 806 default: |
780 ShouldNotReachHere(); | 807 ShouldNotReachHere(); |
781 break; | 808 break; |
782 } | 809 } |
783 | 810 |
784 set_int(env, config, "arrayClassElementOffset", in_bytes(objArrayKlass::element_klass_offset())); | 811 set_int(env, config, "arrayClassElementOffset", in_bytes(ObjArrayKlass::element_klass_offset())); |
785 C2V_END | 812 C2V_END |
786 | 813 |
787 C2V_VMENTRY(jobject, installMethod, (JNIEnv *jniEnv, jobject, jobject compResult, jboolean install_code, jobject info)) | 814 C2V_VMENTRY(jobject, installCode, (JNIEnv *jniEnv, jobject, jobject compResult, jobject installed_code, jobject info)) |
788 ResourceMark rm; | 815 ResourceMark rm; |
789 HandleMark hm; | 816 HandleMark hm; |
790 Handle compResultHandle = JNIHandles::resolve(compResult); | 817 Handle compResultHandle = JNIHandles::resolve(compResult); |
791 nmethod* nm = NULL; | 818 nmethod* nm = NULL; |
819 methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(compResult)); | |
792 Arena arena; | 820 Arena arena; |
793 ciEnv env(&arena); | 821 ciEnv env(&arena); |
794 CodeInstaller installer(compResultHandle, nm, install_code != 0); | 822 bool bind_to_method = installed_code == NULL; |
823 CodeInstaller installer(compResultHandle, method, nm, bind_to_method); | |
795 | 824 |
796 if (info != NULL) { | 825 if (info != NULL) { |
797 arrayOop codeCopy = oopFactory::new_byteArray(nm->code_size(), CHECK_0); | 826 arrayOop codeCopy = oopFactory::new_byteArray(nm->code_size(), CHECK_0); |
798 memcpy(codeCopy->base(T_BYTE), nm->code_begin(), nm->code_size()); | 827 memcpy(codeCopy->base(T_BYTE), nm->code_begin(), nm->code_size()); |
799 HotSpotCodeInfo::set_code(info, codeCopy); | 828 HotSpotCodeInfo::set_code(info, codeCopy); |
800 HotSpotCodeInfo::set_start(info, (jlong) nm->code_begin()); | 829 HotSpotCodeInfo::set_start(info, (jlong) nm->code_begin()); |
801 } | 830 } |
802 | 831 |
803 // if install_code is true then we installed the code into the given method, no need to return an InstalledCode | 832 if (installed_code != NULL && nm != NULL) { |
804 if (!install_code && nm != NULL) { | 833 Handle obj = JNIHandles::resolve(installed_code); |
805 instanceKlass::cast(HotSpotCompiledMethod::klass())->initialize(CHECK_NULL); | 834 assert(obj->is_a(HotSpotInstalledCode::klass()), "wrong type"); |
806 Handle obj = instanceKlass::cast(HotSpotCompiledMethod::klass())->allocate_permanent_instance(CHECK_NULL); | 835 HotSpotInstalledCode::set_nmethod(obj, (jlong) nm); |
807 assert(obj() != NULL, "must succeed in allocating instance"); | 836 HotSpotInstalledCode::set_method(obj, HotSpotCompilationResult::method(compResult)); |
808 HotSpotCompiledMethod::set_nmethod(obj, (jlong) nm); | 837 nm->set_graal_installed_code(obj()); |
809 HotSpotCompiledMethod::set_method(obj, HotSpotCompilationResult::method(compResult)); | 838 assert(nm->graal_installed_code() == obj(), "must be"); |
810 nm->set_graal_compiled_method(obj()); | 839 if (!nm->on_scavenge_root_list()) { |
840 // Since the nmethod now contains a normal oop (i.e. installed_code) it must | |
841 // be on the list of nmethods scavenged for oops. | |
842 // Must hold the code cache lock when adding to the scavenger list | |
843 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
844 CodeCache::add_scavenge_root_nmethod(nm); | |
845 assert(nm->on_scavenge_root_list(), "must be"); | |
846 } | |
811 return JNIHandles::make_local(obj()); | 847 return JNIHandles::make_local(obj()); |
812 } else { | 848 } else { |
813 return NULL; | 849 return NULL; |
814 } | 850 } |
815 C2V_END | 851 C2V_END |
827 | 863 |
828 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); | 864 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
829 return JNIHandles::make_local(result()); | 865 return JNIHandles::make_local(result()); |
830 C2V_END | 866 C2V_END |
831 | 867 |
832 C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv *env, jobject, jobject hotspot_method, int bci)) | 868 C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv *env, jobject, jlong metaspace_method, int bci)) |
833 ResourceMark rm; | 869 ResourceMark rm; |
834 HandleMark hm; | 870 HandleMark hm; |
835 | 871 |
836 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 872 methodHandle method = asMethod(metaspace_method); |
837 oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); | 873 oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); |
838 return JNIHandles::make_local(element); | 874 return JNIHandles::make_local(element); |
839 C2V_END | 875 C2V_END |
840 | 876 |
841 C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv *env, jobject, jobject method, jobject args)) | 877 C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv *env, jobject, jlong metaspace_method, jlong metaspace_nmethod, jobject args)) |
842 ResourceMark rm; | 878 ResourceMark rm; |
843 HandleMark hm; | 879 HandleMark hm; |
844 | 880 |
845 assert(method != NULL, "just checking"); | 881 assert(metaspace_method != 0, "just checking"); |
846 methodHandle mh = getMethodFromHotSpotMethod(HotSpotCompiledMethod::method(method)); | 882 methodHandle mh = asMethod(metaspace_method); |
847 Symbol* signature = mh->signature(); | 883 Symbol* signature = mh->signature(); |
848 JavaCallArguments jca; | 884 JavaCallArguments jca; |
849 | 885 |
850 JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); | 886 JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
851 JavaValue result(jap.get_ret_type()); | 887 JavaValue result(jap.get_ret_type()); |
852 | 888 |
853 nmethod* nm = (nmethod*) HotSpotCompiledMethod::nmethod(method); | 889 nmethod* nm = (nmethod*) (address) metaspace_nmethod; |
854 if (nm == NULL || !nm->is_alive()) { | 890 if (nm == NULL || !nm->is_alive()) { |
855 THROW_0(vmSymbols::MethodInvalidatedException()); | 891 THROW_0(vmSymbols::MethodInvalidatedException()); |
856 } | 892 } |
857 | 893 |
858 JavaCalls::call(&result, mh, nm, &jca, CHECK_NULL); | 894 JavaCalls::call(&result, mh, nm, &jca, CHECK_NULL); |
865 oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); | 901 oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); |
866 return JNIHandles::make_local(o); | 902 return JNIHandles::make_local(o); |
867 } | 903 } |
868 C2V_END | 904 C2V_END |
869 | 905 |
870 C2V_VMENTRY(jobject, executeCompiledMethod, (JNIEnv *env, jobject, jobject method, jobject arg1, jobject arg2, jobject arg3)) | 906 C2V_VMENTRY(jobject, executeCompiledMethod, (JNIEnv *env, jobject, jlong metaspace_method, jlong metaspace_nmethod, jobject arg1, jobject arg2, jobject arg3)) |
871 ResourceMark rm; | 907 ResourceMark rm; |
872 HandleMark hm; | 908 HandleMark hm; |
873 | 909 |
874 methodHandle actualMethod = getMethodFromHotSpotMethod(HotSpotCompiledMethod::method(method)); | 910 methodHandle method = asMethod(metaspace_method); |
875 assert(method != NULL, "just checking"); | 911 assert(!method.is_null(), "just checking"); |
876 JavaValue result(T_OBJECT); | 912 JavaValue result(T_OBJECT); |
877 JavaCallArguments args; | 913 JavaCallArguments args; |
878 args.push_oop(JNIHandles::resolve(arg1)); | 914 args.push_oop(JNIHandles::resolve(arg1)); |
879 args.push_oop(JNIHandles::resolve(arg2)); | 915 args.push_oop(JNIHandles::resolve(arg2)); |
880 args.push_oop(JNIHandles::resolve(arg3)); | 916 args.push_oop(JNIHandles::resolve(arg3)); |
881 | 917 |
882 nmethod* nm = (nmethod*) HotSpotCompiledMethod::nmethod(method); | 918 nmethod* nm = (nmethod*) (address) metaspace_nmethod; |
883 if (nm == NULL || !nm->is_alive()) { | 919 if (nm == NULL || !nm->is_alive()) { |
884 THROW_0(vmSymbols::MethodInvalidatedException()); | 920 THROW_0(vmSymbols::MethodInvalidatedException()); |
885 } | 921 } |
886 | 922 |
887 JavaCalls::call(&result, actualMethod, nm, &args, CHECK_NULL); | 923 JavaCalls::call(&result, method, nm, &args, CHECK_NULL); |
888 | 924 |
889 return JNIHandles::make_local((oop) result.get_jobject()); | 925 return JNIHandles::make_local((oop) result.get_jobject()); |
890 C2V_END | 926 C2V_END |
891 | 927 |
892 C2V_VMENTRY(jint, getVtableEntryOffset, (JNIEnv *, jobject, jobject hotspot_method)) | 928 C2V_VMENTRY(jint, getVtableEntryOffset, (JNIEnv *, jobject, jlong metaspace_method)) |
893 | 929 |
894 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | 930 Method* method = asMethod(metaspace_method); |
895 assert(!instanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); | 931 assert(!InstanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); |
896 assert(instanceKlass::cast(method->method_holder())->is_linked(), "vtableEntryOffset cannot be called is holder is not linked"); | 932 assert(InstanceKlass::cast(method->method_holder())->is_linked(), "vtableEntryOffset cannot be called is holder is not linked"); |
897 | 933 |
898 // get entry offset in words | 934 // get entry offset in words |
899 int vtable_entry_offset = instanceKlass::vtable_start_offset() + method->vtable_index() * vtableEntry::size(); | 935 int vtable_entry_offset = InstanceKlass::vtable_start_offset() + method->vtable_index() * vtableEntry::size(); |
900 // convert to bytes | 936 // convert to bytes |
901 vtable_entry_offset = vtable_entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); | 937 vtable_entry_offset = vtable_entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); |
902 | 938 |
903 return vtable_entry_offset; | 939 return vtable_entry_offset; |
904 C2V_END | 940 C2V_END |
922 } else { | 958 } else { |
923 st.print(blob->name()); | 959 st.print(blob->name()); |
924 | 960 |
925 nmethod* nm = blob->as_nmethod_or_null(); | 961 nmethod* nm = blob->as_nmethod_or_null(); |
926 if (nm != NULL && nm->method() != NULL) { | 962 if (nm != NULL && nm->method() != NULL) { |
927 st.print(" %s.", nm->method()->method_holder()->klass_part()->external_name()); | 963 st.print(" %s.", nm->method()->method_holder()->external_name()); |
928 nm->method()->name()->print_symbol_on(&st); | 964 nm->method()->name()->print_symbol_on(&st); |
929 st.print(" @ %d", pc - (jlong) nm->entry_point()); | 965 st.print(" @ %d", pc - (jlong) nm->entry_point()); |
930 } | 966 } |
931 } | 967 } |
932 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); | 968 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
935 | 971 |
936 | 972 |
937 #define CC (char*) /*cast a literal from (const char*)*/ | 973 #define CC (char*) /*cast a literal from (const char*)*/ |
938 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) | 974 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) |
939 | 975 |
940 #define PROXY "J" | 976 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" |
941 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" | 977 #define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;" |
942 #define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;" | 978 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" |
943 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" | 979 #define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;" |
944 #define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;" | 980 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" |
945 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" | 981 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" |
946 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" | 982 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" |
947 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" | 983 #define RESOLVED_FIELD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaField;" |
948 #define RESOLVED_FIELD "Lcom/oracle/graal/api/meta/ResolvedJavaField;" | 984 #define REFLECT_FIELD "Ljava/lang/reflect/Field;" |
949 #define REFLECT_FIELD "Ljava/lang/reflect/Field;" | 985 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" |
950 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" | 986 #define EXCEPTION_HANDLERS "[Lcom/oracle/graal/api/meta/ExceptionHandler;" |
951 #define EXCEPTION_HANDLERS "[Lcom/oracle/graal/api/meta/ExceptionHandler;" | 987 #define HS_COMP_RESULT "Lcom/oracle/graal/hotspot/HotSpotCompilationResult;" |
952 #define HS_COMP_RESULT "Lcom/oracle/graal/hotspot/HotSpotCompilationResult;" | 988 #define CONFIG "Lcom/oracle/graal/hotspot/HotSpotVMConfig;" |
953 #define CONFIG "Lcom/oracle/graal/hotspot/HotSpotVMConfig;" | 989 #define HS_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethod;" |
954 #define HS_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethod;" | 990 #define HS_INSTALLED_CODE "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;" |
955 #define HS_COMP_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotCompiledMethod;" | 991 #define HS_CODE_INFO "Lcom/oracle/graal/hotspot/meta/HotSpotCodeInfo;" |
956 #define HS_CODE_INFO "Lcom/oracle/graal/hotspot/meta/HotSpotCodeInfo;" | 992 #define METHOD_DATA "Lcom/oracle/graal/hotspot/meta/HotSpotMethodData;" |
957 #define METHOD_DATA "Lcom/oracle/graal/hotspot/meta/HotSpotMethodData;" | 993 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;" |
958 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;" | 994 #define KIND "Lcom/oracle/graal/api/meta/Kind;" |
959 #define KIND "Lcom/oracle/graal/api/meta/Kind;" | 995 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;" |
960 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;" | 996 #define STRING "Ljava/lang/String;" |
961 #define STRING "Ljava/lang/String;" | 997 #define OBJECT "Ljava/lang/Object;" |
962 #define OBJECT "Ljava/lang/Object;" | 998 #define CLASS "Ljava/lang/Class;" |
963 #define CLASS "Ljava/lang/Class;" | 999 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
964 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" | 1000 #define METASPACE_METHOD "J" |
1001 #define METASPACE_METHOD_DATA "J" | |
1002 #define NMETHOD "J" | |
965 | 1003 |
966 JNINativeMethod CompilerToVM_methods[] = { | 1004 JNINativeMethod CompilerToVM_methods[] = { |
967 {CC"getBytecode", CC"("RESOLVED_METHOD")[B", FN_PTR(getBytecode)}, | 1005 {CC"initializeBytecode", CC"("METASPACE_METHOD"[B)[B", FN_PTR(initializeBytecode)}, |
968 {CC"getSignature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(getSignature)}, | 1006 {CC"getSignature", CC"("METASPACE_METHOD")"STRING, FN_PTR(getSignature)}, |
969 {CC"getExceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(getExceptionHandlers)}, | 1007 {CC"initializeExceptionHandlers", CC"("METASPACE_METHOD EXCEPTION_HANDLERS")"EXCEPTION_HANDLERS, FN_PTR(initializeExceptionHandlers)}, |
970 {CC"hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(hasBalancedMonitors)}, | 1008 {CC"hasBalancedMonitors", CC"("METASPACE_METHOD")Z", FN_PTR(hasBalancedMonitors)}, |
971 {CC"getUniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(getUniqueConcreteMethod)}, | 1009 {CC"getUniqueConcreteMethod", CC"("METASPACE_METHOD"["RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getUniqueConcreteMethod)}, |
972 {CC"getStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, | 1010 {CC"getStackTraceElement", CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, |
973 {CC"getMethodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(getMethodData)}, | 1011 {CC"initializeMethod", CC"("METASPACE_METHOD RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, |
974 {CC"getInvocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(getInvocationCount)}, | 1012 {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, |
975 {CC"getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(getCompiledCodeSize)}, | 1013 {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)}, |
976 {CC"getVtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(getVtableEntryOffset)}, | 1014 {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)}, |
977 {CC"lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)}, | 1015 {CC"getVtableEntryOffset", CC"("METASPACE_METHOD")I", FN_PTR(getVtableEntryOffset)}, |
978 {CC"lookupConstantInPool", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)}, | 1016 {CC"lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)}, |
979 {CC"lookupMethodInPool", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)}, | 1017 {CC"lookupConstantInPool", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)}, |
980 {CC"lookupTypeInPool", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)}, | 1018 {CC"lookupMethodInPool", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)}, |
981 {CC"lookupReferencedTypeInPool", CC"("RESOLVED_TYPE"IB)V", FN_PTR(lookupReferencedTypeInPool)}, | 1019 {CC"lookupTypeInPool", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)}, |
982 {CC"lookupFieldInPool", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(lookupFieldInPool)}, | 1020 {CC"lookupReferencedTypeInPool", CC"("RESOLVED_TYPE"IB)V", FN_PTR(lookupReferencedTypeInPool)}, |
983 {CC"resolveMethod", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(resolveMethod)}, | 1021 {CC"lookupFieldInPool", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(lookupFieldInPool)}, |
984 {CC"isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(isSubtypeOf)}, | 1022 {CC"resolveMethod", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(resolveMethod)}, |
985 {CC"getLeastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(getLeastCommonAncestor)}, | 1023 {CC"isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(isSubtypeOf)}, |
986 {CC"getComponentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getComponentType)}, | 1024 {CC"getLeastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(getLeastCommonAncestor)}, |
987 {CC"getUniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getUniqueConcreteSubtype)}, | 1025 {CC"getComponentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getComponentType)}, |
988 {CC"getSuperType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getSuperType)}, | 1026 {CC"getUniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getUniqueConcreteSubtype)}, |
989 {CC"getPrototypeMarkWord", CC"("RESOLVED_TYPE")J", FN_PTR(getPrototypeMarkWord)}, | 1027 {CC"getSuperType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getSuperType)}, |
990 {CC"getArrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getArrayOf)}, | 1028 {CC"getPrototypeMarkWord", CC"("RESOLVED_TYPE")J", FN_PTR(getPrototypeMarkWord)}, |
991 {CC"getFields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(getFields)}, | 1029 {CC"getArrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(getArrayOf)}, |
992 {CC"isTypeInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(isTypeInitialized)}, | 1030 {CC"getInstanceFields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(getInstanceFields)}, |
993 {CC"initializeType", CC"("RESOLVED_TYPE")V", FN_PTR(initializeType)}, | 1031 {CC"isTypeInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(isTypeInitialized)}, |
994 {CC"getPrimitiveArrayType", CC"("KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, | 1032 {CC"initializeType", CC"("RESOLVED_TYPE")V", FN_PTR(initializeType)}, |
995 {CC"getMaxCallTargetOffset", CC"(J)J", FN_PTR(getMaxCallTargetOffset)}, | 1033 {CC"getPrimitiveArrayType", CC"("KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, |
996 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, | 1034 {CC"getMaxCallTargetOffset", CC"(J)J", FN_PTR(getMaxCallTargetOffset)}, |
997 {CC"getJavaMethod", CC"("REFLECT_METHOD")"METHOD , FN_PTR(getJavaMethod)}, | 1035 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, |
998 {CC"getJavaField", CC"("REFLECT_FIELD")"RESOLVED_FIELD, FN_PTR(getJavaField)}, | 1036 {CC"getMetaspaceMethod", CC"("REFLECT_METHOD"["RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getMetaspaceMethod)}, |
999 {CC"initializeConfiguration", CC"("CONFIG")V", FN_PTR(initializeConfiguration)}, | 1037 {CC"getJavaField", CC"("REFLECT_FIELD")"RESOLVED_FIELD, FN_PTR(getJavaField)}, |
1000 {CC"installMethod", CC"("HS_COMP_RESULT"Z"HS_CODE_INFO")"HS_COMP_METHOD, FN_PTR(installMethod)}, | 1038 {CC"initializeConfiguration", CC"("CONFIG")V", FN_PTR(initializeConfiguration)}, |
1001 {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, | 1039 {CC"installCode", CC"("HS_COMP_RESULT HS_INSTALLED_CODE HS_CODE_INFO")"HS_INSTALLED_CODE, FN_PTR(installCode)}, |
1002 {CC"executeCompiledMethod", CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, | 1040 {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, |
1003 {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, | 1041 {CC"executeCompiledMethod", CC"("METASPACE_METHOD NMETHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, |
1004 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, | 1042 {CC"executeCompiledMethodVarargs", CC"("METASPACE_METHOD NMETHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, |
1005 {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, | 1043 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, |
1044 {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, | |
1006 }; | 1045 }; |
1007 | 1046 |
1008 int CompilerToVM_methods_count() { | 1047 int CompilerToVM_methods_count() { |
1009 return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod); | 1048 return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod); |
1010 } | 1049 } |