Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1x/c1x_VMEntries.cpp @ 2058:8f033d37798a
Better support for array types.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Tue, 18 Jan 2011 10:19:59 +0100 |
parents | 89bf01e6b049 |
children | 9508a52cbd32 |
comparison
equal
deleted
inserted
replaced
2057:89bf01e6b049 | 2058:8f033d37798a |
---|---|
430 } | 430 } |
431 | 431 |
432 return NULL; | 432 return NULL; |
433 } | 433 } |
434 | 434 |
435 // public RiType RiType_arrayOf(long vmId); | 435 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); |
436 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jlong vmId) { | 436 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { |
437 VM_ENTRY_MARK; | 437 VM_ENTRY_MARK; |
438 | 438 |
439 instanceKlass* klass = instanceKlass::cast(VmIds::get<klassOop>(vmId)); | 439 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
440 KlassHandle array = klass->array_klass(THREAD); | 440 KlassHandle array = klass_handle->array_klass(THREAD); |
441 Handle name = array->name(); | 441 Handle name = VmIds::toString<Handle>(array->name(), CHECK_NULL); |
442 return JNIHandles::make_local(THREAD, C1XCompiler::createHotSpotTypeResolved(array, name, THREAD)); | 442 return JNIHandles::make_local(THREAD, C1XCompiler::createHotSpotTypeResolved(array, name, THREAD)); |
443 } | 443 } |
444 | 444 |
445 // public RiType getPrimitiveArrayType(CiKind kind); | 445 // public RiType getPrimitiveArrayType(CiKind kind); |
446 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { | 446 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { |
452 } | 452 } |
453 | 453 |
454 // public RiType getType(Class<?> javaClass); | 454 // public RiType getType(Class<?> javaClass); |
455 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getType(JNIEnv *env, jobject, jobject javaClass) { | 455 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getType(JNIEnv *env, jobject, jobject javaClass) { |
456 VM_ENTRY_MARK; | 456 VM_ENTRY_MARK; |
457 KlassHandle klass = java_lang_Class::as_klassOop(JNIHandles::resolve(javaClass)); | 457 oop javaClassOop = JNIHandles::resolve(javaClass); |
458 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL); | 458 if (javaClassOop == NULL) { |
459 | 459 fatal("argument to VMEntries.getType must not be NULL"); |
460 oop type = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); | 460 } else if (java_lang_Class::is_primitive(javaClassOop)) { |
461 return JNIHandles::make_local(THREAD, type); | 461 BasicType basicType = java_lang_Class::primitive_type(javaClassOop); |
462 return JNIHandles::make_local(THREAD, VMExits::createRiTypePrimitive((int) basicType, THREAD)); | |
463 } else { | |
464 KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop); | |
465 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL); | |
466 | |
467 oop type = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); | |
468 return JNIHandles::make_local(THREAD, type); | |
469 } | |
462 } | 470 } |
463 | 471 |
464 | 472 |
465 // helpers used to set fields in the HotSpotVMConfig object | 473 // helpers used to set fields in the HotSpotVMConfig object |
466 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) { | 474 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) { |
633 {CC"RiType_constantPool", CC"("RESOLVED_TYPE")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)}, | 641 {CC"RiType_constantPool", CC"("RESOLVED_TYPE")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)}, |
634 {CC"RiType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl)}, | 642 {CC"RiType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl)}, |
635 {CC"RiType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf)}, | 643 {CC"RiType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf)}, |
636 {CC"RiType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType)}, | 644 {CC"RiType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType)}, |
637 {CC"RiType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype)}, | 645 {CC"RiType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype)}, |
638 {CC"RiType_arrayOf", CC"("PROXY")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf)}, | 646 {CC"RiType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf)}, |
639 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType)}, | 647 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType)}, |
640 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getType)}, | 648 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getType)}, |
641 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)}, | 649 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)}, |
642 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)}, | 650 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)}, |
643 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)}, | 651 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)}, |