@Override ConstantPool getConstantPool() { ConstantPool cpInst; try { cpInst = CompilerToVMHelper.getConstantPool(null, getPtrToCpAddress()); Field field = CompilerToVMHelper.HotSpotConstantPoolClass() .getDeclaredField("metaspaceConstantPool"); field.setAccessible(true); field.set(cpInst, getPtrToCpAddress()); } catch (ReflectiveOperationException e) { throw new Error("TESTBUG : " + e.getMessage(), e); } return CompilerToVMHelper.getConstantPool(cpInst, 0L); }
@Override ConstantPool getConstantPool() { HotSpotResolvedObjectType type = HotSpotResolvedObjectType.fromObjectClass(OBJECT_TYPE_BASE.getClass()); long ptrToClass = UNSAFE.getKlassPointer(OBJECT_TYPE_BASE); return CompilerToVMHelper.getConstantPool(type, getPtrToCpAddress() - ptrToClass); }
private static void testObjectBase() { try { Object cp = CompilerToVMHelper.getConstantPool(new Object(), 0L); throw new AssertionError( "Test OBJECT_BASE." + " Expected IllegalArgumentException has not been caught"); } catch (IllegalArgumentException iae) { // expected } }
@Override ConstantPool getConstantPool() { HotSpotResolvedJavaMethod methodInstance = CompilerToVMHelper.getResolvedJavaMethodAtSlot(TEST_CLASS, 0); Field field; try { // jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.metaspaceMethod field = methodInstance.getClass().getDeclaredField("metaspaceMethod"); field.setAccessible(true); field.set(methodInstance, getPtrToCpAddress()); } catch (ReflectiveOperationException e) { throw new Error("TESTBUG : " + e, e); } return CompilerToVMHelper.getConstantPool(methodInstance, 0L); }
private static void testMetaspaceWrapperBase() { try { Object cp = CompilerToVMHelper.getConstantPool( new PublicMetaspaceWrapperObject() { @Override public long getMetaspacePointer() { return getPtrToCpAddress(); } }, 0L); throw new AssertionError( "Test METASPACE_WRAPPER_BASE." + " Expected IllegalArgumentException has not been caught"); } catch (IllegalArgumentException iae) { // expected } }
@Override ConstantPool getConstantPool() { return CompilerToVMHelper.getConstantPool(null, getPtrToCpAddress()); }