Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1x/c1x_VMEntries.cpp @ 2499:ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 26 Apr 2011 16:46:23 +0200 |
parents | 4e5515d09314 |
children | 6594e6d8bfe7 |
comparison
equal
deleted
inserted
replaced
2498:55caa3034872 | 2499:ad9b14650e15 |
---|---|
31 #include "c1x/c1x_VmIds.hpp" | 31 #include "c1x/c1x_VmIds.hpp" |
32 #include "c1/c1_Runtime1.hpp" | 32 #include "c1/c1_Runtime1.hpp" |
33 | 33 |
34 // public byte[] RiMethod_code(long vmId); | 34 // public byte[] RiMethod_code(long vmId); |
35 JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jlong vmId) { | 35 JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jlong vmId) { |
36 TRACE_C1X_3("VMEntries::RiMethod_code"); | |
36 methodHandle method = VmIds::get<methodOop>(vmId); | 37 methodHandle method = VmIds::get<methodOop>(vmId); |
37 int code_size = method->code_size(); | 38 int code_size = method->code_size(); |
38 jbyteArray result = env->NewByteArray(code_size); | 39 jbyteArray result = env->NewByteArray(code_size); |
39 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); | 40 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); |
40 return result; | 41 return result; |
41 } | 42 } |
42 | 43 |
43 // public int RiMethod_maxStackSize(long vmId); | 44 // public int RiMethod_maxStackSize(long vmId); |
44 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jobject, jlong vmId) { | 45 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jobject, jlong vmId) { |
46 TRACE_C1X_3("VMEntries::RiMethod_maxStackSize"); | |
45 return VmIds::get<methodOop>(vmId)->max_stack(); | 47 return VmIds::get<methodOop>(vmId)->max_stack(); |
46 } | 48 } |
47 | 49 |
48 // public int RiMethod_maxLocals(long vmId); | 50 // public int RiMethod_maxLocals(long vmId); |
49 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jobject, jlong vmId) { | 51 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jobject, jlong vmId) { |
52 TRACE_C1X_3("VMEntries::RiMethod_maxLocals"); | |
50 return VmIds::get<methodOop>(vmId)->max_locals(); | 53 return VmIds::get<methodOop>(vmId)->max_locals(); |
51 } | 54 } |
52 | 55 |
53 // public RiType RiMethod_holder(long vmId); | 56 // public RiType RiMethod_holder(long vmId); |
54 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jobject, jlong vmId) { | 57 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jobject, jlong vmId) { |
58 TRACE_C1X_3("VMEntries::RiMethod_holder"); | |
55 VM_ENTRY_MARK | 59 VM_ENTRY_MARK |
56 KlassHandle klass = VmIds::get<methodOop>(vmId)->method_holder(); | 60 KlassHandle klass = VmIds::get<methodOop>(vmId)->method_holder(); |
57 Handle name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); | 61 Handle name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); |
58 oop holder = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); | 62 oop holder = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); |
59 return JNIHandles::make_local(THREAD, holder); | 63 return JNIHandles::make_local(THREAD, holder); |
60 } | 64 } |
61 | 65 |
62 // public String RiMethod_signature(long vmId); | 66 // public String RiMethod_signature(long vmId); |
63 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) { | 67 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) { |
68 TRACE_C1X_3("VMEntries::RiMethod_signature"); | |
64 VM_ENTRY_MARK | 69 VM_ENTRY_MARK |
65 methodOop method = VmIds::get<methodOop>(vmId); | 70 methodOop method = VmIds::get<methodOop>(vmId); |
66 method->constMethod()->exception_table(); | 71 method->constMethod()->exception_table(); |
67 return VmIds::toString<jstring>(method->signature(), THREAD); | 72 return VmIds::toString<jstring>(method->signature(), THREAD); |
68 } | 73 } |
69 | 74 |
70 // public int RiMethod_accessFlags(long vmId); | 75 // public int RiMethod_accessFlags(long vmId); |
71 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jobject, jlong vmId) { | 76 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jobject, jlong vmId) { |
77 TRACE_C1X_3("VMEntries::RiMethod_accessFlags"); | |
72 return VmIds::get<methodOop>(vmId)->access_flags().as_int(); | 78 return VmIds::get<methodOop>(vmId)->access_flags().as_int(); |
73 } | 79 } |
74 | 80 |
75 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId); | 81 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId); |
76 JNIEXPORT jobjectArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jlong vmId) { | 82 JNIEXPORT jobjectArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jlong vmId) { |
83 TRACE_C1X_3("VMEntries::RiMethod_exceptionHandlers"); | |
77 VM_ENTRY_MARK | 84 VM_ENTRY_MARK |
78 methodHandle method = VmIds::get<methodOop>(vmId); | 85 methodHandle method = VmIds::get<methodOop>(vmId); |
79 typeArrayHandle handlers = method->exception_table(); | 86 typeArrayHandle handlers = method->exception_table(); |
80 int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; | 87 int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; |
81 | 88 |
109 return (jobjectArray) JNIHandles::make_local(array()); | 116 return (jobjectArray) JNIHandles::make_local(array()); |
110 } | 117 } |
111 | 118 |
112 // public boolean RiMethod_hasBalancedMonitors(long vmId); | 119 // public boolean RiMethod_hasBalancedMonitors(long vmId); |
113 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jlong vmId) { | 120 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jlong vmId) { |
121 TRACE_C1X_3("VMEntries::RiMethod_hasBalancedMonitors"); | |
114 ciMethod* cimethod; | 122 ciMethod* cimethod; |
115 { | 123 { |
116 VM_ENTRY_MARK; | 124 VM_ENTRY_MARK; |
117 cimethod = (ciMethod*)CURRENT_ENV->get_object(VmIds::get<methodOop>(vmId)); | 125 cimethod = (ciMethod*)CURRENT_ENV->get_object(VmIds::get<methodOop>(vmId)); |
118 } | 126 } |
119 return cimethod->has_balanced_monitors(); | 127 return cimethod->has_balanced_monitors(); |
120 } | 128 } |
121 | 129 |
122 // public boolean RiMethod_uniqueConcreteMethod(long vmId); | 130 // public boolean RiMethod_uniqueConcreteMethod(long vmId); |
123 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jlong vmId) { | 131 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jlong vmId) { |
132 TRACE_C1X_3("VMEntries::RiMethod_uniqueConcreteMethod"); | |
124 VM_ENTRY_MARK; | 133 VM_ENTRY_MARK; |
125 ciMethod* cimethod = (ciMethod*)CURRENT_ENV->get_object(VmIds::get<methodOop>(vmId)); | 134 ciMethod* cimethod = (ciMethod*)CURRENT_ENV->get_object(VmIds::get<methodOop>(vmId)); |
126 if (cimethod->holder()->is_interface()) { | 135 if (cimethod->holder()->is_interface()) { |
127 // Cannot trust interfaces. Because of: | 136 // Cannot trust interfaces. Because of: |
128 // interface I { void foo(); } | 137 // interface I { void foo(); } |
150 return JNIHandles::make_local(THREAD, method_resolved); | 159 return JNIHandles::make_local(THREAD, method_resolved); |
151 } | 160 } |
152 | 161 |
153 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); | 162 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); |
154 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { | 163 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { |
164 TRACE_C1X_3("VMEntries::RiSignature_lookupType"); | |
155 VM_ENTRY_MARK; | 165 VM_ENTRY_MARK; |
156 | 166 |
157 Symbol* nameSymbol = VmIds::toSymbol(jname); | 167 Symbol* nameSymbol = VmIds::toSymbol(jname); |
158 Handle name = JNIHandles::resolve(jname); | 168 Handle name = JNIHandles::resolve(jname); |
159 | 169 |
200 return JNIHandles::make_local(THREAD, result); | 210 return JNIHandles::make_local(THREAD, result); |
201 } | 211 } |
202 | 212 |
203 // public Object RiConstantPool_lookupConstant(long vmId, int cpi); | 213 // public Object RiConstantPool_lookupConstant(long vmId, int cpi); |
204 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jlong vmId, jint index) { | 214 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jlong vmId, jint index) { |
215 TRACE_C1X_3("VMEntries::RiConstantPool_lookupConstant"); | |
205 VM_ENTRY_MARK; | 216 VM_ENTRY_MARK; |
206 | 217 |
207 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); | 218 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); |
208 | 219 |
209 oop result = NULL; | 220 oop result = NULL; |
246 return JNIHandles::make_local(THREAD, result); | 257 return JNIHandles::make_local(THREAD, result); |
247 } | 258 } |
248 | 259 |
249 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); | 260 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); |
250 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) { | 261 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) { |
262 TRACE_C1X_3("VMEntries::RiConstantPool_lookupMethod"); | |
251 VM_ENTRY_MARK; | 263 VM_ENTRY_MARK; |
252 | 264 |
253 index = C1XCompiler::to_cp_index_u2(index); | 265 index = C1XCompiler::to_cp_index_u2(index); |
254 constantPoolHandle cp = VmIds::get<constantPoolOop>(vmId); | 266 constantPoolHandle cp = VmIds::get<constantPoolOop>(vmId); |
255 | 267 |
274 return NULL; | 286 return NULL; |
275 } | 287 } |
276 | 288 |
277 // public RiType RiConstantPool_lookupType(long vmId, int cpi); | 289 // public RiType RiConstantPool_lookupType(long vmId, int cpi); |
278 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jlong vmId, jint index) { | 290 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jlong vmId, jint index) { |
291 TRACE_C1X_3("VMEntries::RiConstantPool_lookupType"); | |
279 VM_ENTRY_MARK; | 292 VM_ENTRY_MARK; |
280 | 293 |
281 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); | 294 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); |
282 | 295 |
283 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); | 296 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); |
286 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD)); | 299 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD)); |
287 } | 300 } |
288 | 301 |
289 // public RiField RiConstantPool_lookupField(long vmId, int cpi); | 302 // public RiField RiConstantPool_lookupField(long vmId, int cpi); |
290 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) { | 303 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) { |
304 TRACE_C1X_3("VMEntries::RiConstantPool_lookupField"); | |
291 VM_ENTRY_MARK; | 305 VM_ENTRY_MARK; |
292 | 306 |
293 index = C1XCompiler::to_cp_index_u2(index); | 307 index = C1XCompiler::to_cp_index_u2(index); |
294 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); | 308 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); |
295 | 309 |
349 return JNIHandles::make_local(THREAD, field_handle()); | 363 return JNIHandles::make_local(THREAD, field_handle()); |
350 } | 364 } |
351 | 365 |
352 // public RiConstantPool RiType_constantPool(HotSpotTypeResolved klass); | 366 // public RiConstantPool RiType_constantPool(HotSpotTypeResolved klass); |
353 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jobject klass) { | 367 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jobject klass) { |
368 TRACE_C1X_3("VMEntries::RiType_constantPool"); | |
354 VM_ENTRY_MARK; | 369 VM_ENTRY_MARK; |
355 | 370 |
356 assert(JNIHandles::resolve(klass) != NULL, ""); | 371 assert(JNIHandles::resolve(klass) != NULL, ""); |
357 constantPoolOop constantPool = ((instanceKlass*)java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))->klass_part())->constants(); | 372 constantPoolOop constantPool = ((instanceKlass*)java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))->klass_part())->constants(); |
358 return JNIHandles::make_local(VMExits::createRiConstantPool(VmIds::add<constantPoolOop>(constantPool), THREAD)); | 373 return JNIHandles::make_local(VMExits::createRiConstantPool(VmIds::add<constantPoolOop>(constantPool), THREAD)); |
359 } | 374 } |
360 | 375 |
361 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); | 376 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); |
362 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { | 377 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { |
378 TRACE_C1X_3("VMEntries::RiType_resolveMethodImpl"); | |
363 VM_ENTRY_MARK; | 379 VM_ENTRY_MARK; |
364 | 380 |
365 assert(JNIHandles::resolve(resolved_type) != NULL, ""); | 381 assert(JNIHandles::resolve(resolved_type) != NULL, ""); |
366 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type)); | 382 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type)); |
367 Symbol* name_symbol = VmIds::toSymbol(name); | 383 Symbol* name_symbol = VmIds::toSymbol(name); |
377 return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add<methodOop>(method), Handle(JNIHandles::resolve(name)), THREAD)); | 393 return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add<methodOop>(method), Handle(JNIHandles::resolve(name)), THREAD)); |
378 } | 394 } |
379 | 395 |
380 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other); | 396 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other); |
381 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { | 397 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { |
398 TRACE_C1X_3("VMEntries::RiType_isSubtypeOf"); | |
382 oop other = JNIHandles::resolve(jother); | 399 oop other = JNIHandles::resolve(jother); |
383 assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected"); | 400 assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected"); |
384 assert(JNIHandles::resolve(klass) != NULL, ""); | 401 assert(JNIHandles::resolve(klass) != NULL, ""); |
385 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); | 402 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); |
386 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other)); | 403 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other)); |
394 } | 411 } |
395 } | 412 } |
396 | 413 |
397 // public RiType RiType_componentType(HotSpotResolvedType klass); | 414 // public RiType RiType_componentType(HotSpotResolvedType klass); |
398 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType(JNIEnv *, jobject, jobject klass) { | 415 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType(JNIEnv *, jobject, jobject klass) { |
416 TRACE_C1X_3("VMEntries::RiType_componentType"); | |
399 ciArrayKlass* array_klass; | 417 ciArrayKlass* array_klass; |
400 { | 418 { |
401 VM_ENTRY_MARK; | 419 VM_ENTRY_MARK; |
402 assert(JNIHandles::resolve(klass) != NULL, ""); | 420 assert(JNIHandles::resolve(klass) != NULL, ""); |
403 array_klass = (ciArrayKlass *) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 421 array_klass = (ciArrayKlass *) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
409 return JNIHandles::make_local(C1XCompiler::get_RiType(element_type, java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)), THREAD)); | 427 return JNIHandles::make_local(C1XCompiler::get_RiType(element_type, java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)), THREAD)); |
410 } | 428 } |
411 | 429 |
412 // public RiType RiType_superType(HotSpotResolvedType klass); | 430 // public RiType RiType_superType(HotSpotResolvedType klass); |
413 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1superType(JNIEnv *, jobject, jobject klass) { | 431 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1superType(JNIEnv *, jobject, jobject klass) { |
432 TRACE_C1X_3("VMEntries::RiType_superType"); | |
433 VM_ENTRY_MARK; | |
434 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | |
435 ciInstanceKlass* k = NULL; | |
436 | |
437 if (klass_handle->oop_is_array()) { | |
438 k = (ciInstanceKlass *) CURRENT_ENV->get_object(SystemDictionary::Object_klass()); | |
439 } else { | |
440 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); | |
441 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); | |
442 k = k->super(); | |
443 } | |
444 | |
445 if (k != NULL) { | |
446 return JNIHandles::make_local(C1XCompiler::get_RiType(k, klass_handle, THREAD)); | |
447 } else { | |
448 return NULL; | |
449 } | |
450 } | |
451 | |
452 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); | |
453 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { | |
454 TRACE_C1X_3("VMEntries::RiType_uniqueConcreteSubtype"); | |
414 Thread* THREAD = Thread::current(); | 455 Thread* THREAD = Thread::current(); |
415 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 456 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
416 ciInstanceKlass* k = NULL; | 457 ciInstanceKlass* k = NULL; |
417 { | 458 { |
418 VM_ENTRY_MARK; | 459 VM_ENTRY_MARK; |
419 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); | 460 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); |
420 if (k->super() == NULL) return NULL; | |
421 return JNIHandles::make_local(C1XCompiler::get_RiType(k->super(), klass_handle, THREAD)); | |
422 } | |
423 } | |
424 | |
425 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); | |
426 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { | |
427 | |
428 Thread* THREAD = Thread::current(); | |
429 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | |
430 ciInstanceKlass* k = NULL; | |
431 { | |
432 VM_ENTRY_MARK; | |
433 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); | |
434 } | 461 } |
435 | 462 |
436 if (k->is_abstract()) { | 463 if (k->is_abstract()) { |
437 ciInstanceKlass* sub = k->unique_concrete_subklass(); | 464 ciInstanceKlass* sub = k->unique_concrete_subklass(); |
438 if (sub != NULL && sub->is_leaf_type()) { | 465 if (sub != NULL && sub->is_leaf_type()) { |
447 return NULL; | 474 return NULL; |
448 } | 475 } |
449 | 476 |
450 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); | 477 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); |
451 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { | 478 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { |
479 TRACE_C1X_3("VMEntries::RiType_arrayOf"); | |
452 VM_ENTRY_MARK; | 480 VM_ENTRY_MARK; |
453 | 481 |
454 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 482 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
455 KlassHandle array = klass_handle->array_klass(THREAD); | 483 KlassHandle array = klass_handle->array_klass(THREAD); |
456 Handle name = VmIds::toString<Handle>(array->name(), CHECK_NULL); | 484 Handle name = VmIds::toString<Handle>(array->name(), CHECK_NULL); |
457 return JNIHandles::make_local(THREAD, C1XCompiler::createHotSpotTypeResolved(array, name, THREAD)); | 485 return JNIHandles::make_local(THREAD, C1XCompiler::createHotSpotTypeResolved(array, name, THREAD)); |
458 } | 486 } |
459 | 487 |
460 // public RiType getPrimitiveArrayType(CiKind kind); | 488 // public RiType getPrimitiveArrayType(CiKind kind); |
461 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { | 489 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { |
490 TRACE_C1X_3("VMEntries::VMEntries_getPrimitiveArrayType"); | |
462 VM_ENTRY_MARK; | 491 VM_ENTRY_MARK; |
463 BasicType type = C1XCompiler::kindToBasicType(CiKind::typeChar(kind)); | 492 BasicType type = C1XCompiler::kindToBasicType(CiKind::typeChar(kind)); |
464 assert(type != T_OBJECT, "primitive type expecteds"); | 493 assert(type != T_OBJECT, "primitive type expecteds"); |
465 ciKlass* klass = ciTypeArrayKlass::make(type); | 494 ciKlass* klass = ciTypeArrayKlass::make(type); |
466 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, KlassHandle(), THREAD)); | 495 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, KlassHandle(), THREAD)); |
467 } | 496 } |
468 | 497 |
469 // public RiType getType(Class<?> javaClass); | 498 // public RiType getType(Class<?> javaClass); |
470 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getType(JNIEnv *env, jobject, jobject javaClass) { | 499 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getType(JNIEnv *env, jobject, jobject javaClass) { |
500 TRACE_C1X_3("VMEntries::VMEntries_getType"); | |
471 VM_ENTRY_MARK; | 501 VM_ENTRY_MARK; |
472 oop javaClassOop = JNIHandles::resolve(javaClass); | 502 oop javaClassOop = JNIHandles::resolve(javaClass); |
473 if (javaClassOop == NULL) { | 503 if (javaClassOop == NULL) { |
474 fatal("argument to VMEntries.getType must not be NULL"); | 504 fatal("argument to VMEntries.getType must not be NULL"); |
475 return NULL; | 505 return NULL; |