comparison src/share/vm/graal/graalCompilerToVM.cpp @ 4223:e0a4668c57a2

Renaming of VMExits and VMEntries part 4.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 04 Jan 2012 22:08:17 +0100
parents 8e2985cdaaa5
children 874fcc2ddd9d f7251c729b31
comparison
equal deleted inserted replaced
4222:8e2985cdaaa5 4223:e0a4668c57a2
43 methodOop getMethodFromHotSpotMethod(oop hotspot_method) { 43 methodOop getMethodFromHotSpotMethod(oop hotspot_method) {
44 return (methodOop)HotSpotMethodResolved::javaMirror(hotspot_method); 44 return (methodOop)HotSpotMethodResolved::javaMirror(hotspot_method);
45 } 45 }
46 46
47 // public byte[] RiMethod_code(HotSpotResolvedMethod method); 47 // public byte[] RiMethod_code(HotSpotResolvedMethod method);
48 JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { 48 JNIEXPORT jbyteArray JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) {
49 TRACE_graal_3("CompilerToVM::RiMethod_code"); 49 TRACE_graal_3("CompilerToVM::RiMethod_code");
50 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 50 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
51 int code_size = method->code_size(); 51 int code_size = method->code_size();
52 jbyteArray result = env->NewByteArray(code_size); 52 jbyteArray result = env->NewByteArray(code_size);
53 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); 53 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base());
54 return result; 54 return result;
55 } 55 }
56 56
57 // public String RiMethod_signature(HotSpotResolvedMethod method); 57 // public String RiMethod_signature(HotSpotResolvedMethod method);
58 JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { 58 JNIEXPORT jstring JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) {
59 TRACE_graal_3("CompilerToVM::RiMethod_signature"); 59 TRACE_graal_3("CompilerToVM::RiMethod_signature");
60 VM_ENTRY_MARK 60 VM_ENTRY_MARK
61 methodOop method = getMethodFromHotSpotMethod(hotspot_method); 61 methodOop method = getMethodFromHotSpotMethod(hotspot_method);
62 assert(method != NULL && method->signature() != NULL, "signature required"); 62 assert(method != NULL && method->signature() != NULL, "signature required");
63 return VmIds::toString<jstring>(method->signature(), THREAD); 63 return VmIds::toString<jstring>(method->signature(), THREAD);
64 } 64 }
65 65
66 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId); 66 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId);
67 JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { 67 JNIEXPORT jobjectArray JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) {
68 TRACE_graal_3("CompilerToVM::RiMethod_exceptionHandlers"); 68 TRACE_graal_3("CompilerToVM::RiMethod_exceptionHandlers");
69 VM_ENTRY_MARK 69 VM_ENTRY_MARK
70 ResourceMark rm; 70 ResourceMark rm;
71 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 71 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
72 typeArrayHandle handlers = method->exception_table(); 72 typeArrayHandle handlers = method->exception_table();
103 103
104 return (jobjectArray) JNIHandles::make_local(array()); 104 return (jobjectArray) JNIHandles::make_local(array());
105 } 105 }
106 106
107 // public boolean RiMethod_hasBalancedMonitors(long vmId); 107 // public boolean RiMethod_hasBalancedMonitors(long vmId);
108 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { 108 JNIEXPORT jint JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) {
109 TRACE_graal_3("CompilerToVM::RiMethod_hasBalancedMonitors"); 109 TRACE_graal_3("CompilerToVM::RiMethod_hasBalancedMonitors");
110 110
111 VM_ENTRY_MARK; 111 VM_ENTRY_MARK;
112 112
113 // Analyze the method to see if monitors are used properly. 113 // Analyze the method to see if monitors are used properly.
131 } 131 }
132 return true; 132 return true;
133 } 133 }
134 134
135 // public RiMethod getRiMethod(java.lang.reflect.Method reflectionMethod); 135 // public RiMethod getRiMethod(java.lang.reflect.Method reflectionMethod);
136 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getRiMethod(JNIEnv *, jobject, jobject reflection_method_handle) { 136 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_getRiMethod(JNIEnv *, jobject, jobject reflection_method_handle) {
137 TRACE_graal_3("CompilerToVM::getRiMethod"); 137 TRACE_graal_3("CompilerToVM::getRiMethod");
138 VM_ENTRY_MARK; 138 VM_ENTRY_MARK;
139 oop reflection_method = JNIHandles::resolve(reflection_method_handle); 139 oop reflection_method = JNIHandles::resolve(reflection_method_handle);
140 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); 140 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method);
141 int slot = java_lang_reflect_Method::slot(reflection_method); 141 int slot = java_lang_reflect_Method::slot(reflection_method);
144 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); 144 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
145 return JNIHandles::make_local(THREAD, ret()); 145 return JNIHandles::make_local(THREAD, ret());
146 } 146 }
147 147
148 // public boolean RiMethod_uniqueConcreteMethod(long vmId); 148 // public boolean RiMethod_uniqueConcreteMethod(long vmId);
149 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { 149 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) {
150 TRACE_graal_3("CompilerToVM::RiMethod_uniqueConcreteMethod"); 150 TRACE_graal_3("CompilerToVM::RiMethod_uniqueConcreteMethod");
151 151
152 VM_ENTRY_MARK; 152 VM_ENTRY_MARK;
153 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 153 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
154 KlassHandle holder = method->method_holder(); 154 KlassHandle holder = method->method_holder();
175 return JNIHandles::make_local(THREAD, method_resolved()); 175 return JNIHandles::make_local(THREAD, method_resolved());
176 } 176 }
177 } 177 }
178 178
179 // public native int RiMethod_invocationCount(long vmId); 179 // public native int RiMethod_invocationCount(long vmId);
180 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { 180 JNIEXPORT jint JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) {
181 TRACE_graal_3("CompilerToVM::RiMethod_invocationCount"); 181 TRACE_graal_3("CompilerToVM::RiMethod_invocationCount");
182 return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); 182 return getMethodFromHotSpotMethod(hotspot_method)->invocation_count();
183 } 183 }
184 184
185 // public native int RiMethod_exceptionProbability(long vmId, int bci); 185 // public native int RiMethod_exceptionProbability(long vmId, int bci);
186 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2exceptionProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { 186 JNIEXPORT jint JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2exceptionProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) {
187 TRACE_graal_3("CompilerToVM::RiMethod_exceptionProbability"); 187 TRACE_graal_3("CompilerToVM::RiMethod_exceptionProbability");
188 VM_ENTRY_MARK; 188 VM_ENTRY_MARK;
189 ResourceMark rm; 189 ResourceMark rm;
190 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 190 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
191 methodDataHandle method_data = method->method_data(); 191 methodDataHandle method_data = method->method_data();
229 } 229 }
230 return count; 230 return count;
231 } 231 }
232 232
233 // public native RiTypeProfile RiMethod_typeProfile(long vmId, int bci); 233 // public native RiTypeProfile RiMethod_typeProfile(long vmId, int bci);
234 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2typeProfile(JNIEnv *, jobject, jobject hotspot_method, jint bci) { 234 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2typeProfile(JNIEnv *, jobject, jobject hotspot_method, jint bci) {
235 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile"); 235 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile");
236 VM_ENTRY_MARK; 236 VM_ENTRY_MARK;
237 Handle obj; 237 Handle obj;
238 238
239 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 239 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
288 } 288 }
289 } 289 }
290 return JNIHandles::make_local(obj()); 290 return JNIHandles::make_local(obj());
291 } 291 }
292 292
293 JNIEXPORT jdouble JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2branchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { 293 JNIEXPORT jdouble JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2branchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) {
294 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile"); 294 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile");
295 ResourceMark rm; 295 ResourceMark rm;
296 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 296 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
297 methodDataHandle method_data = method->method_data(); 297 methodDataHandle method_data = method->method_data();
298 298
321 else { // Compute probability of true path 321 else { // Compute probability of true path
322 return (jdouble)(taken) / (taken + not_taken); 322 return (jdouble)(taken) / (taken + not_taken);
323 } 323 }
324 } 324 }
325 325
326 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2switchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { 326 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2switchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) {
327 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile"); 327 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile");
328 VM_ENTRY_MARK; 328 VM_ENTRY_MARK;
329 ResourceMark rm; 329 ResourceMark rm;
330 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); 330 methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
331 methodDataHandle method_data = method->method_data(); 331 methodDataHandle method_data = method->method_data();
360 } 360 }
361 return JNIHandles::make_local(probability); 361 return JNIHandles::make_local(probability);
362 } 362 }
363 363
364 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); 364 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method);
365 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { 365 JNIEXPORT jboolean JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) {
366 TRACE_graal_3("CompilerToVM::RiMethod_hasCompiledCode"); 366 TRACE_graal_3("CompilerToVM::RiMethod_hasCompiledCode");
367 return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code(); 367 return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code();
368 } 368 }
369 369
370 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); 370 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass);
371 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { 371 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) {
372 TRACE_graal_3("CompilerToVM::RiSignature_lookupType"); 372 TRACE_graal_3("CompilerToVM::RiSignature_lookupType");
373 VM_ENTRY_MARK; 373 VM_ENTRY_MARK;
374 ResourceMark rm; 374 ResourceMark rm;
375 375
376 Symbol* nameSymbol = VmIds::toSymbol(jname); 376 Symbol* nameSymbol = VmIds::toSymbol(jname);
420 420
421 return JNIHandles::make_local(THREAD, result); 421 return JNIHandles::make_local(THREAD, result);
422 } 422 }
423 423
424 // public Object RiConstantPool_lookupConstant(HotSpotTypeResolved type, int cpi); 424 // public Object RiConstantPool_lookupConstant(HotSpotTypeResolved type, int cpi);
425 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { 425 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) {
426 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupConstant"); 426 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupConstant");
427 VM_ENTRY_MARK; 427 VM_ENTRY_MARK;
428 428
429 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); 429 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
430 430
465 465
466 return JNIHandles::make_local(THREAD, result); 466 return JNIHandles::make_local(THREAD, result);
467 } 467 }
468 468
469 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); 469 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode);
470 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { 470 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) {
471 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupMethod"); 471 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupMethod");
472 VM_ENTRY_MARK; 472 VM_ENTRY_MARK;
473 index = GraalCompiler::to_cp_index_u2(index); 473 index = GraalCompiler::to_cp_index_u2(index);
474 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); 474 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
475 instanceKlassHandle pool_holder(cp->pool_holder()); 475 instanceKlassHandle pool_holder(cp->pool_holder());
488 return JNIHandles::make_local(THREAD, VMToCompiler::createRiMethodUnresolved(name, signature, type, THREAD)); 488 return JNIHandles::make_local(THREAD, VMToCompiler::createRiMethodUnresolved(name, signature, type, THREAD));
489 } 489 }
490 } 490 }
491 491
492 // public RiType RiConstantPool_lookupType(long vmId, int cpi); 492 // public RiType RiConstantPool_lookupType(long vmId, int cpi);
493 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { 493 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) {
494 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupType"); 494 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupType");
495 VM_ENTRY_MARK; 495 VM_ENTRY_MARK;
496 496
497 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); 497 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
498 Handle result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); 498 Handle result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL);
499 return JNIHandles::make_local(THREAD, result()); 499 return JNIHandles::make_local(THREAD, result());
500 } 500 }
501 501
502 // public void RiConstantPool_loadReferencedType(long vmId, int cpi); 502 // public void RiConstantPool_loadReferencedType(long vmId, int cpi);
503 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { 503 JNIEXPORT void JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) {
504 TRACE_graal_3("CompilerToVM::RiConstantPool_loadReferencedType"); 504 TRACE_graal_3("CompilerToVM::RiConstantPool_loadReferencedType");
505 VM_ENTRY_MARK; 505 VM_ENTRY_MARK;
506 506
507 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); 507 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
508 int byteCode = (op & 0xFF); 508 int byteCode = (op & 0xFF);
522 } 522 }
523 } 523 }
524 } 524 }
525 525
526 // public RiField RiConstantPool_lookupField(long vmId, int cpi); 526 // public RiField RiConstantPool_lookupField(long vmId, int cpi);
527 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { 527 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) {
528 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupField"); 528 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupField");
529 VM_ENTRY_MARK; 529 VM_ENTRY_MARK;
530 ResourceMark rm; 530 ResourceMark rm;
531 531
532 index = GraalCompiler::to_cp_index_u2(index); 532 index = GraalCompiler::to_cp_index_u2(index);
631 } 631 }
632 return JNIHandles::make_local(THREAD, field_handle()); 632 return JNIHandles::make_local(THREAD, field_handle());
633 } 633 }
634 634
635 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); 635 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature);
636 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { 636 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) {
637 TRACE_graal_3("CompilerToVM::RiType_resolveMethodImpl"); 637 TRACE_graal_3("CompilerToVM::RiType_resolveMethodImpl");
638 VM_ENTRY_MARK; 638 VM_ENTRY_MARK;
639 639
640 assert(JNIHandles::resolve(resolved_type) != NULL, ""); 640 assert(JNIHandles::resolve(resolved_type) != NULL, "");
641 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type)); 641 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type));
652 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); 652 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
653 return JNIHandles::make_local(THREAD, ret()); 653 return JNIHandles::make_local(THREAD, ret());
654 } 654 }
655 655
656 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other); 656 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other);
657 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { 657 JNIEXPORT jboolean JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) {
658 TRACE_graal_3("CompilerToVM::RiType_isSubtypeOf"); 658 TRACE_graal_3("CompilerToVM::RiType_isSubtypeOf");
659 oop other = JNIHandles::resolve(jother); 659 oop other = JNIHandles::resolve(jother);
660 assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected"); 660 assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected");
661 assert(JNIHandles::resolve(klass) != NULL, ""); 661 assert(JNIHandles::resolve(klass) != NULL, "");
662 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); 662 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass));
670 return false; 670 return false;
671 } 671 }
672 } 672 }
673 673
674 // public RiType RiType_componentType(HotSpotResolvedType klass); 674 // public RiType RiType_componentType(HotSpotResolvedType klass);
675 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1componentType(JNIEnv *, jobject, jobject klass) { 675 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_1componentType(JNIEnv *, jobject, jobject klass) {
676 TRACE_graal_3("CompilerToVM::RiType_componentType"); 676 TRACE_graal_3("CompilerToVM::RiType_componentType");
677 VM_ENTRY_MARK; 677 VM_ENTRY_MARK;
678 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); 678 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass));
679 if(array_klass->oop_is_typeArray()) { 679 if(array_klass->oop_is_typeArray()) {
680 BasicType t = typeArrayKlass::cast(array_klass())->element_type(); 680 BasicType t = typeArrayKlass::cast(array_klass())->element_type();
686 assert(JNIHandles::resolve(klass) != NULL, ""); 686 assert(JNIHandles::resolve(klass) != NULL, "");
687 return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)()); 687 return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)());
688 } 688 }
689 689
690 // public RiType RiType_superType(HotSpotResolvedType klass); 690 // public RiType RiType_superType(HotSpotResolvedType klass);
691 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1superType(JNIEnv *, jobject, jobject klass) { 691 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_1superType(JNIEnv *, jobject, jobject klass) {
692 TRACE_graal_3("CompilerToVM::RiType_superType"); 692 TRACE_graal_3("CompilerToVM::RiType_superType");
693 VM_ENTRY_MARK; 693 VM_ENTRY_MARK;
694 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); 694 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
695 klassOop k; 695 klassOop k;
696 696
707 return NULL; 707 return NULL;
708 } 708 }
709 } 709 }
710 710
711 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); 711 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass);
712 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { 712 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) {
713 TRACE_graal_3("CompilerToVM::RiType_uniqueConcreteSubtype"); 713 TRACE_graal_3("CompilerToVM::RiType_uniqueConcreteSubtype");
714 VM_ENTRY_MARK; 714 VM_ENTRY_MARK;
715 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); 715 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
716 Klass *up_cast = klass_handle->up_cast_abstract(); 716 Klass *up_cast = klass_handle->up_cast_abstract();
717 if (up_cast->is_leaf_class()) { 717 if (up_cast->is_leaf_class()) {
719 } 719 }
720 return NULL; 720 return NULL;
721 } 721 }
722 722
723 // public bool RiType_isInitialized(HotSpotResolvedType klass); 723 // public bool RiType_isInitialized(HotSpotResolvedType klass);
724 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { 724 JNIEXPORT jboolean JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) {
725 TRACE_graal_3("CompilerToVM::RiType_isInitialized"); 725 TRACE_graal_3("CompilerToVM::RiType_isInitialized");
726 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass)); 726 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass));
727 assert(klass != NULL, "method must not be called for primitive types"); 727 assert(klass != NULL, "method must not be called for primitive types");
728 return instanceKlass::cast(klass)->is_initialized(); 728 return instanceKlass::cast(klass)->is_initialized();
729 } 729 }
730 730
731 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); 731 // public RiType RiType_arrayOf(HotSpotTypeResolved klass);
732 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { 732 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) {
733 TRACE_graal_3("CompilerToVM::RiType_arrayOf"); 733 TRACE_graal_3("CompilerToVM::RiType_arrayOf");
734 VM_ENTRY_MARK; 734 VM_ENTRY_MARK;
735 735
736 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); 736 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
737 KlassHandle arr = klass_handle->array_klass(THREAD); 737 KlassHandle arr = klass_handle->array_klass(THREAD);
739 assert(arr->oop_is_array(), ""); 739 assert(arr->oop_is_array(), "");
740 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(arr, name, THREAD)()); 740 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(arr, name, THREAD)());
741 } 741 }
742 742
743 // public RiResolvedField[] RiType_fields(HotSpotTypeResolved klass); 743 // public RiResolvedField[] RiType_fields(HotSpotTypeResolved klass);
744 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1fields(JNIEnv *, jobject, jobject klass) { 744 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_RiType_1fields(JNIEnv *, jobject, jobject klass) {
745 TRACE_graal_3("CompilerToVM::RiType_fields"); 745 TRACE_graal_3("CompilerToVM::RiType_fields");
746 VM_ENTRY_MARK; 746 VM_ENTRY_MARK;
747 ResourceMark rm; 747 ResourceMark rm;
748 748
749 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); 749 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass));
773 } 773 }
774 return JNIHandles::make_local(field_array()); 774 return JNIHandles::make_local(field_array());
775 } 775 }
776 776
777 // public RiType getPrimitiveArrayType(CiKind kind); 777 // public RiType getPrimitiveArrayType(CiKind kind);
778 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { 778 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) {
779 TRACE_graal_3("CompilerToVM::getPrimitiveArrayType"); 779 TRACE_graal_3("CompilerToVM::getPrimitiveArrayType");
780 VM_ENTRY_MARK; 780 VM_ENTRY_MARK;
781 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind)); 781 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind));
782 assert(type != T_OBJECT, "primitive type expecteds"); 782 assert(type != T_OBJECT, "primitive type expecteds");
783 Handle result = GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), CHECK_NULL); 783 Handle result = GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), CHECK_NULL);
784 return JNIHandles::make_local(THREAD, result()); 784 return JNIHandles::make_local(THREAD, result());
785 } 785 }
786 786
787 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall); 787 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall);
788 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { 788 JNIEXPORT jlong JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) {
789 TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset"); 789 TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset");
790 VM_ENTRY_MARK; 790 VM_ENTRY_MARK;
791 oop call = JNIHandles::resolve(rtcall); 791 oop call = JNIHandles::resolve(rtcall);
792 address target_addr = CodeInstaller::runtime_call_target_address(call); 792 address target_addr = CodeInstaller::runtime_call_target_address(call);
793 if (target_addr != 0x0) { 793 if (target_addr != 0x0) {
797 } 797 }
798 return -1; 798 return -1;
799 } 799 }
800 800
801 // public RiType getType(Class<?> javaClass); 801 // public RiType getType(Class<?> javaClass);
802 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { 802 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) {
803 TRACE_graal_3("CompilerToVM::getType"); 803 TRACE_graal_3("CompilerToVM::getType");
804 VM_ENTRY_MARK; 804 VM_ENTRY_MARK;
805 oop javaClassOop = JNIHandles::resolve(javaClass); 805 oop javaClassOop = JNIHandles::resolve(javaClass);
806 if (javaClassOop == NULL) { 806 if (javaClassOop == NULL) {
807 fatal("argument to CompilerToVM.getType must not be NULL"); 807 fatal("argument to CompilerToVM.getType must not be NULL");
843 843
844 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; 844 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT };
845 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); 845 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType);
846 846
847 // public HotSpotVMConfig getConfiguration(); 847 // public HotSpotVMConfig getConfiguration();
848 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getConfiguration(JNIEnv *env, jobject) { 848 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_getConfiguration(JNIEnv *env, jobject) {
849 jclass klass = env->FindClass("com/oracle/max/graal/hotspot/HotSpotVMConfig"); 849 jclass klass = env->FindClass("com/oracle/max/graal/hotspot/HotSpotVMConfig");
850 assert(klass != NULL, "HotSpot vm config class not found"); 850 assert(klass != NULL, "HotSpot vm config class not found");
851 jobject config = env->AllocObject(klass); 851 jobject config = env->AllocObject(klass);
852 #ifdef _WIN64 852 #ifdef _WIN64
853 set_boolean(env, config, "windowsOs", true); 853 set_boolean(env, config, "windowsOs", true);
935 set_int(env, config, "arrayClassElementOffset", objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)); 935 set_int(env, config, "arrayClassElementOffset", objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc));
936 return config; 936 return config;
937 } 937 }
938 938
939 // public HotSpotCompiledMethod installMethod(HotSpotTargetMethod targetMethod, boolean installCode); 939 // public HotSpotCompiledMethod installMethod(HotSpotTargetMethod targetMethod, boolean installCode);
940 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) { 940 JNIEXPORT jobject JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) {
941 VM_ENTRY_MARK; 941 VM_ENTRY_MARK;
942 ResourceMark rm; 942 ResourceMark rm;
943 HandleMark hm; 943 HandleMark hm;
944 Handle targetMethodHandle = JNIHandles::resolve(targetMethod); 944 Handle targetMethodHandle = JNIHandles::resolve(targetMethod);
945 nmethod* nm = NULL; 945 nmethod* nm = NULL;
960 return NULL; 960 return NULL;
961 } 961 }
962 } 962 }
963 963
964 // public long installStub(HotSpotTargetMethod targetMethod, String name); 964 // public long installStub(HotSpotTargetMethod targetMethod, String name);
965 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) { 965 JNIEXPORT jlong JNICALL Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) {
966 VM_ENTRY_MARK; 966 VM_ENTRY_MARK;
967 ResourceMark rm; 967 ResourceMark rm;
968 HandleMark hm; 968 HandleMark hm;
969 Handle targetMethodHandle = JNIHandles::resolve(targetMethod); 969 Handle targetMethodHandle = JNIHandles::resolve(targetMethod);
970 jlong id; 970 jlong id;
975 } 975 }
976 976
977 977
978 978
979 #define CC (char*) /*cast a literal from (const char*)*/ 979 #define CC (char*) /*cast a literal from (const char*)*/
980 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_##f)) 980 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_max_graal_hotspot_bridge_CompilerToVMImpl_##f))
981 981
982 #define PROXY "J" 982 #define PROXY "J"
983 #define TYPE "Lcom/oracle/max/cri/ri/RiType;" 983 #define TYPE "Lcom/oracle/max/cri/ri/RiType;"
984 #define RESOLVED_TYPE "Lcom/oracle/max/graal/hotspot/ri/HotSpotTypeResolved;" 984 #define RESOLVED_TYPE "Lcom/oracle/max/graal/hotspot/ri/HotSpotTypeResolved;"
985 #define METHOD "Lcom/oracle/max/cri/ri/RiMethod;" 985 #define METHOD "Lcom/oracle/max/cri/ri/RiMethod;"