< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page

 422     JVMCI_THROW_NULL(NullPointerException);
 423   }
 424   if (!is_klass) {
 425     cp = (UNPACK_PAIR(Method, klass_or_method))->constMethod()->constants();
 426   } else {
 427     cp = InstanceKlass::cast(UNPACK_PAIR(Klass, klass_or_method))->constants();
 428   }
 429 
 430   JVMCIObject result = JVMCIENV->get_jvmci_constant_pool(constantPoolHandle(THREAD, cp), JVMCI_CHECK_NULL);
 431   return JVMCIENV->get_jobject(result);
 432 }
 433 
 434 C2V_VMENTRY_NULL(jobject, getResolvedJavaType0, (JNIEnv* env, jobject, jobject base, jlong offset, jboolean compressed))
 435   JVMCIObject base_object = JVMCIENV->wrap(base);
 436   if (base_object.is_null()) {
 437     JVMCI_THROW_MSG_NULL(NullPointerException, "base object is null");
 438   }
 439 
 440   const char* base_desc = nullptr;
 441   JVMCIKlassHandle klass(THREAD);
 442   if (offset == oopDesc::klass_offset_in_bytes()) {




 443     if (JVMCIENV->isa_HotSpotObjectConstantImpl(base_object)) {
 444       Handle base_oop = JVMCIENV->asConstant(base_object, JVMCI_CHECK_NULL);
 445       klass = base_oop->klass();
 446     } else {
 447       goto unexpected;
 448     }
 449   } else if (!compressed) {
 450     if (JVMCIENV->isa_HotSpotConstantPool(base_object)) {
 451       ConstantPool* cp = JVMCIENV->asConstantPool(base_object);
 452       if (offset == in_bytes(ConstantPool::pool_holder_offset())) {
 453         klass = cp->pool_holder();
 454       } else {
 455         base_desc = FormatBufferResource("[constant pool for %s]", cp->pool_holder()->signature_name());
 456         goto unexpected;
 457       }
 458     } else if (JVMCIENV->isa_HotSpotResolvedObjectTypeImpl(base_object)) {
 459       Klass* base_klass = JVMCIENV->asKlass(base_object);
 460       if (offset == in_bytes(Klass::subklass_offset())) {
 461         klass = base_klass->subklass();
 462       } else if (offset == in_bytes(Klass::super_offset())) {

 422     JVMCI_THROW_NULL(NullPointerException);
 423   }
 424   if (!is_klass) {
 425     cp = (UNPACK_PAIR(Method, klass_or_method))->constMethod()->constants();
 426   } else {
 427     cp = InstanceKlass::cast(UNPACK_PAIR(Klass, klass_or_method))->constants();
 428   }
 429 
 430   JVMCIObject result = JVMCIENV->get_jvmci_constant_pool(constantPoolHandle(THREAD, cp), JVMCI_CHECK_NULL);
 431   return JVMCIENV->get_jobject(result);
 432 }
 433 
 434 C2V_VMENTRY_NULL(jobject, getResolvedJavaType0, (JNIEnv* env, jobject, jobject base, jlong offset, jboolean compressed))
 435   JVMCIObject base_object = JVMCIENV->wrap(base);
 436   if (base_object.is_null()) {
 437     JVMCI_THROW_MSG_NULL(NullPointerException, "base object is null");
 438   }
 439 
 440   const char* base_desc = nullptr;
 441   JVMCIKlassHandle klass(THREAD);
 442 
 443   // With compact object headers, we can test for the explicit offset within
 444   // the header to figure out if compiler code is accessing the class.
 445   int klass_offset = UseCompactObjectHeaders ? 4 : oopDesc::klass_offset_in_bytes();
 446   if (offset == klass_offset) {
 447     if (JVMCIENV->isa_HotSpotObjectConstantImpl(base_object)) {
 448       Handle base_oop = JVMCIENV->asConstant(base_object, JVMCI_CHECK_NULL);
 449       klass = base_oop->klass();
 450     } else {
 451       goto unexpected;
 452     }
 453   } else if (!compressed) {
 454     if (JVMCIENV->isa_HotSpotConstantPool(base_object)) {
 455       ConstantPool* cp = JVMCIENV->asConstantPool(base_object);
 456       if (offset == in_bytes(ConstantPool::pool_holder_offset())) {
 457         klass = cp->pool_holder();
 458       } else {
 459         base_desc = FormatBufferResource("[constant pool for %s]", cp->pool_holder()->signature_name());
 460         goto unexpected;
 461       }
 462     } else if (JVMCIENV->isa_HotSpotResolvedObjectTypeImpl(base_object)) {
 463       Klass* base_klass = JVMCIENV->asKlass(base_object);
 464       if (offset == in_bytes(Klass::subklass_offset())) {
 465         klass = base_klass->subklass();
 466       } else if (offset == in_bytes(Klass::super_offset())) {
< prev index next >