Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 5554:70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 10 Jun 2012 01:17:48 +0200 |
parents | 8872bc0eebdf |
children | faa9628bb37d |
comparison
equal
deleted
inserted
replaced
5553:511612d1b5c1 | 5554:70f715dfbb41 |
---|---|
39 methodOop getMethodFromHotSpotMethod(jobject hotspot_method) { | 39 methodOop getMethodFromHotSpotMethod(jobject hotspot_method) { |
40 return getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); | 40 return getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); |
41 } | 41 } |
42 | 42 |
43 methodOop getMethodFromHotSpotMethod(oop hotspot_method) { | 43 methodOop getMethodFromHotSpotMethod(oop hotspot_method) { |
44 return (methodOop)HotSpotMethodResolved::javaMirror(hotspot_method); | 44 return (methodOop)HotSpotResolvedJavaMethod::javaMirror(hotspot_method); |
45 } | 45 } |
46 | 46 |
47 methodDataOop getMethodDataFromHotSpotMethodData(jobject hotspot_method_data) { | 47 methodDataOop getMethodDataFromHotSpotMethodData(jobject hotspot_method_data) { |
48 return (methodDataOop)HotSpotMethodData::hotspotMirror(JNIHandles::resolve(hotspot_method_data)); | 48 return (methodDataOop)HotSpotMethodData::hotspotMirror(JNIHandles::resolve(hotspot_method_data)); |
49 } | 49 } |
50 | 50 |
51 // public byte[] RiMethod_code(HotSpotResolvedMethod method); | 51 // public byte[] JavaMethod_code(HotSpotResolvedMethod method); |
52 JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { | 52 JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { |
53 TRACE_graal_3("CompilerToVM::RiMethod_code"); | 53 TRACE_graal_3("CompilerToVM::JavaMethod_code"); |
54 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 54 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
55 | 55 |
56 // copy all bytecodes | 56 // copy all bytecodes |
57 int code_size = method->code_size(); | 57 int code_size = method->code_size(); |
58 jbyteArray result = env->NewByteArray(code_size); | 58 jbyteArray result = env->NewByteArray(code_size); |
83 } | 83 } |
84 | 84 |
85 return result; | 85 return result; |
86 } | 86 } |
87 | 87 |
88 // public String RiMethod_signature(HotSpotResolvedMethod method); | 88 // public String JavaMethod_signature(HotSpotResolvedMethod method); |
89 JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { | 89 JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { |
90 TRACE_graal_3("CompilerToVM::RiMethod_signature"); | 90 TRACE_graal_3("CompilerToVM::JavaMethod_signature"); |
91 VM_ENTRY_MARK | 91 VM_ENTRY_MARK |
92 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | 92 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
93 assert(method != NULL && method->signature() != NULL, "signature required"); | 93 assert(method != NULL && method->signature() != NULL, "signature required"); |
94 return VmIds::toString<jstring>(method->signature(), THREAD); | 94 return VmIds::toString<jstring>(method->signature(), THREAD); |
95 } | 95 } |
96 | 96 |
97 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId); | 97 // public ExceptionHandler[] JavaMethod_exceptionHandlers(long vmId); |
98 JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { | 98 JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { |
99 TRACE_graal_3("CompilerToVM::RiMethod_exceptionHandlers"); | 99 TRACE_graal_3("CompilerToVM::JavaMethod_exceptionHandlers"); |
100 VM_ENTRY_MARK | 100 VM_ENTRY_MARK |
101 ResourceMark rm; | 101 ResourceMark rm; |
102 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 102 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
103 typeArrayHandle handlers = method->exception_table(); | 103 typeArrayHandle handlers = method->exception_table(); |
104 int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; | 104 int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; |
105 | 105 |
106 instanceKlass::cast(RiExceptionHandler::klass())->initialize(CHECK_NULL); | 106 instanceKlass::cast(ExceptionHandler::klass())->initialize(CHECK_NULL); |
107 objArrayHandle array = oopFactory::new_objArray(SystemDictionary::RiExceptionHandler_klass(), handler_count, CHECK_NULL); | 107 objArrayHandle array = oopFactory::new_objArray(SystemDictionary::ExceptionHandler_klass(), handler_count, CHECK_NULL); |
108 | 108 |
109 for (int i = 0; i < handler_count; i++) { | 109 for (int i = 0; i < handler_count; i++) { |
110 // exception handlers are stored as four integers: start bci, end bci, handler bci, catch class constant pool index | 110 // exception handlers are stored as four integers: start bci, end bci, handler bci, catch class constant pool index |
111 int base = i * 4; | 111 int base = i * 4; |
112 Handle entry = instanceKlass::cast(RiExceptionHandler::klass())->allocate_instance(CHECK_NULL); | 112 Handle entry = instanceKlass::cast(ExceptionHandler::klass())->allocate_instance(CHECK_NULL); |
113 RiExceptionHandler::set_startBCI(entry, handlers->int_at(base + 0)); | 113 ExceptionHandler::set_startBCI(entry, handlers->int_at(base + 0)); |
114 RiExceptionHandler::set_endBCI(entry, handlers->int_at(base + 1)); | 114 ExceptionHandler::set_endBCI(entry, handlers->int_at(base + 1)); |
115 RiExceptionHandler::set_handlerBCI(entry, handlers->int_at(base + 2)); | 115 ExceptionHandler::set_handlerBCI(entry, handlers->int_at(base + 2)); |
116 int catch_class_index = handlers->int_at(base + 3); | 116 int catch_class_index = handlers->int_at(base + 3); |
117 RiExceptionHandler::set_catchTypeCPI(entry, catch_class_index); | 117 ExceptionHandler::set_catchTypeCPI(entry, catch_class_index); |
118 | 118 |
119 if (catch_class_index == 0) { | 119 if (catch_class_index == 0) { |
120 RiExceptionHandler::set_catchType(entry, NULL); | 120 ExceptionHandler::set_catchType(entry, NULL); |
121 } else { | 121 } else { |
122 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); | 122 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); |
123 KlassHandle loading_klass = method->method_holder(); | 123 KlassHandle loading_klass = method->method_holder(); |
124 Handle catch_class = GraalCompiler::get_RiType(cp, catch_class_index, loading_klass, CHECK_NULL); | 124 Handle catch_class = GraalCompiler::get_JavaType(cp, catch_class_index, loading_klass, CHECK_NULL); |
125 if (catch_class->klass() == HotSpotTypeResolved::klass() && java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { | 125 if (catch_class->klass() == HotSpotResolvedJavaType::klass() && java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { |
126 RiExceptionHandler::set_catchType(entry, NULL); | 126 ExceptionHandler::set_catchType(entry, NULL); |
127 RiExceptionHandler::set_catchTypeCPI(entry, 0); | 127 ExceptionHandler::set_catchTypeCPI(entry, 0); |
128 } else { | 128 } else { |
129 RiExceptionHandler::set_catchType(entry, catch_class()); | 129 ExceptionHandler::set_catchType(entry, catch_class()); |
130 } | 130 } |
131 } | 131 } |
132 array->obj_at_put(i, entry()); | 132 array->obj_at_put(i, entry()); |
133 } | 133 } |
134 | 134 |
135 return (jobjectArray) JNIHandles::make_local(array()); | 135 return (jobjectArray) JNIHandles::make_local(array()); |
136 } | 136 } |
137 | 137 |
138 // public boolean RiMethod_hasBalancedMonitors(long vmId); | 138 // public boolean JavaMethod_hasBalancedMonitors(long vmId); |
139 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { | 139 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { |
140 TRACE_graal_3("CompilerToVM::RiMethod_hasBalancedMonitors"); | 140 TRACE_graal_3("CompilerToVM::JavaMethod_hasBalancedMonitors"); |
141 | 141 |
142 VM_ENTRY_MARK; | 142 VM_ENTRY_MARK; |
143 | 143 |
144 // Analyze the method to see if monitors are used properly. | 144 // Analyze the method to see if monitors are used properly. |
145 methodHandle method(THREAD, getMethodFromHotSpotMethod(hotspot_method)); | 145 methodHandle method(THREAD, getMethodFromHotSpotMethod(hotspot_method)); |
161 method->set_guaranteed_monitor_matching(); | 161 method->set_guaranteed_monitor_matching(); |
162 } | 162 } |
163 return true; | 163 return true; |
164 } | 164 } |
165 | 165 |
166 // public RiMethod getRiMethod(java.lang.reflect.Method reflectionMethod); | 166 // public JavaMethod getJavaMethod(java.lang.reflect.Method reflectionMethod); |
167 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getRiMethod(JNIEnv *, jobject, jobject reflection_method_handle) { | 167 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getJavaMethod(JNIEnv *, jobject, jobject reflection_method_handle) { |
168 TRACE_graal_3("CompilerToVM::getRiMethod"); | 168 TRACE_graal_3("CompilerToVM::getJavaMethod"); |
169 VM_ENTRY_MARK; | 169 VM_ENTRY_MARK; |
170 oop reflection_method = JNIHandles::resolve(reflection_method_handle); | 170 oop reflection_method = JNIHandles::resolve(reflection_method_handle); |
171 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); | 171 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); |
172 int slot = java_lang_reflect_Method::slot(reflection_method); | 172 int slot = java_lang_reflect_Method::slot(reflection_method); |
173 klassOop holder = java_lang_Class::as_klassOop(reflection_holder); | 173 klassOop holder = java_lang_Class::as_klassOop(reflection_holder); |
174 methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot); | 174 methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot); |
175 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); | 175 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); |
176 return JNIHandles::make_local(THREAD, ret()); | 176 return JNIHandles::make_local(THREAD, ret()); |
177 } | 177 } |
178 | 178 |
179 // public boolean RiMethod_uniqueConcreteMethod(long vmId); | 179 // public boolean JavaMethod_uniqueConcreteMethod(long vmId); |
180 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { | 180 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { |
181 TRACE_graal_3("CompilerToVM::RiMethod_uniqueConcreteMethod"); | 181 TRACE_graal_3("CompilerToVM::JavaMethod_uniqueConcreteMethod"); |
182 | 182 |
183 VM_ENTRY_MARK; | 183 VM_ENTRY_MARK; |
184 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); | 184 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
185 KlassHandle holder = method->method_holder(); | 185 KlassHandle holder = method->method_holder(); |
186 if (holder->is_interface()) { | 186 if (holder->is_interface()) { |
200 unique_concrete = Dependencies::find_unique_concrete_method(holder(), method()); | 200 unique_concrete = Dependencies::find_unique_concrete_method(holder(), method()); |
201 } | 201 } |
202 if (unique_concrete.is_null()) { | 202 if (unique_concrete.is_null()) { |
203 return NULL; | 203 return NULL; |
204 } else { | 204 } else { |
205 Handle method_resolved = GraalCompiler::createHotSpotMethodResolved(unique_concrete, CHECK_NULL); | 205 Handle method_resolved = GraalCompiler::createHotSpotResolvedJavaMethod(unique_concrete, CHECK_NULL); |
206 return JNIHandles::make_local(THREAD, method_resolved()); | 206 return JNIHandles::make_local(THREAD, method_resolved()); |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 // public native int RiMethod_invocationCount(long vmId); | 210 // public native int JavaMethod_invocationCount(long vmId); |
211 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { | 211 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { |
212 TRACE_graal_3("CompilerToVM::RiMethod_invocationCount"); | 212 TRACE_graal_3("CompilerToVM::JavaMethod_invocationCount"); |
213 return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); | 213 return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); |
214 } | 214 } |
215 | 215 |
216 // public native HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method); | 216 // public native HotSpotMethodData JavaMethod_methodData(HotSpotResolvedJavaMethod method); |
217 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) { | 217 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) { |
218 TRACE_graal_3("CompilerToVM::RiMethod_methodData"); | 218 TRACE_graal_3("CompilerToVM::JavaMethod_methodData"); |
219 VM_ENTRY_MARK; | 219 VM_ENTRY_MARK; |
220 | 220 |
221 methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data(); | 221 methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data(); |
222 if(method_data.is_null()) { | 222 if(method_data.is_null()) { |
223 return NULL; | 223 return NULL; |
251 } | 251 } |
252 } | 252 } |
253 return count; | 253 return count; |
254 } | 254 } |
255 | 255 |
256 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); | 256 // public native boolean JavaMethod_hasCompiledCode(HotSpotResolvedJavaMethod method); |
257 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { | 257 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { |
258 TRACE_graal_3("CompilerToVM::RiMethod_hasCompiledCode"); | 258 TRACE_graal_3("CompilerToVM::JavaMethod_hasCompiledCode"); |
259 return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code(); | 259 return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code(); |
260 } | 260 } |
261 | 261 |
262 // public native int RiMethod_getCompiledCodeSize(HotSpotMethodResolved method); | 262 // public native int JavaMethod_getCompiledCodeSize(HotSpotResolvedJavaMethod method); |
263 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1getCompiledCodeSize(JNIEnv *env, jobject, jobject hotspot_method) { | 263 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1getCompiledCodeSize(JNIEnv *env, jobject, jobject hotspot_method) { |
264 TRACE_graal_3("CompilerToVM::RiMethod_getCompiledCodeSize"); | 264 TRACE_graal_3("CompilerToVM::JavaMethod_getCompiledCodeSize"); |
265 nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); | 265 nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); |
266 return code == NULL ? 0 : code->insts_size(); | 266 return code == NULL ? 0 : code->insts_size(); |
267 } | 267 } |
268 | 268 |
269 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); | 269 // public JavaType Signature_lookupType(String returnType, HotSpotResolvedJavaType accessingClass); |
270 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve) { | 270 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_Signature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve) { |
271 TRACE_graal_3("CompilerToVM::RiSignature_lookupType"); | 271 TRACE_graal_3("CompilerToVM::Signature_lookupType"); |
272 VM_ENTRY_MARK; | 272 VM_ENTRY_MARK; |
273 ResourceMark rm; | 273 ResourceMark rm; |
274 | 274 |
275 Symbol* nameSymbol = VmIds::toSymbol(jname); | 275 Symbol* nameSymbol = VmIds::toSymbol(jname); |
276 Handle name = JNIHandles::resolve(jname); | 276 Handle name = JNIHandles::resolve(jname); |
277 | 277 |
278 oop result; | 278 oop result; |
279 if (nameSymbol == vmSymbols::int_signature()) { | 279 if (nameSymbol == vmSymbols::int_signature()) { |
280 result = VMToCompiler::createRiTypePrimitive((int) T_INT, THREAD); | 280 result = VMToCompiler::createPrimitiveJavaType((int) T_INT, THREAD); |
281 } else if (nameSymbol == vmSymbols::long_signature()) { | 281 } else if (nameSymbol == vmSymbols::long_signature()) { |
282 result = VMToCompiler::createRiTypePrimitive((int) T_LONG, THREAD); | 282 result = VMToCompiler::createPrimitiveJavaType((int) T_LONG, THREAD); |
283 } else if (nameSymbol == vmSymbols::bool_signature()) { | 283 } else if (nameSymbol == vmSymbols::bool_signature()) { |
284 result = VMToCompiler::createRiTypePrimitive((int) T_BOOLEAN, THREAD); | 284 result = VMToCompiler::createPrimitiveJavaType((int) T_BOOLEAN, THREAD); |
285 } else if (nameSymbol == vmSymbols::char_signature()) { | 285 } else if (nameSymbol == vmSymbols::char_signature()) { |
286 result = VMToCompiler::createRiTypePrimitive((int) T_CHAR, THREAD); | 286 result = VMToCompiler::createPrimitiveJavaType((int) T_CHAR, THREAD); |
287 } else if (nameSymbol == vmSymbols::short_signature()) { | 287 } else if (nameSymbol == vmSymbols::short_signature()) { |
288 result = VMToCompiler::createRiTypePrimitive((int) T_SHORT, THREAD); | 288 result = VMToCompiler::createPrimitiveJavaType((int) T_SHORT, THREAD); |
289 } else if (nameSymbol == vmSymbols::byte_signature()) { | 289 } else if (nameSymbol == vmSymbols::byte_signature()) { |
290 result = VMToCompiler::createRiTypePrimitive((int) T_BYTE, THREAD); | 290 result = VMToCompiler::createPrimitiveJavaType((int) T_BYTE, THREAD); |
291 } else if (nameSymbol == vmSymbols::double_signature()) { | 291 } else if (nameSymbol == vmSymbols::double_signature()) { |
292 result = VMToCompiler::createRiTypePrimitive((int) T_DOUBLE, THREAD); | 292 result = VMToCompiler::createPrimitiveJavaType((int) T_DOUBLE, THREAD); |
293 } else if (nameSymbol == vmSymbols::float_signature()) { | 293 } else if (nameSymbol == vmSymbols::float_signature()) { |
294 result = VMToCompiler::createRiTypePrimitive((int) T_FLOAT, THREAD); | 294 result = VMToCompiler::createPrimitiveJavaType((int) T_FLOAT, THREAD); |
295 } else { | 295 } else { |
296 klassOop resolved_type = NULL; | 296 klassOop resolved_type = NULL; |
297 // if the name isn't in the symbol table then the class isn't loaded anyway... | 297 // if the name isn't in the symbol table then the class isn't loaded anyway... |
298 if (nameSymbol != NULL) { | 298 if (nameSymbol != NULL) { |
299 Handle classloader; | 299 Handle classloader; |
300 Handle protectionDomain; | 300 Handle protectionDomain; |
301 if (JNIHandles::resolve(accessingClass) != NULL) { | 301 if (JNIHandles::resolve(accessingClass) != NULL) { |
302 classloader = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(accessingClass))->klass_part()->class_loader(); | 302 classloader = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->class_loader(); |
303 protectionDomain = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(accessingClass))->klass_part()->protection_domain(); | 303 protectionDomain = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->protection_domain(); |
304 } | 304 } |
305 if (eagerResolve) { | 305 if (eagerResolve) { |
306 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); | 306 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); |
307 } else { | 307 } else { |
308 if (FieldType::is_obj(nameSymbol)) { | 308 if (FieldType::is_obj(nameSymbol)) { |
319 CLEAR_PENDING_EXCEPTION; | 319 CLEAR_PENDING_EXCEPTION; |
320 resolved_type = NULL; | 320 resolved_type = NULL; |
321 } | 321 } |
322 } | 322 } |
323 if (resolved_type != NULL) { | 323 if (resolved_type != NULL) { |
324 Handle type = GraalCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL); | 324 Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); |
325 result = type(); | 325 result = type(); |
326 } else { | 326 } else { |
327 Handle type = VMToCompiler::createRiTypeUnresolved(name, THREAD); | 327 Handle type = VMToCompiler::createJavaType(name, THREAD); |
328 result = type(); | 328 result = type(); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 return JNIHandles::make_local(THREAD, result); | 332 return JNIHandles::make_local(THREAD, result); |
333 } | 333 } |
334 | 334 |
335 // public Object RiConstantPool_lookupConstant(HotSpotTypeResolved type, int cpi); | 335 // public Object ConstantPool_lookupConstant(HotSpotResolvedJavaType type, int cpi); |
336 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { | 336 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { |
337 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupConstant"); | 337 TRACE_graal_3("CompilerToVM::ConstantPool_lookupConstant"); |
338 VM_ENTRY_MARK; | 338 VM_ENTRY_MARK; |
339 | 339 |
340 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 340 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
341 | 341 |
342 oop result = NULL; | 342 oop result = NULL; |
343 constantTag tag = cp->tag_at(index); | 343 constantTag tag = cp->tag_at(index); |
344 if (tag.is_int()) { | 344 if (tag.is_int()) { |
345 result = VMToCompiler::createCiConstant(CiKind::Int(), cp->int_at(index), CHECK_0); | 345 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_0); |
346 } else if (tag.is_long()) { | 346 } else if (tag.is_long()) { |
347 result = VMToCompiler::createCiConstant(CiKind::Long(), cp->long_at(index), CHECK_0); | 347 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_0); |
348 } else if (tag.is_float()) { | 348 } else if (tag.is_float()) { |
349 result = VMToCompiler::createCiConstantFloat(cp->float_at(index), CHECK_0); | 349 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_0); |
350 } else if (tag.is_double()) { | 350 } else if (tag.is_double()) { |
351 result = VMToCompiler::createCiConstantDouble(cp->double_at(index), CHECK_0); | 351 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_0); |
352 } else if (tag.is_string() || tag.is_unresolved_string()) { | 352 } else if (tag.is_string() || tag.is_unresolved_string()) { |
353 oop string = NULL; | 353 oop string = NULL; |
354 if (cp->is_pseudo_string_at(index)) { | 354 if (cp->is_pseudo_string_at(index)) { |
355 string = cp->pseudo_string_at(index); | 355 string = cp->pseudo_string_at(index); |
356 } else { | 356 } else { |
360 // TODO: Gracefully exit compilation. | 360 // TODO: Gracefully exit compilation. |
361 fatal("out of memory during compilation!"); | 361 fatal("out of memory during compilation!"); |
362 return NULL; | 362 return NULL; |
363 } | 363 } |
364 } | 364 } |
365 result = VMToCompiler::createCiConstantObject(string, CHECK_0); | 365 result = VMToCompiler::createConstantObject(string, CHECK_0); |
366 } else if (tag.is_klass() || tag.is_unresolved_klass()) { | 366 } else if (tag.is_klass() || tag.is_unresolved_klass()) { |
367 Handle type = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); | 367 Handle type = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); |
368 result = type(); | 368 result = type(); |
369 } else if (tag.is_object()) { | 369 } else if (tag.is_object()) { |
370 oop obj = cp->object_at(index); | 370 oop obj = cp->object_at(index); |
371 assert(obj->is_instance(), "must be an instance"); | 371 assert(obj->is_instance(), "must be an instance"); |
372 result = VMToCompiler::createCiConstantObject(obj, CHECK_NULL); | 372 result = VMToCompiler::createConstantObject(obj, CHECK_NULL); |
373 } else { | 373 } else { |
374 ShouldNotReachHere(); | 374 ShouldNotReachHere(); |
375 } | 375 } |
376 | 376 |
377 return JNIHandles::make_local(THREAD, result); | 377 return JNIHandles::make_local(THREAD, result); |
378 } | 378 } |
379 | 379 |
380 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); | 380 // public JavaMethod ConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); |
381 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { | 381 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { |
382 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupMethod"); | 382 TRACE_graal_3("CompilerToVM::ConstantPool_lookupMethod"); |
383 VM_ENTRY_MARK; | 383 VM_ENTRY_MARK; |
384 index = GraalCompiler::to_cp_index_u2(index); | 384 index = GraalCompiler::to_cp_index_u2(index); |
385 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 385 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
386 instanceKlassHandle pool_holder(cp->pool_holder()); | 386 instanceKlassHandle pool_holder(cp->pool_holder()); |
387 | 387 |
388 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); | 388 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); |
389 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); | 389 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); |
390 if (!method.is_null()) { | 390 if (!method.is_null()) { |
391 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); | 391 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); |
392 return JNIHandles::make_local(THREAD, ret()); | 392 return JNIHandles::make_local(THREAD, ret()); |
393 } else { | 393 } else { |
394 // Get the method's name and signature. | 394 // Get the method's name and signature. |
395 Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL); | 395 Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL); |
396 Handle signature = VmIds::toString<Handle>(cp->signature_ref_at(index), CHECK_NULL); | 396 Handle signature = VmIds::toString<Handle>(cp->signature_ref_at(index), CHECK_NULL); |
397 int holder_index = cp->klass_ref_index_at(index); | 397 int holder_index = cp->klass_ref_index_at(index); |
398 Handle type = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); | 398 Handle type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
399 return JNIHandles::make_local(THREAD, VMToCompiler::createRiMethodUnresolved(name, signature, type, THREAD)); | 399 return JNIHandles::make_local(THREAD, VMToCompiler::createJavaMethod(name, signature, type, THREAD)); |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 // public RiType RiConstantPool_lookupType(long vmId, int cpi); | 403 // public JavaType ConstantPool_lookupType(long vmId, int cpi); |
404 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { | 404 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { |
405 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupType"); | 405 TRACE_graal_3("CompilerToVM::ConstantPool_lookupType"); |
406 VM_ENTRY_MARK; | 406 VM_ENTRY_MARK; |
407 | 407 |
408 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 408 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
409 Handle result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); | 409 Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); |
410 return JNIHandles::make_local(THREAD, result()); | 410 return JNIHandles::make_local(THREAD, result()); |
411 } | 411 } |
412 | 412 |
413 // public void RiConstantPool_loadReferencedType(long vmId, int cpi); | 413 // public void ConstantPool_loadReferencedType(long vmId, int cpi); |
414 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { | 414 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { |
415 TRACE_graal_3("CompilerToVM::RiConstantPool_loadReferencedType"); | 415 TRACE_graal_3("CompilerToVM::ConstantPool_loadReferencedType"); |
416 VM_ENTRY_MARK; | 416 VM_ENTRY_MARK; |
417 | 417 |
418 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 418 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
419 int byteCode = (op & 0xFF); | 419 int byteCode = (op & 0xFF); |
420 if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray | 420 if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray |
421 && byteCode != Bytecodes::_multianewarray && byteCode != Bytecodes::_ldc && byteCode != Bytecodes::_ldc_w && byteCode != Bytecodes::_ldc2_w) | 421 && byteCode != Bytecodes::_multianewarray && byteCode != Bytecodes::_ldc && byteCode != Bytecodes::_ldc_w && byteCode != Bytecodes::_ldc2_w) |
422 { | 422 { |
423 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index)); | 423 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index)); |
434 instanceKlass::cast(klass)->initialize(CHECK); | 434 instanceKlass::cast(klass)->initialize(CHECK); |
435 } | 435 } |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 // public RiField RiConstantPool_lookupField(long vmId, int cpi); | 439 // public JavaField ConstantPool_lookupField(long vmId, int cpi); |
440 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { | 440 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { |
441 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupField"); | 441 TRACE_graal_3("CompilerToVM::ConstantPool_lookupField"); |
442 VM_ENTRY_MARK; | 442 VM_ENTRY_MARK; |
443 ResourceMark rm; | 443 ResourceMark rm; |
444 | 444 |
445 index = GraalCompiler::to_cp_index_u2(index); | 445 index = GraalCompiler::to_cp_index_u2(index); |
446 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(constantPoolHolder)))->constants(); | 446 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(constantPoolHolder)))->constants(); |
447 | 447 |
448 int nt_index = cp->name_and_type_ref_index_at(index); | 448 int nt_index = cp->name_and_type_ref_index_at(index); |
449 int sig_index = cp->signature_ref_index_at(nt_index); | 449 int sig_index = cp->signature_ref_index_at(nt_index); |
450 Symbol* signature = cp->symbol_at(sig_index); | 450 Symbol* signature = cp->symbol_at(sig_index); |
451 int name_index = cp->name_ref_index_at(nt_index); | 451 int name_index = cp->name_ref_index_at(nt_index); |
452 Symbol* name = cp->symbol_at(name_index); | 452 Symbol* name = cp->symbol_at(name_index); |
453 int holder_index = cp->klass_ref_index_at(index); | 453 int holder_index = cp->klass_ref_index_at(index); |
454 Handle holder = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); | 454 Handle holder = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
455 instanceKlassHandle holder_klass; | 455 instanceKlassHandle holder_klass; |
456 | 456 |
457 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); | 457 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); |
458 int offset = -1; | 458 int offset = -1; |
459 AccessFlags flags; | 459 AccessFlags flags; |
460 BasicType basic_type; | 460 BasicType basic_type; |
461 if (holder->klass() == SystemDictionary::HotSpotTypeResolved_klass()) { | 461 if (holder->klass() == SystemDictionary::HotSpotResolvedJavaType_klass()) { |
462 FieldAccessInfo result; | 462 FieldAccessInfo result; |
463 LinkResolver::resolve_field(result, cp, index, | 463 LinkResolver::resolve_field(result, cp, index, |
464 Bytecodes::java_code(code), | 464 Bytecodes::java_code(code), |
465 true, false, Thread::current()); | 465 true, false, Thread::current()); |
466 if (HAS_PENDING_EXCEPTION) { | 466 if (HAS_PENDING_EXCEPTION) { |
468 } else { | 468 } else { |
469 offset = result.field_offset(); | 469 offset = result.field_offset(); |
470 flags = result.access_flags(); | 470 flags = result.access_flags(); |
471 holder_klass = result.klass()->as_klassOop(); | 471 holder_klass = result.klass()->as_klassOop(); |
472 basic_type = result.field_type(); | 472 basic_type = result.field_type(); |
473 holder = GraalCompiler::get_RiType(holder_klass, CHECK_NULL); | 473 holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL); |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 Handle type = GraalCompiler::get_RiTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); | 477 Handle type = GraalCompiler::get_JavaTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); |
478 Handle field_handle = GraalCompiler::get_RiField(offset, flags.as_int(), name, holder, type, code, THREAD); | 478 Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, code, THREAD); |
479 | 479 |
480 oop constant_object = NULL; | 480 oop constant_object = NULL; |
481 // Check to see if the field is constant. | 481 // Check to see if the field is constant. |
482 if (!holder_klass.is_null() && holder_klass->is_initialized() && flags.is_final() && flags.is_static()) { | 482 if (!holder_klass.is_null() && holder_klass->is_initialized() && flags.is_final() && flags.is_static()) { |
483 // This field just may be constant. The only cases where it will | 483 // This field just may be constant. The only cases where it will |
505 if (ok) { | 505 if (ok) { |
506 Handle mirror = holder_klass->java_mirror(); | 506 Handle mirror = holder_klass->java_mirror(); |
507 switch(basic_type) { | 507 switch(basic_type) { |
508 case T_OBJECT: | 508 case T_OBJECT: |
509 case T_ARRAY: | 509 case T_ARRAY: |
510 constant_object = VMToCompiler::createCiConstantObject(mirror->obj_field(offset), CHECK_0); | 510 constant_object = VMToCompiler::createConstantObject(mirror->obj_field(offset), CHECK_0); |
511 break; | 511 break; |
512 case T_DOUBLE: | 512 case T_DOUBLE: |
513 constant_object = VMToCompiler::createCiConstantDouble(mirror->double_field(offset), CHECK_0); | 513 constant_object = VMToCompiler::createConstantDouble(mirror->double_field(offset), CHECK_0); |
514 break; | 514 break; |
515 case T_FLOAT: | 515 case T_FLOAT: |
516 constant_object = VMToCompiler::createCiConstantFloat(mirror->float_field(offset), CHECK_0); | 516 constant_object = VMToCompiler::createConstantFloat(mirror->float_field(offset), CHECK_0); |
517 break; | 517 break; |
518 case T_LONG: | 518 case T_LONG: |
519 constant_object = VMToCompiler::createCiConstant(CiKind::Long(), mirror->long_field(offset), CHECK_0); | 519 constant_object = VMToCompiler::createConstant(Kind::Long(), mirror->long_field(offset), CHECK_0); |
520 break; | 520 break; |
521 case T_INT: | 521 case T_INT: |
522 constant_object = VMToCompiler::createCiConstant(CiKind::Int(), mirror->int_field(offset), CHECK_0); | 522 constant_object = VMToCompiler::createConstant(Kind::Int(), mirror->int_field(offset), CHECK_0); |
523 break; | 523 break; |
524 case T_SHORT: | 524 case T_SHORT: |
525 constant_object = VMToCompiler::createCiConstant(CiKind::Short(), mirror->short_field(offset), CHECK_0); | 525 constant_object = VMToCompiler::createConstant(Kind::Short(), mirror->short_field(offset), CHECK_0); |
526 break; | 526 break; |
527 case T_CHAR: | 527 case T_CHAR: |
528 constant_object = VMToCompiler::createCiConstant(CiKind::Char(), mirror->char_field(offset), CHECK_0); | 528 constant_object = VMToCompiler::createConstant(Kind::Char(), mirror->char_field(offset), CHECK_0); |
529 break; | 529 break; |
530 case T_BYTE: | 530 case T_BYTE: |
531 constant_object = VMToCompiler::createCiConstant(CiKind::Byte(), mirror->byte_field(offset), CHECK_0); | 531 constant_object = VMToCompiler::createConstant(Kind::Byte(), mirror->byte_field(offset), CHECK_0); |
532 break; | 532 break; |
533 case T_BOOLEAN: | 533 case T_BOOLEAN: |
534 constant_object = VMToCompiler::createCiConstant(CiKind::Boolean(), mirror->bool_field(offset), CHECK_0); | 534 constant_object = VMToCompiler::createConstant(Kind::Boolean(), mirror->bool_field(offset), CHECK_0); |
535 break; | 535 break; |
536 default: | 536 default: |
537 fatal("Unhandled constant"); | 537 fatal("Unhandled constant"); |
538 break; | 538 break; |
539 } | 539 } |
540 } | 540 } |
541 } | 541 } |
542 if (constant_object != NULL) { | 542 if (constant_object != NULL) { |
543 HotSpotField::set_constant(field_handle, constant_object); | 543 HotSpotResolvedJavaField::set_constant(field_handle, constant_object); |
544 } | 544 } |
545 return JNIHandles::make_local(THREAD, field_handle()); | 545 return JNIHandles::make_local(THREAD, field_handle()); |
546 } | 546 } |
547 | 547 |
548 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); | 548 // public JavaMethod JavaType_resolveMethodImpl(HotSpotResolvedJavaType klass, String name, String signature); |
549 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { | 549 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { |
550 TRACE_graal_3("CompilerToVM::RiType_resolveMethodImpl"); | 550 TRACE_graal_3("CompilerToVM::JavaType_resolveMethodImpl"); |
551 VM_ENTRY_MARK; | 551 VM_ENTRY_MARK; |
552 | 552 |
553 assert(JNIHandles::resolve(resolved_type) != NULL, ""); | 553 assert(JNIHandles::resolve(resolved_type) != NULL, ""); |
554 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type)); | 554 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(resolved_type)); |
555 Symbol* name_symbol = VmIds::toSymbol(name); | 555 Symbol* name_symbol = VmIds::toSymbol(name); |
556 Symbol* signature_symbol = VmIds::toSymbol(signature); | 556 Symbol* signature_symbol = VmIds::toSymbol(signature); |
557 methodHandle method = klass->klass_part()->lookup_method(name_symbol, signature_symbol); | 557 methodHandle method = klass->klass_part()->lookup_method(name_symbol, signature_symbol); |
558 if (method == NULL) { | 558 if (method == NULL) { |
559 if (TraceGraal >= 3) { | 559 if (TraceGraal >= 3) { |
560 ResourceMark rm; | 560 ResourceMark rm; |
561 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()); | 561 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()); |
562 } | 562 } |
563 return NULL; | 563 return NULL; |
564 } | 564 } |
565 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); | 565 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); |
566 return JNIHandles::make_local(THREAD, ret()); | 566 return JNIHandles::make_local(THREAD, ret()); |
567 } | 567 } |
568 | 568 |
569 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other); | 569 // public boolean JavaType_isSubtypeOf(HotSpotResolvedJavaType klass, JavaType other); |
570 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { | 570 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { |
571 TRACE_graal_3("CompilerToVM::RiType_isSubtypeOf"); | 571 TRACE_graal_3("CompilerToVM::JavaType_isSubtypeOf"); |
572 VM_ENTRY_MARK; | 572 VM_ENTRY_MARK; |
573 | 573 |
574 oop other = JNIHandles::resolve(jother); | 574 oop other = JNIHandles::resolve(jother); |
575 assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected"); | 575 assert(other->is_a(HotSpotResolvedJavaType::klass()), "resolved hotspot type expected"); |
576 assert(JNIHandles::resolve(klass) != NULL, ""); | 576 assert(JNIHandles::resolve(klass) != NULL, ""); |
577 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); | 577 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); |
578 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other)); | 578 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other)); |
579 if (thisKlass->klass_part()->oop_is_instance_slow()) { | 579 if (thisKlass->klass_part()->oop_is_instance_slow()) { |
580 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); | 580 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
581 } else if (thisKlass->klass_part()->oop_is_array()) { | 581 } else if (thisKlass->klass_part()->oop_is_array()) { |
582 return arrayKlass::cast(thisKlass)->is_subtype_of(otherKlass); | 582 return arrayKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
583 } else { | 583 } else { |
584 fatal("unexpected class type"); | 584 fatal("unexpected class type"); |
585 return false; | 585 return false; |
586 } | 586 } |
587 } | 587 } |
588 | 588 |
589 // public RiType RiType_leastCommonAncestor(HotSpotTypeResolved thisType, HotSpotTypeResolved otherType); | 589 // public JavaType JavaType_leastCommonAncestor(HotSpotResolvedJavaType thisType, HotSpotResolvedJavaType otherType); |
590 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_2leastCommonAncestor(JNIEnv *, jobject, jobject this_type, jobject other_type) { | 590 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2leastCommonAncestor(JNIEnv *, jobject, jobject this_type, jobject other_type) { |
591 TRACE_graal_3("CompilerToVM::RiType_leastCommonAncestor"); | 591 TRACE_graal_3("CompilerToVM::JavaType_leastCommonAncestor"); |
592 VM_ENTRY_MARK; | 592 VM_ENTRY_MARK; |
593 | 593 |
594 Klass* this_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(this_type))->klass_part(); | 594 Klass* this_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(this_type))->klass_part(); |
595 Klass* other_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other_type))->klass_part(); | 595 Klass* other_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other_type))->klass_part(); |
596 Klass* lca = this_klass->LCA(other_klass); | 596 Klass* lca = this_klass->LCA(other_klass); |
597 | 597 |
598 return JNIHandles::make_local(GraalCompiler::get_RiType(lca, THREAD)()); | 598 return JNIHandles::make_local(GraalCompiler::get_JavaType(lca, THREAD)()); |
599 } | 599 } |
600 | 600 |
601 // public RiType RiType_componentType(HotSpotResolvedType klass); | 601 // public JavaType JavaType_componentType(HotSpotResolvedType klass); |
602 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1componentType(JNIEnv *, jobject, jobject klass) { | 602 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1componentType(JNIEnv *, jobject, jobject klass) { |
603 TRACE_graal_3("CompilerToVM::RiType_componentType"); | 603 TRACE_graal_3("CompilerToVM::JavaType_componentType"); |
604 VM_ENTRY_MARK; | 604 VM_ENTRY_MARK; |
605 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); | 605 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); |
606 if(array_klass->oop_is_typeArray()) { | 606 if(array_klass->oop_is_typeArray()) { |
607 BasicType t = typeArrayKlass::cast(array_klass())->element_type(); | 607 BasicType t = typeArrayKlass::cast(array_klass())->element_type(); |
608 oop primitive_type = VMToCompiler::createRiTypePrimitive((int) t, CHECK_NULL); | 608 oop primitive_type = VMToCompiler::createPrimitiveJavaType((int) t, CHECK_NULL); |
609 return JNIHandles::make_local(primitive_type); | 609 return JNIHandles::make_local(primitive_type); |
610 } | 610 } |
611 assert(array_klass->oop_is_objArray(), "just checking"); | 611 assert(array_klass->oop_is_objArray(), "just checking"); |
612 klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); | 612 klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); |
613 assert(JNIHandles::resolve(klass) != NULL, ""); | 613 assert(JNIHandles::resolve(klass) != NULL, ""); |
614 return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)()); | 614 return JNIHandles::make_local(GraalCompiler::get_JavaType(element_type, THREAD)()); |
615 } | 615 } |
616 | 616 |
617 // public RiType RiType_superType(HotSpotResolvedType klass); | 617 // public JavaType JavaType_superType(HotSpotResolvedType klass); |
618 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1superType(JNIEnv *, jobject, jobject klass) { | 618 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1superType(JNIEnv *, jobject, jobject klass) { |
619 TRACE_graal_3("CompilerToVM::RiType_superType"); | 619 TRACE_graal_3("CompilerToVM::JavaType_superType"); |
620 VM_ENTRY_MARK; | 620 VM_ENTRY_MARK; |
621 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 621 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); |
622 klassOop k; | 622 klassOop k; |
623 | 623 |
624 if (klass_handle->oop_is_array()) { | 624 if (klass_handle->oop_is_array()) { |
625 k = SystemDictionary::Object_klass(); | 625 k = SystemDictionary::Object_klass(); |
626 } else { | 626 } else { |
627 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); | 627 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); |
628 k = klass_handle->super(); | 628 k = klass_handle->super(); |
629 } | 629 } |
630 | 630 |
631 if (k != NULL) { | 631 if (k != NULL) { |
632 return JNIHandles::make_local(GraalCompiler::get_RiType(k, THREAD)()); | 632 return JNIHandles::make_local(GraalCompiler::get_JavaType(k, THREAD)()); |
633 } else { | 633 } else { |
634 return NULL; | 634 return NULL; |
635 } | 635 } |
636 } | 636 } |
637 | 637 |
638 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); | 638 // public JavaType JavaType_uniqueConcreteSubtype(HotSpotResolvedType klass); |
639 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { | 639 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { |
640 TRACE_graal_3("CompilerToVM::RiType_uniqueConcreteSubtype"); | 640 TRACE_graal_3("CompilerToVM::JavaType_uniqueConcreteSubtype"); |
641 VM_ENTRY_MARK; | 641 VM_ENTRY_MARK; |
642 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 642 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); |
643 Klass *up_cast = klass_handle->up_cast_abstract(); | 643 Klass *up_cast = klass_handle->up_cast_abstract(); |
644 if (up_cast->is_leaf_class()) { | 644 if (up_cast->is_leaf_class()) { |
645 return JNIHandles::make_local(GraalCompiler::get_RiType(up_cast, THREAD)()); | 645 return JNIHandles::make_local(GraalCompiler::get_JavaType(up_cast, THREAD)()); |
646 } | 646 } |
647 return NULL; | 647 return NULL; |
648 } | 648 } |
649 | 649 |
650 // public bool RiType_isInitialized(HotSpotResolvedType klass); | 650 // public bool JavaType_isInitialized(HotSpotResolvedType klass); |
651 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { | 651 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { |
652 TRACE_graal_3("CompilerToVM::RiType_isInitialized"); | 652 TRACE_graal_3("CompilerToVM::JavaType_isInitialized"); |
653 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass)); | 653 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); |
654 assert(klass != NULL, "method must not be called for primitive types"); | 654 assert(klass != NULL, "method must not be called for primitive types"); |
655 return instanceKlass::cast(klass)->is_initialized(); | 655 return instanceKlass::cast(klass)->is_initialized(); |
656 } | 656 } |
657 | 657 |
658 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); | 658 // public JavaType JavaType_arrayOf(HotSpotResolvedJavaType klass); |
659 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { | 659 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1arrayOf(JNIEnv *, jobject, jobject klass) { |
660 TRACE_graal_3("CompilerToVM::RiType_arrayOf"); | 660 TRACE_graal_3("CompilerToVM::JavaType_arrayOf"); |
661 VM_ENTRY_MARK; | 661 VM_ENTRY_MARK; |
662 | 662 |
663 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 663 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); |
664 KlassHandle arr = klass_handle->array_klass(THREAD); | 664 KlassHandle arr = klass_handle->array_klass(THREAD); |
665 Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); | 665 Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); |
666 assert(arr->oop_is_array(), ""); | 666 assert(arr->oop_is_array(), ""); |
667 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(arr, name, THREAD)()); | 667 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotResolvedJavaType(arr, name, THREAD)()); |
668 } | 668 } |
669 | 669 |
670 // public ResolvedJavaField[] RiType_fields(HotSpotTypeResolved klass); | 670 // public ResolvedJavaField[] JavaType_fields(HotSpotResolvedJavaType klass); |
671 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1fields(JNIEnv *, jobject, jobject klass) { | 671 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1fields(JNIEnv *, jobject, jobject klass) { |
672 TRACE_graal_3("CompilerToVM::RiType_fields"); | 672 TRACE_graal_3("CompilerToVM::JavaType_fields"); |
673 VM_ENTRY_MARK; | 673 VM_ENTRY_MARK; |
674 ResourceMark rm; | 674 ResourceMark rm; |
675 | 675 |
676 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); | 676 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); |
677 class MyFieldClosure : public FieldClosure { | 677 class MyFieldClosure : public FieldClosure { |
678 public: | 678 public: |
679 instanceKlassHandle _holder; | 679 instanceKlassHandle _holder; |
680 Handle _resolved_type_holder; | 680 Handle _resolved_type_holder; |
681 GrowableArray<Handle> _field_array; | 681 GrowableArray<Handle> _field_array; |
683 MyFieldClosure(instanceKlassHandle& holder, Handle resolved_type_holder) : _holder(holder), _resolved_type_holder(resolved_type_holder) { } | 683 MyFieldClosure(instanceKlassHandle& holder, Handle resolved_type_holder) : _holder(holder), _resolved_type_holder(resolved_type_holder) { } |
684 | 684 |
685 virtual void do_field(fieldDescriptor* fd) { | 685 virtual void do_field(fieldDescriptor* fd) { |
686 if (!Thread::current()->has_pending_exception()) { | 686 if (!Thread::current()->has_pending_exception()) { |
687 if (fd->field_holder() == _holder()) { | 687 if (fd->field_holder() == _holder()) { |
688 Handle type = GraalCompiler::get_RiTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); | 688 Handle type = GraalCompiler::get_JavaTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); |
689 Handle field = VMToCompiler::createRiField(_resolved_type_holder, VmIds::toString<Handle>(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); | 689 Handle field = VMToCompiler::createJavaField(_resolved_type_holder, VmIds::toString<Handle>(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); |
690 _field_array.append(field()); | 690 _field_array.append(field()); |
691 } | 691 } |
692 } | 692 } |
693 } | 693 } |
694 }; | 694 }; |
695 MyFieldClosure closure(k, JNIHandles::resolve(klass)); | 695 MyFieldClosure closure(k, JNIHandles::resolve(klass)); |
696 k->do_nonstatic_fields(&closure); | 696 k->do_nonstatic_fields(&closure); |
697 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::RiResolvedField_klass(), closure._field_array.length(), CHECK_NULL); | 697 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::ResolvedJavaField_klass(), closure._field_array.length(), CHECK_NULL); |
698 for (int i=0; i<closure._field_array.length(); ++i) { | 698 for (int i=0; i<closure._field_array.length(); ++i) { |
699 field_array->obj_at_put(i, closure._field_array.at(i)()); | 699 field_array->obj_at_put(i, closure._field_array.at(i)()); |
700 } | 700 } |
701 return JNIHandles::make_local(field_array()); | 701 return JNIHandles::make_local(field_array()); |
702 } | 702 } |
703 | 703 |
704 // public RiType getPrimitiveArrayType(CiKind kind); | 704 // public JavaType getPrimitiveArrayType(Kind kind); |
705 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { | 705 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { |
706 TRACE_graal_3("CompilerToVM::getPrimitiveArrayType"); | 706 TRACE_graal_3("CompilerToVM::getPrimitiveArrayType"); |
707 VM_ENTRY_MARK; | 707 VM_ENTRY_MARK; |
708 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind)); | 708 BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(kind)); |
709 assert(type != T_OBJECT, "primitive type expecteds"); | 709 assert(type != T_OBJECT, "primitive type expecteds"); |
710 Handle result = GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), CHECK_NULL); | 710 Handle result = GraalCompiler::get_JavaType(Universe::typeArrayKlassObj(type), CHECK_NULL); |
711 return JNIHandles::make_local(THREAD, result()); | 711 return JNIHandles::make_local(THREAD, result()); |
712 } | 712 } |
713 | 713 |
714 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall); | 714 // public long getMaxCallTargetOffset(RuntimeCall rtcall); |
715 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { | 715 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { |
716 TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset"); | 716 TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset"); |
717 VM_ENTRY_MARK; | 717 VM_ENTRY_MARK; |
718 oop call = JNIHandles::resolve(rtcall); | 718 oop call = JNIHandles::resolve(rtcall); |
719 address target_addr = CodeInstaller::runtime_call_target_address(call); | 719 address target_addr = CodeInstaller::runtime_call_target_address(call); |
723 return MAX2(ABS(off_low), ABS(off_high)); | 723 return MAX2(ABS(off_low), ABS(off_high)); |
724 } | 724 } |
725 return -1; | 725 return -1; |
726 } | 726 } |
727 | 727 |
728 // public RiType getType(Class<?> javaClass); | 728 // public JavaType getType(Class<?> javaClass); |
729 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { | 729 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { |
730 TRACE_graal_3("CompilerToVM::getType"); | 730 TRACE_graal_3("CompilerToVM::getType"); |
731 VM_ENTRY_MARK; | 731 VM_ENTRY_MARK; |
732 oop javaClassOop = JNIHandles::resolve(javaClass); | 732 oop javaClassOop = JNIHandles::resolve(javaClass); |
733 if (javaClassOop == NULL) { | 733 if (javaClassOop == NULL) { |
734 fatal("argument to CompilerToVM.getType must not be NULL"); | 734 fatal("argument to CompilerToVM.getType must not be NULL"); |
735 return NULL; | 735 return NULL; |
736 } else if (java_lang_Class::is_primitive(javaClassOop)) { | 736 } else if (java_lang_Class::is_primitive(javaClassOop)) { |
737 BasicType basicType = java_lang_Class::primitive_type(javaClassOop); | 737 BasicType basicType = java_lang_Class::primitive_type(javaClassOop); |
738 return JNIHandles::make_local(THREAD, VMToCompiler::createRiTypePrimitive((int) basicType, THREAD)); | 738 return JNIHandles::make_local(THREAD, VMToCompiler::createPrimitiveJavaType((int) basicType, THREAD)); |
739 } else { | 739 } else { |
740 KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop); | 740 KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop); |
741 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL); | 741 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL); |
742 | 742 |
743 Handle type = GraalCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); | 743 Handle type = GraalCompiler::createHotSpotResolvedJavaType(klass, name, CHECK_NULL); |
744 return JNIHandles::make_local(THREAD, type()); | 744 return JNIHandles::make_local(THREAD, type()); |
745 } | 745 } |
746 } | 746 } |
747 | 747 |
748 | 748 |
927 | 927 |
928 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); | 928 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
929 return JNIHandles::make_local(result()); | 929 return JNIHandles::make_local(result()); |
930 } | 930 } |
931 | 931 |
932 // public String disassembleJava(HotSpotMethodResolved method); | 932 // public String disassembleJava(HotSpotResolvedJavaMethod method); |
933 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_disassembleJava(JNIEnv *env, jobject, jobject hotspot_method) { | 933 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_disassembleJava(JNIEnv *env, jobject, jobject hotspot_method) { |
934 TRACE_graal_3("CompilerToVM::disassembleJava"); | 934 TRACE_graal_3("CompilerToVM::disassembleJava"); |
935 | 935 |
936 // Important: The bytecode printing functions are all NOT PRODUCT code, so this method returns an empty string for a product VM build. | 936 // Important: The bytecode printing functions are all NOT PRODUCT code, so this method returns an empty string for a product VM build. |
937 | 937 |
946 | 946 |
947 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); | 947 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
948 return JNIHandles::make_local(result()); | 948 return JNIHandles::make_local(result()); |
949 } | 949 } |
950 | 950 |
951 // public StackTraceElement RiMethod_toStackTraceElement(HotSpotMethodResolved method, int bci); | 951 // public StackTraceElement JavaMethod_toStackTraceElement(HotSpotResolvedJavaMethod method, int bci); |
952 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1toStackTraceElement(JNIEnv *env, jobject, jobject hotspot_method, int bci) { | 952 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1toStackTraceElement(JNIEnv *env, jobject, jobject hotspot_method, int bci) { |
953 TRACE_graal_3("CompilerToVM::RiMethod_toStackTraceElement"); | 953 TRACE_graal_3("CompilerToVM::JavaMethod_toStackTraceElement"); |
954 | 954 |
955 VM_ENTRY_MARK; | 955 VM_ENTRY_MARK; |
956 ResourceMark rm; | 956 ResourceMark rm; |
957 HandleMark hm; | 957 HandleMark hm; |
958 | 958 |
1060 JavaCalls::call(&result, actualMethod, nm, &args, CHECK_NULL); | 1060 JavaCalls::call(&result, actualMethod, nm, &args, CHECK_NULL); |
1061 | 1061 |
1062 return JNIHandles::make_local((oop) result.get_jobject()); | 1062 return JNIHandles::make_local((oop) result.get_jobject()); |
1063 } | 1063 } |
1064 | 1064 |
1065 // public native int RiMethod_vtableEntryOffset(HotSpotMethodResolved method); | 1065 // public native int JavaMethod_vtableEntryOffset(HotSpotResolvedJavaMethod method); |
1066 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_vtableEntryOffset(JNIEnv *, jobject, jobject hotspot_method) { | 1066 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_vtableEntryOffset(JNIEnv *, jobject, jobject hotspot_method) { |
1067 TRACE_graal_3("CompilerToVM::RiMethod_vtableEntryOffset"); | 1067 TRACE_graal_3("CompilerToVM::JavaMethod_vtableEntryOffset"); |
1068 | 1068 |
1069 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | 1069 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
1070 assert(!instanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); | 1070 assert(!instanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); |
1071 | 1071 |
1072 // get entry offset in words | 1072 // get entry offset in words |
1120 #define CC (char*) /*cast a literal from (const char*)*/ | 1120 #define CC (char*) /*cast a literal from (const char*)*/ |
1121 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_##f)) | 1121 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_##f)) |
1122 | 1122 |
1123 #define PROXY "J" | 1123 #define PROXY "J" |
1124 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" | 1124 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" |
1125 #define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotTypeResolved;" | 1125 #define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;" |
1126 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" | 1126 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" |
1127 #define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethodResolved;" | 1127 #define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;" |
1128 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" | 1128 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" |
1129 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" | 1129 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" |
1130 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" | 1130 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" |
1131 #define RESOLVED_FIELD "Lcom/oracle/graal/api/meta/ResolvedJavaField;" | 1131 #define RESOLVED_FIELD "Lcom/oracle/graal/api/meta/ResolvedJavaField;" |
1132 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" | 1132 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" |
1144 #define OBJECT "Ljava/lang/Object;" | 1144 #define OBJECT "Ljava/lang/Object;" |
1145 #define CLASS "Ljava/lang/Class;" | 1145 #define CLASS "Ljava/lang/Class;" |
1146 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" | 1146 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
1147 | 1147 |
1148 JNINativeMethod CompilerToVM_methods[] = { | 1148 JNINativeMethod CompilerToVM_methods[] = { |
1149 {CC"RiMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(RiMethod_1code)}, | 1149 {CC"JavaMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(JavaMethod_1code)}, |
1150 {CC"RiMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(RiMethod_1signature)}, | 1150 {CC"JavaMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(JavaMethod_1signature)}, |
1151 {CC"RiMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(RiMethod_1exceptionHandlers)}, | 1151 {CC"JavaMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(JavaMethod_1exceptionHandlers)}, |
1152 {CC"RiMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasBalancedMonitors)}, | 1152 {CC"JavaMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasBalancedMonitors)}, |
1153 {CC"RiMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(RiMethod_1uniqueConcreteMethod)}, | 1153 {CC"JavaMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(JavaMethod_1uniqueConcreteMethod)}, |
1154 {CC"getRiMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getRiMethod)}, | 1154 {CC"getJavaMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getJavaMethod)}, |
1155 {CC"RiMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(RiMethod_1methodData)}, | 1155 {CC"JavaMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(JavaMethod_1methodData)}, |
1156 {CC"RiMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1invocationCount)}, | 1156 {CC"JavaMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1invocationCount)}, |
1157 {CC"RiMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasCompiledCode)}, | 1157 {CC"JavaMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasCompiledCode)}, |
1158 {CC"RiMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1getCompiledCodeSize)}, | 1158 {CC"JavaMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1getCompiledCodeSize)}, |
1159 {CC"RiSignature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(RiSignature_1lookupType)}, | 1159 {CC"Signature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(Signature_1lookupType)}, |
1160 {CC"RiConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(RiConstantPool_1lookupConstant)}, | 1160 {CC"ConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(ConstantPool_1lookupConstant)}, |
1161 {CC"RiConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(RiConstantPool_1lookupMethod)}, | 1161 {CC"ConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(ConstantPool_1lookupMethod)}, |
1162 {CC"RiConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(RiConstantPool_1lookupType)}, | 1162 {CC"ConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(ConstantPool_1lookupType)}, |
1163 {CC"RiConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(RiConstantPool_1loadReferencedType)}, | 1163 {CC"ConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(ConstantPool_1loadReferencedType)}, |
1164 {CC"RiConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(RiConstantPool_1lookupField)}, | 1164 {CC"ConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(ConstantPool_1lookupField)}, |
1165 {CC"RiType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(RiType_3resolveMethodImpl)}, | 1165 {CC"JavaType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(JavaType_3resolveMethodImpl)}, |
1166 {CC"RiType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(RiType_2isSubtypeOf)}, | 1166 {CC"JavaType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(JavaType_2isSubtypeOf)}, |
1167 {CC"RiType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(RiType_2leastCommonAncestor)}, | 1167 {CC"JavaType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_2leastCommonAncestor)}, |
1168 {CC"RiType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1componentType)}, | 1168 {CC"JavaType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1componentType)}, |
1169 {CC"RiType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1uniqueConcreteSubtype)}, | 1169 {CC"JavaType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1uniqueConcreteSubtype)}, |
1170 {CC"RiType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1superType)}, | 1170 {CC"JavaType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1superType)}, |
1171 {CC"RiType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1arrayOf)}, | 1171 {CC"JavaType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1arrayOf)}, |
1172 {CC"RiType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(RiType_1fields)}, | 1172 {CC"JavaType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(JavaType_1fields)}, |
1173 {CC"RiType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(RiType_1isInitialized)}, | 1173 {CC"JavaType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(JavaType_1isInitialized)}, |
1174 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, | 1174 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, |
1175 {CC"getMaxCallTargetOffset", CC"("CI_RUNTIME_CALL")J", FN_PTR(getMaxCallTargetOffset)}, | 1175 {CC"getMaxCallTargetOffset", CC"("CI_RUNTIME_CALL")J", FN_PTR(getMaxCallTargetOffset)}, |
1176 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, | 1176 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, |
1177 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(getConfiguration)}, | 1177 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(getConfiguration)}, |
1178 {CC"installMethod", CC"("TARGET_METHOD"Z"HS_CODE_INFO")"HS_COMP_METHOD, FN_PTR(installMethod)}, | 1178 {CC"installMethod", CC"("TARGET_METHOD"Z"HS_CODE_INFO")"HS_COMP_METHOD, FN_PTR(installMethod)}, |
1179 {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, | 1179 {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, |
1180 {CC"disassembleJava", CC"("RESOLVED_METHOD")"STRING, FN_PTR(disassembleJava)}, | 1180 {CC"disassembleJava", CC"("RESOLVED_METHOD")"STRING, FN_PTR(disassembleJava)}, |
1181 {CC"RiMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(RiMethod_1toStackTraceElement)}, | 1181 {CC"JavaMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(JavaMethod_1toStackTraceElement)}, |
1182 {CC"executeCompiledMethod", CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, | 1182 {CC"executeCompiledMethod", CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, |
1183 {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, | 1183 {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, |
1184 {CC"RiMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_vtableEntryOffset)}, | 1184 {CC"JavaMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_vtableEntryOffset)}, |
1185 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, | 1185 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, |
1186 {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, | 1186 {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, |
1187 }; | 1187 }; |
1188 | 1188 |
1189 int CompilerToVM_methods_count() { | 1189 int CompilerToVM_methods_count() { |