< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java
Print this page
@@ -646,15 +646,37 @@
public final long checkcastArraycopy = getFieldValue("StubRoutines::_checkcast_arraycopy", Long.class, "address");
public final long checkcastArraycopyUninit = getFieldValue("StubRoutines::_checkcast_arraycopy_uninit", Long.class, "address");
public final long unsafeArraycopy = getFieldValue("StubRoutines::_unsafe_arraycopy", Long.class, "address");
public final long genericArraycopy = getFieldValue("StubRoutines::_generic_arraycopy", Long.class, "address");
+ // Allocation stubs that throw an exception when allocation fails
public final long newInstanceAddress = getAddress("JVMCIRuntime::new_instance");
public final long newArrayAddress = getAddress("JVMCIRuntime::new_array");
public final long newMultiArrayAddress = getAddress("JVMCIRuntime::new_multi_array");
- public final long dynamicNewArrayAddress = getAddress("JVMCIRuntime::dynamic_new_array");
- public final long dynamicNewInstanceAddress = getAddress("JVMCIRuntime::dynamic_new_instance");
+
+ // Allocation stubs that return null when allocation fails
+ public final long newInstanceOrNullAddress = getAddress("JVMCIRuntime::new_instance_or_null", 0L);
+ public final long newArrayOrNullAddress = getAddress("JVMCIRuntime::new_array_or_null", 0L);
+ public final long newMultiArrayOrNullAddress = getAddress("JVMCIRuntime::new_multi_array_or_null", 0L);
+
+ public boolean areNullAllocationStubsAvailable() {
+ return newInstanceOrNullAddress != 0L;
+ }
+
+ /**
+ * Checks that HotSpot implements all or none of the allocate-or-null stubs.
+ */
+ private boolean checkNullAllocationStubs() {
+ if (newInstanceOrNullAddress == 0L) {
+ assert newArrayOrNullAddress == 0L;
+ assert newMultiArrayOrNullAddress == 0L;
+ } else {
+ assert newArrayOrNullAddress != 0L;
+ assert newMultiArrayOrNullAddress != 0L;
+ }
+ return true;
+ }
public final long threadIsInterruptedAddress = getAddress("JVMCIRuntime::thread_is_interrupted");
public final long vmMessageAddress = getAddress("JVMCIRuntime::vm_message");
public final long identityHashCodeAddress = getAddress("JVMCIRuntime::identity_hash_code");
public final long exceptionHandlerForPcAddress = getAddress("JVMCIRuntime::exception_handler_for_pc");
@@ -755,8 +777,9 @@
assert Modifier.isFinal(modifiers) : "field should be final: " + f;
}
}
assert codeEntryAlignment > 0 : codeEntryAlignment;
+ assert checkNullAllocationStubs();
return true;
}
}
< prev index next >