< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page

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




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

2434         case T_FLOAT:         value.f = typeArrayOop(xobj())->float_at(index);         break;
2435         case T_LONG:          value.j = typeArrayOop(xobj())->long_at(index);          break;
2436         case T_INT:           value.i = typeArrayOop(xobj())->int_at(index);            break;
2437         case T_SHORT:         value.s = typeArrayOop(xobj())->short_at(index);          break;
2438         case T_CHAR:          value.c = typeArrayOop(xobj())->char_at(index);           break;
2439         case T_BYTE:          value.b = typeArrayOop(xobj())->byte_at(index);           break;
2440         case T_BOOLEAN:       value.z = typeArrayOop(xobj())->byte_at(index) & 1;       break;
2441         default:              ShouldNotReachHere();
2442       }
2443       result = JVMCIENV->create_box(element_type, &value, JVMCI_CHECK_NULL);
2444     }
2445     assert(!result.is_null(), "must have a value");
2446     return JVMCIENV->get_jobject(result);
2447   }
2448   return nullptr;;
2449 C2V_END
2450 
2451 
2452 C2V_VMENTRY_0(jint, arrayBaseOffset, (JNIEnv* env, jobject, jchar type_char))
2453   BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0);
2454   return arrayOopDesc::header_size(type) * HeapWordSize;
2455 C2V_END
2456 
2457 C2V_VMENTRY_0(jint, arrayIndexScale, (JNIEnv* env, jobject, jchar type_char))
2458   BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0);
2459   return type2aelembytes(type);
2460 C2V_END
2461 
2462 C2V_VMENTRY(void, clearOopHandle, (JNIEnv* env, jobject, jlong oop_handle))
2463   if (oop_handle == 0L) {
2464     JVMCI_THROW(NullPointerException);
2465   }
2466   // Assert before nulling out, for better debugging.
2467   assert(JVMCIRuntime::is_oop_handle(oop_handle), "precondition");
2468   oop* oop_ptr = (oop*) oop_handle;
2469   NativeAccess<>::oop_store(oop_ptr, (oop) nullptr);
2470 C2V_END
2471 
2472 C2V_VMENTRY(void, releaseClearedOopHandles, (JNIEnv* env, jobject))
2473   JVMCIENV->runtime()->release_cleared_oop_handles();
2474 C2V_END

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

2438         case T_FLOAT:         value.f = typeArrayOop(xobj())->float_at(index);         break;
2439         case T_LONG:          value.j = typeArrayOop(xobj())->long_at(index);          break;
2440         case T_INT:           value.i = typeArrayOop(xobj())->int_at(index);            break;
2441         case T_SHORT:         value.s = typeArrayOop(xobj())->short_at(index);          break;
2442         case T_CHAR:          value.c = typeArrayOop(xobj())->char_at(index);           break;
2443         case T_BYTE:          value.b = typeArrayOop(xobj())->byte_at(index);           break;
2444         case T_BOOLEAN:       value.z = typeArrayOop(xobj())->byte_at(index) & 1;       break;
2445         default:              ShouldNotReachHere();
2446       }
2447       result = JVMCIENV->create_box(element_type, &value, JVMCI_CHECK_NULL);
2448     }
2449     assert(!result.is_null(), "must have a value");
2450     return JVMCIENV->get_jobject(result);
2451   }
2452   return nullptr;;
2453 C2V_END
2454 
2455 
2456 C2V_VMENTRY_0(jint, arrayBaseOffset, (JNIEnv* env, jobject, jchar type_char))
2457   BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0);
2458   return arrayOopDesc::base_offset_in_bytes(type);
2459 C2V_END
2460 
2461 C2V_VMENTRY_0(jint, arrayIndexScale, (JNIEnv* env, jobject, jchar type_char))
2462   BasicType type = JVMCIENV->typeCharToBasicType(type_char, JVMCI_CHECK_0);
2463   return type2aelembytes(type);
2464 C2V_END
2465 
2466 C2V_VMENTRY(void, clearOopHandle, (JNIEnv* env, jobject, jlong oop_handle))
2467   if (oop_handle == 0L) {
2468     JVMCI_THROW(NullPointerException);
2469   }
2470   // Assert before nulling out, for better debugging.
2471   assert(JVMCIRuntime::is_oop_handle(oop_handle), "precondition");
2472   oop* oop_ptr = (oop*) oop_handle;
2473   NativeAccess<>::oop_store(oop_ptr, (oop) nullptr);
2474 C2V_END
2475 
2476 C2V_VMENTRY(void, releaseClearedOopHandles, (JNIEnv* env, jobject))
2477   JVMCIENV->runtime()->release_cleared_oop_handles();
2478 C2V_END
< prev index next >