From e0d9c65f9adc239301ec1482e77aaafa56858003 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Fri, 6 Sep 2024 20:58:37 +0200 Subject: [PATCH] rename GuestGraal to LibGraal --- .../core/test/VerifySystemPropertyUsage.java | 4 +- .../test/LibGraalCompilationDriver.java | 3 +- .../hotspot/test/LibGraalCompilerTest.java | 2 +- .../hotspot/HotSpotGraalOptionValues.java | 2 +- .../{guestgraal => libgraal}/BuildTime.java | 20 ++-- .../CompilerConfig.java | 2 +- .../{guestgraal => libgraal}/RunTime.java | 8 +- .../truffle/BuildTime.java | 6 +- .../truffle/GraalEntryPoints.java | 2 +- .../truffle/HSConsumer.java | 4 +- .../truffle/HSIndirectHandle.java | 4 +- .../truffle/HSTruffleCompilable.java | 4 +- .../truffle/HSTruffleCompilationTask.java | 4 +- .../truffle/HSTruffleCompilerListener.java | 4 +- .../truffle/HSTruffleCompilerRuntime.java | 4 +- .../HSTruffleSourceLanguagePosition.java | 4 +- .../LibGraalTruffleHostEnvironment.java | 2 +- .../LibGraalTruffleHostEnvironmentLookup.java | 2 +- .../truffle/NativeImageHostCalls.java | 19 ++-- .../truffle/TruffleLibGraalShutdownHook.java | 4 +- .../compiler/nodes/NamedLocationIdentity.java | 2 +- .../graal/compiler/options/OptionsParser.java | 14 +-- .../serviceprovider/GraalServices.java | 2 +- substratevm/mx.substratevm/mx_substratevm.py | 4 +- substratevm/mx.substratevm/suite.py | 8 +- .../svm/core/hub/ClassForNameSupport.java | 18 +-- .../hotspot/libgraal}/FromLibGraalCalls.java | 2 +- .../libgraal/LibGraalClassLoader.java} | 10 +- .../libgraal/LibGraalCompilerSupport.java} | 8 +- .../libgraal/LibGraalEntryPoints.java} | 82 +++++++------- .../hotspot/libgraal/LibGraalFeature.java} | 104 ++++++++---------- .../LibGraalFieldsOffsetsFeature.java} | 24 ++-- .../LibGraalNativeBridgeSupport.java} | 10 +- .../libgraal}/LibGraalObjectHandleScope.java | 2 +- .../libgraal}/LibGraalObjectHandles.java | 2 +- .../libgraal/LibGraalSubstitutions.java} | 90 +++++++-------- .../libgraal}/NativeImageHostEntryPoints.java | 2 +- .../libgraal}/TruffleFromLibGraalCalls.java | 2 +- .../TruffleFromLibGraalStartPoints.java | 98 ++++++++--------- .../svm/graal/hotspot/GetCompilerConfig.java | 2 +- .../svm/graal/hotspot/GetJNIConfig.java | 2 +- .../hotspot/libgraal/LibGraalObject.java | 2 +- .../hotspot/libgraal/LibGraalScope.java | 8 +- 43 files changed, 296 insertions(+), 306 deletions(-) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/BuildTime.java (93%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/CompilerConfig.java (99%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/RunTime.java (97%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/BuildTime.java (97%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/GraalEntryPoints.java (99%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSConsumer.java (95%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSIndirectHandle.java (95%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSTruffleCompilable.java (98%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSTruffleCompilationTask.java (97%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSTruffleCompilerListener.java (96%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSTruffleCompilerRuntime.java (98%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/HSTruffleSourceLanguagePosition.java (96%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/LibGraalTruffleHostEnvironment.java (98%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/LibGraalTruffleHostEnvironmentLookup.java (98%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/NativeImageHostCalls.java (87%) rename compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/{guestgraal => libgraal}/truffle/TruffleLibGraalShutdownHook.java (94%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal}/FromLibGraalCalls.java (99%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalClassLoader.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalClassLoader.java} (97%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalCompilerSupport.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalCompilerSupport.java} (92%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraal.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalEntryPoints.java} (94%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFeature.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFeature.java} (83%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFieldsOffsetsFeature.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFieldsOffsetsFeature.java} (95%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalNativeBridgeSupport.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalNativeBridgeSupport.java} (89%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal}/LibGraalObjectHandleScope.java (97%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal}/LibGraalObjectHandles.java (98%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalSubstitutions.java => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalSubstitutions.java} (82%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal}/NativeImageHostEntryPoints.java (98%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal}/TruffleFromLibGraalCalls.java (97%) rename substratevm/src/{com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal => com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal}/TruffleFromLibGraalStartPoints.java (78%) diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifySystemPropertyUsage.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifySystemPropertyUsage.java index 7878dc498d8a..cf4efbbe9400 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifySystemPropertyUsage.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifySystemPropertyUsage.java @@ -42,8 +42,8 @@ * System properties can be modified by application code so {@link GraalServices#getSavedProperty} * should be used instead. *

- * In the context of GuestGraal, JVMCI code is run at image build time in a non-boot class loader - * and so JVMCI native methods will fail to link (they are only linked by the boot loader). As + * In the context of LibGraal, JVMCI code is run at image build time in a non-boot class loader and + * so JVMCI native methods will fail to link (they are only linked by the boot loader). As * {@link Services#getSavedProperties()} calls a JVMCI native method, it cannot be used during build * time initialization. Instead, {@link GraalServices#getSavedProperties()} must be used. */ diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilationDriver.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilationDriver.java index b078c19c0481..cb8ff8267965 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilationDriver.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilationDriver.java @@ -156,7 +156,8 @@ public HotSpotGraalRuntimeProvider getGraalRuntime() { private static final Unsafe UNSAFE = Unsafe.getUnsafe(); /** - * Implemented by {@code com.oracle.svm.graal.hotspot.guestgraal.GuestGraal#compileMethod}. + * Implemented by + * {@code com.oracle.svm.graal.hotspot.libgraal.LibGraalEntryPoints#compileMethod}. */ public static native long compileMethodInLibgraal(long isolateThread, long methodHandle, diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilerTest.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilerTest.java index 424258880492..ae094cda7b69 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilerTest.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/LibGraalCompilerTest.java @@ -60,7 +60,7 @@ public class LibGraalCompilerTest extends HotSpotGraalCompilerTest { * Computes a hash based on the static final Object fields in {@code typeHandle}. * * Implemented by - * {@code com.oracle.svm.graal.hotspot.guestgraal.GuestGraal#hashConstantOopFields}. + * {@code com.oracle.svm.graal.hotspot.libgraal.LibGraalEntryPoints#hashConstantOopFields}. * * @param isolateThread * @param typeHandle the type whose constant object fields are to be hashed diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java index 6ac4860637ad..5fe1a4b4a3be 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java @@ -112,7 +112,7 @@ public static EconomicMap, Object> parseOptions() { Map savedProps = GraalServices.getSavedProperties(); EconomicMap compilerOptionSettings = EconomicMap.create(); - // Need to use Map as it's a shared type between guest and host in GuestGraal. + // Need to use Map as it's a shared type between guest and host in LibGraal. Map vmOptionSettings = new HashMap<>(); for (Map.Entry e : savedProps.entrySet()) { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/BuildTime.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java similarity index 93% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/BuildTime.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java index 9a79963b77ef..125e6f54bbfa 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/BuildTime.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal; +package jdk.graal.compiler.hotspot.libgraal; import static java.lang.invoke.MethodType.methodType; @@ -62,13 +62,13 @@ /** * This class is used at image build-time when a libgraal image gets built. Its static methods are - * called from {@code com.oracle.svm.graal.hotspot.guestgraal.GuestGraalFeature} before static - * analysis. These methods ensure the static field state of Graal and JVMCI classes loaded by the - * GuestGraalClassLoader is set up correctly for getting built into libgraal. + * called from {@code com.oracle.svm.graal.hotspot.libgraal.LibGraalFeature} before static analysis. + * These methods ensure the static field state of Graal and JVMCI classes loaded by the + * LibGraalClassLoader is set up correctly for getting built into libgraal. */ public class BuildTime { - private static final String VALID_LOADER_NAME = "GuestGraalClassLoader"; + private static final String VALID_LOADER_NAME = "LibGraalClassLoader"; private static final ClassLoader LOADER = BuildTime.class.getClassLoader(); /** @@ -113,14 +113,14 @@ public static Iterable finalizeLibgraalOptions(List optionObjects, Ob @SuppressWarnings("unused") public static long[] getInputEdgesOffsets(Object rawNodeClass) { - /* Used by GuestGraalFieldsOffsetsFeature.IterationMaskRecomputation */ + /* Used by LibGraalFieldsOffsetsFeature.IterationMaskRecomputation */ NodeClass nodeclass = (NodeClass) rawNodeClass; return nodeclass.getInputEdges().getOffsets(); } @SuppressWarnings("unused") public static long[] getSuccessorEdgesOffsets(Object rawNodeClass) { - /* Used by GuestGraalFieldsOffsetsFeature.IterationMaskRecomputation */ + /* Used by LibGraalFieldsOffsetsFeature.IterationMaskRecomputation */ NodeClass nodeclass = (NodeClass) rawNodeClass; return nodeclass.getSuccessorEdges().getOffsets(); } @@ -176,8 +176,8 @@ public static void configureGraalForLibGraal(String arch, serviceLocators.forEach(cachedLocators::add); jvmciServiceLocatorCachedLocatorsField.set(null, cachedLocators); - EconomicMap guestObjects = (EconomicMap) ObjectCopier.decode(encodedGuestObjects, LOADER); - EncodedSnippets encodedSnippets = (EncodedSnippets) guestObjects.get("encodedSnippets"); + EconomicMap libgraalObjects = (EconomicMap) ObjectCopier.decode(encodedGuestObjects, LOADER); + EncodedSnippets encodedSnippets = (EncodedSnippets) libgraalObjects.get("encodedSnippets"); // Mark all the Node classes as allocated so they are available during graph decoding. for (NodeClass nodeClass : encodedSnippets.getSnippetNodeClasses()) { @@ -185,7 +185,7 @@ public static void configureGraalForLibGraal(String arch, } HotSpotReplacementsImpl.setEncodedSnippets(encodedSnippets); - List foreignCallSignatures = (List) guestObjects.get("foreignCallSignatures"); + List foreignCallSignatures = (List) libgraalObjects.get("foreignCallSignatures"); HotSpotForeignCallLinkage.Stubs.initStubs(foreignCallSignatures); hostedGraalSetFoldNodePluginClasses.accept(GeneratedInvocationPlugin.getFoldNodePluginClasses()); diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/CompilerConfig.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/CompilerConfig.java similarity index 99% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/CompilerConfig.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/CompilerConfig.java index 097b704e8e8f..3f5178cc4f5a 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/CompilerConfig.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/CompilerConfig.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal; +package jdk.graal.compiler.hotspot.libgraal; import java.io.IOException; import java.lang.reflect.Field; diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/RunTime.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java similarity index 97% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/RunTime.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java index 4bcdbe44e0e7..20f288c9efde 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/RunTime.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/RunTime.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal; +package jdk.graal.compiler.hotspot.libgraal; import java.util.Arrays; import java.util.Map; @@ -61,7 +61,7 @@ /** * This class provides implementations for {@code @CEntryPoint}s that libgraal has to provide as a * JVM JIT compiler as well as handles (created by {@link BuildTime#getRuntimeHandles}) to other - * utility methods needed by {@code GuestGraalFeature}. + * utility methods needed by {@code LibGraalFeature}. */ public class RunTime { @@ -98,8 +98,8 @@ private static OptionValues decodeOptions(long address, int size, int hash) { /** * This is the implementation that {@code @CEntryPoint}-method - * {@code com.oracle.svm.graal.hotspot.guestgraal.GuestGraal#compileMethod} delegates to. Most - * parameters are identical to the caller method parameters except for the following: + * {@code com.oracle.svm.graal.hotspot.libgraal.LibGraalEntryPoints#compileMethod} delegates to. + * Most parameters are identical to the caller method parameters except for the following: * * @param profileLoadPath value of the {@code Options#LoadProfiles} option or null * @param timeAndMemConsumer allows caller to get info about compile time and memory consumption diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/BuildTime.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/BuildTime.java similarity index 97% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/BuildTime.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/BuildTime.java index ee68a0710d31..591fef6a06e8 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/BuildTime.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/BuildTime.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id; import jdk.graal.compiler.truffle.host.TruffleHostEnvironment; @@ -63,9 +63,9 @@ public static void configureGraalForLibGraal() { * Obtains a {@link Lookup} instance for resolving method handles to invoke Graal and JVMCI * methods. *

- * This method is invoked reflectively by {@code GuestGraalFeature.initializeTruffle()} in the + * This method is invoked reflectively by {@code LibGraalFeature.initializeTruffle()} in the * native-image classloader to facilitate the exchange of lookup instances between the - * native-image classloader and the guest Graal classloader. + * native-image classloader and the LibGraalClassLoader. *

* * @param lookup a {@link Lookup} instance used to resolve handles for calling into the diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/GraalEntryPoints.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/GraalEntryPoints.java similarity index 99% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/GraalEntryPoints.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/GraalEntryPoints.java index ee4adbfc9cac..502a9ec8eb43 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/GraalEntryPoints.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/GraalEntryPoints.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.TruffleCompilable; import com.oracle.truffle.compiler.TruffleCompilerListener.CompilationResultInfo; diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSConsumer.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSConsumer.java similarity index 95% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSConsumer.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSConsumer.java index f4c2eb2c32ed..29237f692c0d 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSConsumer.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSConsumer.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.OptimizedAssumptionDependency; import com.oracle.truffle.compiler.TruffleCompilable; @@ -33,7 +33,7 @@ import java.lang.invoke.MethodHandle; import java.util.function.Consumer; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; final class HSConsumer extends HSIndirectHandle implements Consumer { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSIndirectHandle.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSIndirectHandle.java similarity index 95% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSIndirectHandle.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSIndirectHandle.java index 72b8f54c23f5..184a9e396ac5 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSIndirectHandle.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSIndirectHandle.java @@ -22,12 +22,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import java.util.Objects; /** - * Base class for HS proxy classes loaded by {@code GuestGraalClassLoader} that use + * Base class for HS proxy classes loaded by {@code LibGraalClassLoader} that use * {@link java.lang.invoke.MethodHandle}s to perform JNI calls in a native-image host. * *

diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilable.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilable.java similarity index 98% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilable.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilable.java index 32f527782f00..2973f46ad57f 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilable.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilable.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.TruffleCompilable; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id; @@ -36,7 +36,7 @@ import java.util.Map; import java.util.function.Supplier; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; final class HSTruffleCompilable extends HSIndirectHandle implements TruffleCompilable { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilationTask.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilationTask.java similarity index 97% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilationTask.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilationTask.java index 50407ffd8d5a..ef2fae863c73 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilationTask.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilationTask.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.TruffleCompilable; import com.oracle.truffle.compiler.TruffleCompilationTask; @@ -34,7 +34,7 @@ import java.lang.invoke.MethodHandle; import java.util.Map; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; final class HSTruffleCompilationTask extends HSIndirectHandle implements TruffleCompilationTask { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilerListener.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilerListener.java similarity index 96% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilerListener.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilerListener.java index 393dbcb36cdf..8741ddac9cde 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilerListener.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilerListener.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.TruffleCompilable; import com.oracle.truffle.compiler.TruffleCompilationTask; @@ -32,7 +32,7 @@ import java.lang.invoke.MethodHandle; import java.util.function.Supplier; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; final class HSTruffleCompilerListener extends HSIndirectHandle implements TruffleCompilerListener { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilerRuntime.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilerRuntime.java similarity index 98% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilerRuntime.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilerRuntime.java index 42652cda7bf0..710ec08a3008 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleCompilerRuntime.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleCompilerRuntime.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.ConstantFieldInfo; import com.oracle.truffle.compiler.HostMethodInfo; @@ -51,7 +51,7 @@ import java.util.function.Consumer; import java.util.function.Supplier; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; final class HSTruffleCompilerRuntime extends HSIndirectHandle implements TruffleCompilerRuntime { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleSourceLanguagePosition.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleSourceLanguagePosition.java similarity index 96% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleSourceLanguagePosition.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleSourceLanguagePosition.java index 7215240a7c94..0895789ec68c 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/HSTruffleSourceLanguagePosition.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/HSTruffleSourceLanguagePosition.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.TruffleSourceLanguagePosition; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id; @@ -30,7 +30,7 @@ import java.lang.invoke.MethodHandle; import java.net.URI; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; final class HSTruffleSourceLanguagePosition extends HSIndirectHandle implements TruffleSourceLanguagePosition { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/LibGraalTruffleHostEnvironment.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/LibGraalTruffleHostEnvironment.java similarity index 98% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/LibGraalTruffleHostEnvironment.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/LibGraalTruffleHostEnvironment.java index 8408a29fd85d..a08f7e819792 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/LibGraalTruffleHostEnvironment.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/LibGraalTruffleHostEnvironment.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.HostMethodInfo; import com.oracle.truffle.compiler.TruffleCompilable; diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/LibGraalTruffleHostEnvironmentLookup.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/LibGraalTruffleHostEnvironmentLookup.java similarity index 98% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/LibGraalTruffleHostEnvironmentLookup.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/LibGraalTruffleHostEnvironmentLookup.java index e44ffe7e540f..0f9b55de9792 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/LibGraalTruffleHostEnvironmentLookup.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/LibGraalTruffleHostEnvironmentLookup.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import jdk.graal.compiler.serviceprovider.GlobalAtomicLong; import jdk.graal.compiler.truffle.host.TruffleHostEnvironment; diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/NativeImageHostCalls.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/NativeImageHostCalls.java similarity index 87% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/NativeImageHostCalls.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/NativeImageHostCalls.java index e614ed9eeaf1..89b9f7470b2c 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/NativeImageHostCalls.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/NativeImageHostCalls.java @@ -22,12 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import java.lang.invoke.MethodHandle; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.HSIndirectHandle.handleException; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; /** * Methods to call Native image specific API. @@ -45,7 +44,7 @@ static void initializeHost(long runtimeClass) { try { HANDLES.initializeHost.invoke(runtimeClass); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } @@ -53,7 +52,7 @@ static Object createLocalHandleForLocalReference(long jniLocalHandle) { try { return HANDLES.createLocalHandleForLocalReference.invoke(jniLocalHandle); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } @@ -61,7 +60,7 @@ static Object createLocalHandleForWeakGlobalReference(long jniLocalHandle) { try { return HANDLES.createLocalHandleForWeakGlobalReference.invoke(jniLocalHandle); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } @@ -69,7 +68,7 @@ static Object createGlobalHandle(Object hsHandle, boolean allowGlobalDuplicates) try { return HANDLES.createGlobalHandle.invoke(hsHandle, allowGlobalDuplicates); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } @@ -77,7 +76,7 @@ static boolean isSameObject(Object o1, Object o2) { try { return (boolean) HANDLES.isSameObject.invoke(o1, o2); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } @@ -85,7 +84,7 @@ static long getObjectClass(Object o) { try { return (long) HANDLES.getObjectClass.invoke(o); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } @@ -93,7 +92,7 @@ static Object createTruffleCompilerOptionDescriptor(String name, int type, boole try { return HANDLES.createTruffleCompilerOptionDescriptor.invoke(name, type, deprecated, help, deprecationMessage); } catch (Throwable t) { - throw handleException(t); + throw HSIndirectHandle.handleException(t); } } diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/TruffleLibGraalShutdownHook.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/TruffleLibGraalShutdownHook.java similarity index 94% rename from compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/TruffleLibGraalShutdownHook.java rename to compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/TruffleLibGraalShutdownHook.java index d4451dc5f0cd..8f7c013202fc 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/guestgraal/truffle/TruffleLibGraalShutdownHook.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/TruffleLibGraalShutdownHook.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.graal.compiler.hotspot.guestgraal.truffle; +package jdk.graal.compiler.hotspot.libgraal.truffle; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id; import jdk.graal.compiler.serviceprovider.IsolateUtil; @@ -32,7 +32,7 @@ import java.lang.invoke.MethodHandle; -import static jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime.getHostMethodHandleOrFail; +import static jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime.getHostMethodHandleOrFail; @ServiceProvider(JVMCIServiceLocator.class) public class TruffleLibGraalShutdownHook extends JVMCIServiceLocator { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/NamedLocationIdentity.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/NamedLocationIdentity.java index b34e08e2764b..7dbd211b6f93 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/NamedLocationIdentity.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/NamedLocationIdentity.java @@ -128,7 +128,7 @@ public static LocationIdentity getArrayLocation(JavaKind elementKind) { private static final EnumMap ARRAY_LOCATIONS = new EnumMap<>(JavaKind.class); - // These exist so that GuestGraal construction can read these values from static fields. + // These exist so that libgraal construction can read these values from static fields. public static final LocationIdentity BOOLEAN_ARRAY_LOCATION = initArrayLocation(JavaKind.Boolean); public static final LocationIdentity BYTE_ARRAY_LOCATION = initArrayLocation(JavaKind.Byte); public static final LocationIdentity CHAR_ARRAY_LOCATION = initArrayLocation(JavaKind.Char); diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/options/OptionsParser.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/options/OptionsParser.java index 04e1a02b8f3b..ec9f1335650e 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/options/OptionsParser.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/options/OptionsParser.java @@ -54,8 +54,8 @@ public class OptionsParser { * * @param descriptors set of compiler options available in libgraal. These correspond to the * reachable {@link OptionKey}s discovered during Native Image static analysis. This - * field is only non-null when {@link OptionsParser} is loaded by the GuestGraal - * class loader. + * field is only non-null when {@link OptionsParser} is loaded by the + * LibGraalClassLoader. * @param enterpriseOptions {@linkplain OptionKey#getName() names} of enterprise options */ public record LibGraalOptionsInfo(EconomicMap descriptors, Set enterpriseOptions) { @@ -66,7 +66,7 @@ public static LibGraalOptionsInfo create() { /** * Compiler options info available in libgraal. This field is only non-null when - * {@link OptionsParser} is loaded by the GuestGraal class loader. + * {@link OptionsParser} is loaded by the LibGraalClassLoader. */ private static LibGraalOptionsInfo libgraalOptions; @@ -78,11 +78,11 @@ public static Iterable getOptionsLoader() { if (IS_IN_NATIVE_IMAGE) { return List.of(new OptionDescriptorsMap(Objects.requireNonNull(libgraalOptions.descriptors, "missing options"))); } - boolean inGuestGraal = libgraalOptions != null; - if (inGuestGraal && IS_BUILDING_NATIVE_IMAGE) { + boolean inLibGraal = libgraalOptions != null; + if (inLibGraal && IS_BUILDING_NATIVE_IMAGE) { /* - * Graal code is being run in the context of the GuestGraal loader while building - * libgraal so use the GuestGraal loader to load the OptionDescriptors. + * Graal code is being run in the context of the LibGraalClassLoader while building + * libgraal so use the LibGraalClassLoader to load the OptionDescriptors. */ ClassLoader myCL = OptionsParser.class.getClassLoader(); return ServiceLoader.load(OptionDescriptors.class, myCL); diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java index e75813feacd0..b31038b3a48e 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java @@ -51,7 +51,7 @@ public final class GraalServices { /** * The set of services available in libgraal. This field is only non-null when - * {@link GraalServices} is loaded by the GuestGraal class loader. + * {@link GraalServices} is loaded by the LibGraalClassLoader. */ private static Map, List> libgraalServices; diff --git a/substratevm/mx.substratevm/mx_substratevm.py b/substratevm/mx.substratevm/mx_substratevm.py index f2ff18b58889..052d96dff64c 100644 --- a/substratevm/mx.substratevm/mx_substratevm.py +++ b/substratevm/mx.substratevm/mx_substratevm.py @@ -1428,7 +1428,7 @@ def _native_image_launcher_extra_jvm_args(): libgraal_jar_distributions = [ 'sdk:NATIVEBRIDGE', 'sdk:JNIUTILS', - 'substratevm:GUESTGRAAL_LIBRARY'] + 'substratevm:LIBGRAAL_LIBRARY'] def allow_build_path_in_libgraal(): """ @@ -1459,7 +1459,7 @@ def prevent_build_path_in_libgraal(): return [] libgraal_features = [ - 'com.oracle.svm.graal.hotspot.guestgraal.GuestGraalFeature' + 'com.oracle.svm.graal.hotspot.libgraal.LibGraalFeature' ] libgraal_build_args = [ diff --git a/substratevm/mx.substratevm/suite.py b/substratevm/mx.substratevm/suite.py index 78eeb010f325..1932c4695a0a 100644 --- a/substratevm/mx.substratevm/suite.py +++ b/substratevm/mx.substratevm/suite.py @@ -1314,7 +1314,7 @@ "jacoco" : "exclude", }, - "com.oracle.svm.graal.hotspot.guestgraal" : { + "com.oracle.svm.graal.hotspot.libgraal" : { "subDir": "src", "sourceDirs" : [ "src", @@ -1820,12 +1820,12 @@ "maven" : False, }, - "GUESTGRAAL_LIBRARY": { + "LIBGRAAL_LIBRARY": { "subDir": "src", - "description" : "GuestGraal HotSpot Graal library support", + "description" : "LibGraal feature", "javaCompliance" : "21+", "dependencies": [ - "com.oracle.svm.graal.hotspot.guestgraal", + "com.oracle.svm.graal.hotspot.libgraal", ], "distDependencies": [ "SVM", diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java index 5cb9f6a51e25..7420631d3611 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java @@ -52,9 +52,13 @@ public static ClassForNameSupport singleton() { return ImageSingletons.lookup(ClassForNameSupport.class); } - /** The map used to collect registered classes. */ + /** + * The map used to collect registered classes. + */ private final EconomicMap> knownClasses = ImageHeapMap.create(); - /** The map used to collect unsafe allocated classes. */ + /** + * The map used to collect unsafe allocated classes. + */ private final EconomicMap, RuntimeConditionSet> unsafeInstantiatedClasses = ImageHeapMap.create(); private static final Object NEGATIVE_QUERY = new Object(); @@ -77,11 +81,11 @@ public void registerClass(ConfigurationCondition condition, Class clazz) { /* TODO: Remove workaround once GR-53985 is implemented */ if (currentValue instanceof Class currentClazz && clazz.getClassLoader() != currentClazz.getClassLoader()) { - /* Ensure runtime lookup of GuestGraalClassLoader classes */ - if (isGuestGraalClass(currentClazz)) { + /* Ensure runtime lookup of LibGraalClassLoader classes */ + if (isLibGraalClass(currentClazz)) { return; } - if (isGuestGraalClass(clazz)) { + if (isLibGraalClass(clazz)) { currentValue = null; } } @@ -111,12 +115,12 @@ accessible through the builder class loader, and it was already registered by na } } - private static boolean isGuestGraalClass(Class clazz) { + private static boolean isLibGraalClass(Class clazz) { var loader = clazz.getClassLoader(); if (loader == null) { return false; } - return "GuestGraalClassLoader".equals(loader.getName()); + return "LibGraalClassLoader".equals(loader.getName()); } public static ConditionalRuntimeValue updateConditionalValue(ConditionalRuntimeValue existingConditionalValue, Object newValue, diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/FromLibGraalCalls.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/FromLibGraalCalls.java similarity index 99% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/FromLibGraalCalls.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/FromLibGraalCalls.java index 65c30c89299d..9b1eec61b9cc 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/FromLibGraalCalls.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/FromLibGraalCalls.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import com.oracle.truffle.compiler.hotspot.libgraal.FromLibGraalId; import org.graalvm.jniutils.JNI.JClass; diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalClassLoader.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalClassLoader.java similarity index 97% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalClassLoader.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalClassLoader.java index 46aed05066b4..92d7e1af0602 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalClassLoader.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalClassLoader.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -59,7 +59,7 @@ /** * A classloader, that reads class files and resources from a jimage file at image build time. */ -public class GuestGraalClassLoader extends ClassLoader { +public class LibGraalClassLoader extends ClassLoader { /** * Reader for the image. @@ -112,8 +112,8 @@ public class GuestGraalClassLoader extends ClassLoader { * @param imagePath path to the runtime image of a Java installation */ @Platforms(Platform.HOSTED_ONLY.class) - GuestGraalClassLoader(Path imagePath) { - super("GuestGraalClassLoader", null); + LibGraalClassLoader(Path imagePath) { + super("LibGraalClassLoader", null); Map modulesMap = new HashMap<>(); try { // Need access to jdk.internal.jimage @@ -283,7 +283,7 @@ public URL nextElement() { /** * A {@link URLStreamHandler} for use with URLs returned by - * {@link GuestGraalClassLoader#findResource(java.lang.String)}. + * {@link LibGraalClassLoader#findResource(java.lang.String)}. */ @Platforms(Platform.HOSTED_ONLY.class) private class ImageURLStreamHandler extends URLStreamHandler { diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalCompilerSupport.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalCompilerSupport.java similarity index 92% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalCompilerSupport.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalCompilerSupport.java index 28066bb07b2e..8933ddde6006 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalCompilerSupport.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalCompilerSupport.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import org.graalvm.collections.EconomicMap; import org.graalvm.nativeimage.ImageSingletons; @@ -35,7 +35,7 @@ * Holds data that is pre-computed during native image generation and accessed at run time during a * Graal compilation. */ -public class GuestGraalCompilerSupport { +public class LibGraalCompilerSupport { public final EconomicMap, Object> nodeClasses = ImageHeapMap.create(); public final EconomicMap, Object> instructionClasses = ImageHeapMap.create(); @@ -50,8 +50,8 @@ static void registerStatistics(Class phaseSubClass, EconomicMap, Obj cache.put(phaseSubClass, newStatistics); } - public static GuestGraalCompilerSupport get() { - return ImageSingletons.lookup(GuestGraalCompilerSupport.class); + public static LibGraalCompilerSupport get() { + return ImageSingletons.lookup(LibGraalCompilerSupport.class); } public EconomicMap, Object> getBasePhaseStatistics() { diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraal.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalEntryPoints.java similarity index 94% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraal.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalEntryPoints.java index 911ba9f7b4fe..e6eae57aa24d 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraal.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalEntryPoints.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -51,6 +51,8 @@ import com.oracle.truffle.compiler.TruffleCompilerOptionDescriptor; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleToLibGraal; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleToLibGraal.Id; +import jdk.graal.compiler.hotspot.libgraal.BuildTime; +import jdk.graal.compiler.hotspot.libgraal.RunTime; import jdk.graal.compiler.options.OptionDescriptor; import jdk.graal.compiler.options.OptionDescriptors; import jdk.graal.compiler.options.OptionDescriptorsMap; @@ -92,17 +94,12 @@ import jdk.internal.misc.Unsafe; /** - * Encapsulates {@link CEntryPoint} implementations as well as method handles for invoking guest - * Graal and JVMCI functionality via {@link MethodHandle}s. The method handles are only invoked in - * static methods which allows Native Image to fold them to direct calls to the method handle - * targets. + * Encapsulates {@link CEntryPoint} implementations as well as method handles for invoking LibGraal + * and JVMCI functionality via {@link MethodHandle}s. The method handles (initialized by + * {@link BuildTime#getRuntimeHandles()}) are only invoked in static methods which allows Native + * Image to fold them to direct calls to the method handle targets. */ -final class GuestGraal { - - /* - * See jdk.graal.compiler.hotspot.guestgraal.BuildTime.getRuntimeHandles to see how these - * handles are initialized and what their target methods are. - */ +final class LibGraalEntryPoints { private final MethodHandle getJNIEnv; private final MethodHandle getSavedProperty; @@ -113,14 +110,14 @@ final class GuestGraal { private final MethodHandle detachCurrentThread; /** - * Returns the {@link GuestGraal} instance registered in the {@link ImageSingletons}. + * Returns the {@link LibGraalEntryPoints} instance registered in the {@link ImageSingletons}. */ - private static GuestGraal singleton() { - return ImageSingletons.lookup(GuestGraal.class); + private static LibGraalEntryPoints singleton() { + return ImageSingletons.lookup(LibGraalEntryPoints.class); } @Platforms(Platform.HOSTED_ONLY.class) - GuestGraal(Map handles) { + LibGraalEntryPoints(Map handles) { this.getJNIEnv = handles.get("getJNIEnv"); this.getSavedProperty = handles.get("getSavedProperty"); this.ttyPrintf = handles.get("ttyPrintf"); @@ -131,7 +128,7 @@ private static GuestGraal singleton() { } /** - * Calls {@code jdk.graal.compiler.hotspot.guestgraal.RunTime#getJNIEnv()}. + * Calls {@code jdk.graal.compiler.hotspot.libgraal.RunTime#getJNIEnv()}. */ static JNI.JNIEnv getJNIEnv() { try { @@ -157,6 +154,9 @@ static String getSavedProperty(String name) { } } + /** + * Calls {@link RunTime#attachCurrentThread}. + */ static boolean attachCurrentThread(boolean daemon, long[] isolate) { try { return (boolean) singleton().attachCurrentThread.invoke(daemon, isolate); @@ -167,6 +167,9 @@ static boolean attachCurrentThread(boolean daemon, long[] isolate) { } } + /** + * Calls {@link RunTime#detachCurrentThread}. + */ static boolean detachCurrentThread(boolean release) { try { return (boolean) singleton().detachCurrentThread.invoke(release); @@ -193,6 +196,7 @@ static void ttyPrintf(String format, Object... args) { /** * The implementation of * {@code jdk.graal.compiler.hotspot.test.LibGraalCompilationDriver#compileMethodInLibgraal}. + * Calls {@link RunTime#compileMethod}. * * @param methodHandle the method to be compiled. This is a handle to a * {@code HotSpotResolvedJavaMethod} in HotSpot's heap. A value of 0L can be passed @@ -209,15 +213,15 @@ static void ttyPrintf(String format, Object... args) { * @param stackTraceAddress a native buffer in which a serialized stack trace can be returned. * The caller will only read from this buffer if this method returns 0. A returned * serialized stack trace is returned in this buffer with the following format: - * + * *
-     *            struct {
-     *                int   length;
-     *                byte  data[length]; // Bytes from a stack trace printed to a ByteArrayOutputStream.
-     *            }
+     *               struct {
+     *                   int   length;
+     *                   byte  data[length]; // Bytes from a stack trace printed to a ByteArrayOutputStream.
+     *               }
      *            
* - * where {@code length} truncated to {@code stackTraceCapacity - 4} if necessary + * where {@code length} is truncated to {@code stackTraceCapacity - 4} if necessary * * @param stackTraceCapacity the size of the stack trace buffer * @param timeAndMemBufferAddress 16-byte native buffer to store result of time and memory @@ -227,7 +231,7 @@ static void ttyPrintf(String format, Object... args) { * @return a handle to a {@code InstalledCode} in HotSpot's heap or 0 if compilation failed */ @SuppressWarnings({"unused", "try"}) - @CEntryPoint(name = "Java_jdk_graal_compiler_hotspot_test_LibGraalCompilationDriver_compileMethodInLibgraal", include = GuestGraalFeature.IsEnabled.class) + @CEntryPoint(name = "Java_jdk_graal_compiler_hotspot_test_LibGraalCompilationDriver_compileMethodInLibgraal", include = LibGraalFeature.IsEnabled.class) private static long compileMethod(JNIEnv jniEnv, PointerBase jclass, @IsolateThreadContext long isolateThread, @@ -285,7 +289,7 @@ private static long compileMethod(JNIEnv jniEnv, } } - @CEntryPoint(name = "Java_jdk_graal_compiler_hotspot_test_LibGraalCompilerTest_hashConstantOopFields", include = GuestGraalFeature.IsEnabled.class) + @CEntryPoint(name = "Java_jdk_graal_compiler_hotspot_test_LibGraalCompilerTest_hashConstantOopFields", include = LibGraalFeature.IsEnabled.class) @SuppressWarnings({"unused", "try"}) private static long hashConstantOopFields(JNIEnv jniEnv, PointerBase jclass, @@ -296,7 +300,7 @@ private static long hashConstantOopFields(JNIEnv jniEnv, int oopsPerIteration, boolean verbose) { try (JNIMethodScope scope = new JNIMethodScope("hashConstantOopFields", jniEnv)) { - Runnable doReferenceHandling = GuestGraal::doReferenceHandling; + Runnable doReferenceHandling = LibGraalEntryPoints::doReferenceHandling; return (long) singleton().hashConstantOopFields.invoke(typeHandle, useScope, iterations, oopsPerIteration, verbose, doReferenceHandling); } catch (Throwable t) { JNIExceptionWrapper.throwInHotSpot(jniEnv, t); @@ -310,8 +314,8 @@ private static long hashConstantOopFields(JNIEnv jniEnv, */ static void doReferenceHandling() { Heap.getHeap().doReferenceHandling(); - synchronized (GuestGraalJVMCISubstitutions.Target_jdk_vm_ci_hotspot_Cleaner.class) { - GuestGraalJVMCISubstitutions.Target_jdk_vm_ci_hotspot_Cleaner.clean(); + synchronized (LibGraalJVMCISubstitutions.Target_jdk_vm_ci_hotspot_Cleaner.class) { + LibGraalJVMCISubstitutions.Target_jdk_vm_ci_hotspot_Cleaner.clean(); } } @@ -357,7 +361,7 @@ static void printOptions(PrintStream out, String prefix) { } } -final class GuestGraalLibGraalScope { +final class LibGraalScopeEntryPoints { @CEntryPoint(name = "Java_com_oracle_truffle_runtime_hotspot_libgraal_LibGraalScope_getIsolateThreadIn", builtin = Builtin.GET_CURRENT_THREAD) private static native IsolateThread getIsolateThreadIn(PointerBase env, PointerBase hsClazz, @IsolateContext Isolate isolate); @@ -375,7 +379,7 @@ public static long getIsolateId(PointerBase env, PointerBase jclass, @IsolateThr } } -final class GuestGraalTruffleToLibGraalEntryPoints { +final class LibGraalTruffleToLibGraalEntryPoints { private static volatile int lastJavaPCOffset = -1; @@ -417,7 +421,7 @@ final class GuestGraalTruffleToLibGraalEntryPoints { private final MethodHandle getLastJavaPCOffset; @Platforms(Platform.HOSTED_ONLY.class) - GuestGraalTruffleToLibGraalEntryPoints(Lookup guestGraalLookup, Class graalEntryPoints) { + LibGraalTruffleToLibGraalEntryPoints(Lookup libgraalLookup, Class graalEntryPoints) { try { Map graalMethodByName = Arrays.stream(graalEntryPoints.getDeclaredMethods()).// filter((m) -> Modifier.isStatic(m.getModifiers()) && Modifier.isPublic(m.getModifiers())).// @@ -434,7 +438,7 @@ final class GuestGraalTruffleToLibGraalEntryPoints { String methodName = id.getMethodName(); Method method = graalMethodByName.get(methodName); if (method == null) { - throw VMError.shouldNotReachHere("Missing guest-graal entry method %s.%s corresponding to TruffleToLibGraal.Id.%s. " + + throw VMError.shouldNotReachHere("Missing libgraal entry method %s.%s corresponding to TruffleToLibGraal.Id.%s. " + "To resolve this, add `public static %s()` in %s, where the and correspond to TruffleToLibGraalCalls.%s.", ClassUtil.getUnqualifiedName(graalEntryPoints), methodName, id, methodName, graalEntryPoints.getName(), methodName); } @@ -456,18 +460,18 @@ final class GuestGraalTruffleToLibGraalEntryPoints { ClassUtil.getUnqualifiedName(getClass()), methodName, id, methodName, getClass().getName()); } methodHandleField.setAccessible(true); - methodHandleField.set(this, guestGraalLookup.unreflect(method)); + methodHandleField.set(this, libgraalLookup.unreflect(method)); } Method m = graalMethodByName.get("getCurrentJavaThread"); if (m == null) { - throw VMError.shouldNotReachHere("Missing guest-graal entry method %s.getCurrentJavaThread.", ClassUtil.getUnqualifiedName(graalEntryPoints)); + throw VMError.shouldNotReachHere("Missing libgraal entry method %s.getCurrentJavaThread.", ClassUtil.getUnqualifiedName(graalEntryPoints)); } - getCurrentJavaThread = guestGraalLookup.unreflect(m); + getCurrentJavaThread = libgraalLookup.unreflect(m); m = graalMethodByName.get("getLastJavaPCOffset"); if (m == null) { - throw VMError.shouldNotReachHere("Missing guest-graal entry method %s.getLastJavaPCOffset.", ClassUtil.getUnqualifiedName(graalEntryPoints)); + throw VMError.shouldNotReachHere("Missing libgraal entry method %s.getLastJavaPCOffset.", ClassUtil.getUnqualifiedName(graalEntryPoints)); } - getLastJavaPCOffset = guestGraalLookup.unreflect(m); + getLastJavaPCOffset = libgraalLookup.unreflect(m); } catch (ReflectiveOperationException e) { throw VMError.shouldNotReachHere(e); } @@ -475,7 +479,7 @@ final class GuestGraalTruffleToLibGraalEntryPoints { private static JNIMethodScope openScope(Enum id, JNIEnv env) throws Throwable { Objects.requireNonNull(id, "Id must be non null."); - String scopeName = ClassUtil.getUnqualifiedName(GuestGraalTruffleToLibGraalEntryPoints.class) + "::" + id; + String scopeName = ClassUtil.getUnqualifiedName(LibGraalTruffleToLibGraalEntryPoints.class) + "::" + id; int offset = lastJavaPCOffset; if (offset == -1) { offset = (int) singleton().getLastJavaPCOffset.invoke(); @@ -486,8 +490,8 @@ private static JNIMethodScope openScope(Enum id, JNIEnv env) throws Throwable return LibGraalJNIMethodScope.open(scopeName, env, javaFrameAnchor.isNonNull()); } - private static GuestGraalTruffleToLibGraalEntryPoints singleton() { - return ImageSingletons.lookup(GuestGraalTruffleToLibGraalEntryPoints.class); + private static LibGraalTruffleToLibGraalEntryPoints singleton() { + return ImageSingletons.lookup(LibGraalTruffleToLibGraalEntryPoints.class); } @SuppressWarnings({"unused", "try"}) diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFeature.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFeature.java similarity index 83% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFeature.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFeature.java index 3c752f1e0cae..8b66364b8b12 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFeature.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFeature.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import static java.lang.invoke.MethodType.methodType; @@ -49,6 +49,7 @@ import com.oracle.svm.graal.hotspot.GetCompilerConfig; import com.oracle.svm.graal.hotspot.GetJNIConfig; import jdk.graal.compiler.hotspot.CompilerConfigurationFactory; +import jdk.graal.compiler.hotspot.libgraal.BuildTime; import jdk.graal.compiler.options.OptionDescriptor; import jdk.graal.compiler.options.OptionKey; import jdk.graal.compiler.serviceprovider.LibGraalService; @@ -81,55 +82,37 @@ /** * This feature builds the libgraal shared library (e.g., libjvmcicompiler.so on linux). *

- * With use of {@code -H:GuestJavaHome}, the Graal and JVMCI classes from which libgraal is built + * With use of {@code -H:LibGraalJavaHome}, the Graal and JVMCI classes from which libgraal is built * can be from a "guest" JDK that may be different from the JDK on which Native Image is running. *

- * To build libgraal, invoke {@code native-image} with the jar containing this feature and it - * dependencies. For example: - * - *

- *      native-image -p jniutils.jar:nativebridge.jar -cp guestgraal-library.jar
- * 
- *

- * If building with mx, execute this from the {@code vm} suite: - * - *

- *      mx --env guestgraal native-image \
- *          -p $(mx --env guestgraal --quiet path JNIUTILS):$(mx --env guestgraal --quiet path NATIVEBRIDGE) \ \
- *          -cp $(mx --env guestgraal --quiet path GUESTGRAAL_LIBRARY)
- * 
- *

* This feature is composed of these key classes: *

    - *
  • {@link GuestGraalClassLoader}
  • - *
  • {@link GuestGraal}
  • - *
  • {@link GuestGraalSubstitutions}
  • + *
  • {@link LibGraalClassLoader}
  • + *
  • {@link LibGraalEntryPoints}
  • + *
  • {@link LibGraalSubstitutions}
  • *
- *

- * Additionally, it defines - * {@code META-INF/native-image/com.oracle.svm.graal.hotspot.guestgraal/native-image.properties}. */ @Platforms(Platform.HOSTED_ONLY.class) -public final class GuestGraalFeature implements Feature { +public final class LibGraalFeature implements Feature { static class Options { @Option(help = "The value of the java.home system property reported by the Java " + "installation that includes the Graal classes in its runtime image " + "from which libgraal will be built. If not provided, the java.home " + "of the Java installation running native-image will be used.") // - public static final HostedOptionKey GuestJavaHome = new HostedOptionKey<>(Path.of(System.getProperty("java.home"))); + public static final HostedOptionKey LibGraalJavaHome = new HostedOptionKey<>(Path.of(System.getProperty("java.home"))); } public static final class IsEnabled implements BooleanSupplier { @Override public boolean getAsBoolean() { - return ImageSingletons.contains(GuestGraalFeature.class); + return ImageSingletons.contains(LibGraalFeature.class); } } @Override public List> getRequiredFeatures() { - return List.of(GuestGraalFieldsOffsetsFeature.class); + return List.of(LibGraalFieldsOffsetsFeature.class); } final MethodHandles.Lookup mhl = MethodHandles.lookup(); @@ -137,10 +120,10 @@ public List> getRequiredFeatures() { /** * Loader used for loading classes from the guest GraalVM. */ - GuestGraalClassLoader loader; + LibGraalClassLoader loader; /** - * Handle to {@link jdk.graal.compiler.hotspot.guestgraal.BuildTime} in the guest. + * Handle to {@link BuildTime} in the guest. */ Class buildTimeClass; @@ -160,40 +143,39 @@ public List> getRequiredFeatures() { MethodHandle handleGlobalAtomicLongGetInitialValue; - public GuestGraalClassLoader getLoader() { + public LibGraalClassLoader getLoader() { return loader; } /** * Performs tasks once this feature is registered. *

    - *
  • Create the {@link GuestGraalClassLoader} instance.
  • - *
  • Get a handle to the {@link jdk.graal.compiler.hotspot.guestgraal.BuildTime} class in the - * guest.
  • + *
  • Create the {@link LibGraalClassLoader} instance.
  • + *
  • Get a handle to the {@link BuildTime} class in the guest.
  • *
  • Initializes the options in the guest.
  • - *
  • Initializes some state needed by {@link GuestGraalSubstitutions}.
  • + *
  • Initializes some state needed by {@link LibGraalSubstitutions}.
  • *
*/ @Override public void afterRegistration(AfterRegistrationAccess access) { - // GuestGraal uses a number of classes in org.graalvm.nativeimage.builder - accessModulesToClass(ModuleSupport.Access.EXPORT, GuestGraalFeature.class, + // LibGraalEntryPoints uses a number of classes in org.graalvm.nativeimage.builder + accessModulesToClass(ModuleSupport.Access.EXPORT, LibGraalFeature.class, "org.graalvm.nativeimage.builder"); - // GuestGraalFeature accesses a few Graal classes (see import statements above) - accessModulesToClass(ModuleSupport.Access.EXPORT, GuestGraalFeature.class, "jdk.graal.compiler"); + // LibGraalFeature accesses a few Graal classes (see import statements above) + accessModulesToClass(ModuleSupport.Access.EXPORT, LibGraalFeature.class, "jdk.graal.compiler"); - // GuestGraalTruffleToLibGraalEntryPoints access TruffleToLibGraal.Id - accessModulesToClass(ModuleSupport.Access.EXPORT, GuestGraalFeature.class, "org.graalvm.truffle.compiler"); + // LibGraalTruffleToLibGraalEntryPoints access TruffleToLibGraal.Id + accessModulesToClass(ModuleSupport.Access.EXPORT, LibGraalFeature.class, "org.graalvm.truffle.compiler"); - ImageSingletons.add(NativeBridgeSupport.class, new GuestGraalNativeBridgeSupport()); + ImageSingletons.add(NativeBridgeSupport.class, new LibGraalNativeBridgeSupport()); // Target_jdk_graal_compiler_serviceprovider_VMSupport.getIsolateID needs access to // org.graalvm.nativeimage.impl.IsolateSupport - accessModulesToClass(ModuleSupport.Access.EXPORT, GuestGraalFeature.class, "org.graalvm.nativeimage"); + accessModulesToClass(ModuleSupport.Access.EXPORT, LibGraalFeature.class, "org.graalvm.nativeimage"); - loader = new GuestGraalClassLoader(Options.GuestJavaHome.getValue().resolve(Path.of("lib", "modules"))); + loader = new LibGraalClassLoader(Options.LibGraalJavaHome.getValue().resolve(Path.of("lib", "modules"))); - buildTimeClass = loader.loadClassOrFail("jdk.graal.compiler.hotspot.guestgraal.BuildTime"); + buildTimeClass = loader.loadClassOrFail("jdk.graal.compiler.hotspot.libgraal.BuildTime"); // Guest JVMCI and Graal need access to some JDK internal packages String[] basePackages = {"jdk.internal.misc", "jdk.internal.util"}; @@ -201,8 +183,8 @@ public void afterRegistration(AfterRegistrationAccess access) { try { /* - * Get GlobalAtomicLong.getInitialValue() method from GuestGraalClassLoader for - * GuestGraalGraalSubstitutions.GlobalAtomicLongAddressProvider FieldValueTransformer + * Get GlobalAtomicLong.getInitialValue() method from LibGraalClassLoader for + * LibGraalGraalSubstitutions.GlobalAtomicLongAddressProvider FieldValueTransformer */ handleGlobalAtomicLongGetInitialValue = mhl.findVirtual(loader.loadClassOrFail("jdk.graal.compiler.serviceprovider.GlobalAtomicLong"), "getInitialValue", methodType(long.class)); @@ -238,14 +220,14 @@ public void duringSetup(DuringSetupAccess access) { basePhaseClass = loader.loadClassOrFail("jdk.graal.compiler.phases.BasePhase"); lirPhaseClass = loader.loadClassOrFail("jdk.graal.compiler.lir.phases.LIRPhase"); - ImageSingletons.add(GuestGraalCompilerSupport.class, new GuestGraalCompilerSupport()); + ImageSingletons.add(LibGraalCompilerSupport.class, new LibGraalCompilerSupport()); } catch (Throwable e) { - throw VMError.shouldNotReachHere("Failed to invoke jdk.graal.compiler.hotspot.guestgraal.BuildTime methods", e); + throw VMError.shouldNotReachHere("Failed to invoke jdk.graal.compiler.hotspot.libgraal.BuildTime methods", e); } DuringSetupAccessImpl accessImpl = (DuringSetupAccessImpl) access; accessImpl.registerClassReachabilityListener(this::registerPhaseStatistics); - optionCollector = new OptionCollector(GuestGraal.vmOptionDescriptors); + optionCollector = new OptionCollector(LibGraalEntryPoints.vmOptionDescriptors); accessImpl.registerObjectReachableCallback(OptionKey.class, optionCollector::doCallback); accessImpl.registerObjectReachableCallback(loader.loadClassOrFail(OptionKey.class.getName()), optionCollector::doCallback); GetJNIConfig.register(loader); @@ -258,7 +240,7 @@ public void duringSetup(DuringSetupAccess access) { * {@link OptionKey} instances reached by the static analysis. The VM options are instances of * {@link OptionKey} loaded by the {@link com.oracle.svm.hosted.NativeImageClassLoader} and * compiler options are instances of {@link OptionKey} loaded by the - * {@link GuestGraalClassLoader}. + * {@link LibGraalClassLoader}. */ private class OptionCollector implements ObjectReachableCallback { private final Set options = Collections.newSetFromMap(new ConcurrentHashMap<>()); @@ -343,11 +325,11 @@ private void registerPhaseStatistics(DuringAnalysisAccess a, Class newlyReach if (!Modifier.isAbstract(newlyReachableClass.getModifiers())) { boolean requireAnalysisIteration = true; if (basePhaseClass.isAssignableFrom(newlyReachableClass)) { - GuestGraalCompilerSupport.registerStatistics(newlyReachableClass, GuestGraalCompilerSupport.get().basePhaseStatistics, + LibGraalCompilerSupport.registerStatistics(newlyReachableClass, LibGraalCompilerSupport.get().basePhaseStatistics, newBasePhaseStatistics.apply(newlyReachableClass)); } else if (lirPhaseClass.isAssignableFrom(newlyReachableClass)) { - GuestGraalCompilerSupport.registerStatistics(newlyReachableClass, GuestGraalCompilerSupport.get().lirPhaseStatistics, + LibGraalCompilerSupport.registerStatistics(newlyReachableClass, LibGraalCompilerSupport.get().lirPhaseStatistics, newLIRPhaseStatistics.apply(newlyReachableClass)); } else { requireAnalysisIteration = false; @@ -410,7 +392,7 @@ public void beforeAnalysis(BeforeAnalysisAccess baa) { String.class, // nativeImageLocationQualifier String.class // encodedGuestObjects )); - GetCompilerConfig.Result configResult = GetCompilerConfig.from(Options.GuestJavaHome.getValue(), bb.getOptions()); + GetCompilerConfig.Result configResult = GetCompilerConfig.from(Options.LibGraalJavaHome.getValue(), bb.getOptions()); for (var e : configResult.opens().entrySet()) { for (String source : e.getValue()) { ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, buildTimeClass, false, e.getKey(), source); @@ -433,15 +415,15 @@ public void beforeAnalysis(BeforeAnalysisAccess baa) { @SuppressWarnings("unchecked") private static void initGraalRuntimeHandles(MethodHandle getRuntimeHandles) throws Throwable { - ImageSingletons.add(GuestGraal.class, new GuestGraal((Map) getRuntimeHandles.invoke())); + ImageSingletons.add(LibGraalEntryPoints.class, new LibGraalEntryPoints((Map) getRuntimeHandles.invoke())); } @SuppressWarnings("unchecked") private void initializeTruffle() throws Throwable { - Class truffleBuildTimeClass = loader.loadClassOrFail("jdk.graal.compiler.hotspot.guestgraal.truffle.BuildTime"); + Class truffleBuildTimeClass = loader.loadClassOrFail("jdk.graal.compiler.hotspot.libgraal.truffle.BuildTime"); MethodHandle getLookup = mhl.findStatic(truffleBuildTimeClass, "initializeLookup", methodType(Map.Entry.class, Lookup.class, Class.class, Class.class)); - Map.Entry> truffleGuestGraal = (Map.Entry>) getLookup.invoke(mhl, TruffleFromLibGraalStartPoints.class, NativeImageHostEntryPoints.class); - ImageSingletons.add(GuestGraalTruffleToLibGraalEntryPoints.class, new GuestGraalTruffleToLibGraalEntryPoints(truffleGuestGraal.getKey(), truffleGuestGraal.getValue())); + Map.Entry> truffleLibGraal = (Map.Entry>) getLookup.invoke(mhl, TruffleFromLibGraalStartPoints.class, NativeImageHostEntryPoints.class); + ImageSingletons.add(LibGraalTruffleToLibGraalEntryPoints.class, new LibGraalTruffleToLibGraalEntryPoints(truffleLibGraal.getKey(), truffleLibGraal.getValue())); MethodHandle truffleConfigureGraalForLibGraal = mhl.findStatic(truffleBuildTimeClass, "configureGraalForLibGraal", methodType(void.class)); truffleConfigureGraalForLibGraal.invoke(); } @@ -451,8 +433,8 @@ private void initializeTruffle() throws Throwable { public void afterAnalysis(AfterAnalysisAccess access) { /* * Verify we only have JVMCI & Graal classes reachable that are coming from - * GuestGraalClassLoader except for hosted JVMCI & Graal classes that are legitimately used - * by SubstrateVM runtime implementation classes (mostly from package com.oracle.svm.core). + * LibGraalClassLoader except for hosted JVMCI & Graal classes that are legitimately used by + * SubstrateVM runtime implementation classes (mostly from package com.oracle.svm.core). */ List hostedAllowed = List.of( classesPattern("jdk.graal.compiler.core.common", @@ -489,7 +471,7 @@ public void afterAnalysis(AfterAnalysisAccess access) { DebugContext debug = bigBang.getDebug(); List forbiddenReachableTypes = new ArrayList<>(); - try (DebugContext.Scope ignored = debug.scope("GuestGraal")) { + try (DebugContext.Scope ignored = debug.scope("LibGraalEntryPoints")) { for (AnalysisType analysisType : callTreePrinter.usedAnalysisTypes()) { Class reachableType = analysisType.getJavaClass(); if (reachableType.getClassLoader() == loader || reachableType.isArray()) { @@ -508,7 +490,7 @@ public void afterAnalysis(AfterAnalysisAccess access) { } if (!forbiddenReachableTypes.isEmpty()) { CallTreePrinter.print(bigBang, "reports", "report"); - VMError.shouldNotReachHere("GuestGraal build found forbidden hosted types as reachable: %s", String.join(", ", forbiddenReachableTypes)); + VMError.shouldNotReachHere("LibGraalEntryPoints build found forbidden hosted types as reachable: %s", String.join(", ", forbiddenReachableTypes)); } optionCollector.afterAnalysis(access); } diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFieldsOffsetsFeature.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFieldsOffsetsFeature.java similarity index 95% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFieldsOffsetsFeature.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFieldsOffsetsFeature.java index 55468cb220f0..a82a97be7fca 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalFieldsOffsetsFeature.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalFieldsOffsetsFeature.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -59,10 +59,10 @@ * the whole meta-classes. Instead, we just replace the {@code long[]} arrays that hold the actual * offsets. */ -public final class GuestGraalFieldsOffsetsFeature implements InternalFeature { +public final class LibGraalFieldsOffsetsFeature implements InternalFeature { private final MethodHandles.Lookup mhl = MethodHandles.lookup(); - private GuestGraalClassLoader loader; + private LibGraalClassLoader loader; private Class fieldsClass; private Class edgesClass; @@ -119,7 +119,7 @@ private static Map getReplacements() { @Override public void duringSetup(DuringSetupAccess a) { DuringSetupAccessImpl access = (DuringSetupAccessImpl) a; - loader = ImageSingletons.lookup(GuestGraalFeature.class).loader; + loader = ImageSingletons.lookup(LibGraalFeature.class).loader; fieldsClass = loader.loadClassOrFail("jdk.graal.compiler.core.common.Fields"); edgesClass = loader.loadClassOrFail("jdk.graal.compiler.graph.Edges"); @@ -161,7 +161,7 @@ public void duringSetup(DuringSetupAccess a) { throw VMError.shouldNotReachHere(e); } - ModuleSupport.accessModuleByClass(ModuleSupport.Access.EXPORT, GuestGraalFieldsOffsetsFeature.class, InternalFeature.class); + ModuleSupport.accessModuleByClass(ModuleSupport.Access.EXPORT, LibGraalFieldsOffsetsFeature.class, InternalFeature.class); ImageSingletons.add(FieldsOffsetsReplacements.class, new FieldsOffsetsReplacements()); access.registerObjectReplacer(this::replaceFieldsOffsets); access.registerClassReachabilityListener(this::classReachabilityListener); @@ -171,7 +171,7 @@ public void duringSetup(DuringSetupAccess a) { public void beforeAnalysis(BeforeAnalysisAccess access) { MethodHandle getInputEdgesOffsets; MethodHandle getSuccessorEdgesOffsets; - var buildTimeClass = loader.loadClassOrFail("jdk.graal.compiler.hotspot.guestgraal.BuildTime"); + var buildTimeClass = loader.loadClassOrFail("jdk.graal.compiler.hotspot.libgraal.BuildTime"); try { MethodType offsetAccessorSignature = MethodType.methodType(long[].class, Object.class); getInputEdgesOffsets = mhl.findStatic(buildTimeClass, "getInputEdgesOffsets", offsetAccessorSignature); @@ -204,7 +204,7 @@ public Object transform(Object receiver, Object originalValue) { FieldsOffsetsReplacement replacement; try { long[] offsetsFromEdges = (long[]) offsetsFromReceiver.invoke(receiver); - replacement = GuestGraalFieldsOffsetsFeature.getReplacements().get(offsetsFromEdges); + replacement = LibGraalFieldsOffsetsFeature.getReplacements().get(offsetsFromEdges); } catch (Throwable e) { throw VMError.shouldNotReachHere(e); } @@ -248,11 +248,11 @@ private void classReachabilityListener(DuringAnalysisAccess a, Class newlyRea } if (!newlyReachableClass.equals(nodeClass) && nodeClass.isAssignableFrom(newlyReachableClass)) { - registerClass(newlyReachableClass, GuestGraalCompilerSupport.get().nodeClasses, this::getNodeClassFromNode, false, access); + registerClass(newlyReachableClass, LibGraalCompilerSupport.get().nodeClasses, this::getNodeClassFromNode, false, access); } else if (!newlyReachableClass.equals(lirInstructionClass) && lirInstructionClass.isAssignableFrom(newlyReachableClass)) { - registerClass(newlyReachableClass, GuestGraalCompilerSupport.get().instructionClasses, this::getLIRInstructionClassFromLIRInstruction, true, access); + registerClass(newlyReachableClass, LibGraalCompilerSupport.get().instructionClasses, this::getLIRInstructionClassFromLIRInstruction, true, access); } else if (!newlyReachableClass.equals(compositeValueClass) && compositeValueClass.isAssignableFrom(newlyReachableClass)) { - registerClass(newlyReachableClass, GuestGraalCompilerSupport.get().compositeValueClasses, this::getCompositeValueClassFromCompositeValue, true, access); + registerClass(newlyReachableClass, LibGraalCompilerSupport.get().compositeValueClasses, this::getCompositeValueClassFromCompositeValue, true, access); } } @@ -342,8 +342,8 @@ public void beforeCompilation(BeforeCompilationAccess a) { @Override public void afterCompilation(AfterCompilationAccess access) { - access.registerAsImmutable(GuestGraalCompilerSupport.get().nodeClasses.getValues(), o -> true); - access.registerAsImmutable(GuestGraalCompilerSupport.get().instructionClasses.getValues(), o -> true); + access.registerAsImmutable(LibGraalCompilerSupport.get().nodeClasses.getValues(), o -> true); + access.registerAsImmutable(LibGraalCompilerSupport.get().instructionClasses.getValues(), o -> true); } private long[] getOffsetsFromFields(Object fields) { diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalNativeBridgeSupport.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalNativeBridgeSupport.java similarity index 89% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalNativeBridgeSupport.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalNativeBridgeSupport.java index c6ba753fa08e..b1167d39a63a 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalNativeBridgeSupport.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalNativeBridgeSupport.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import java.util.concurrent.atomic.AtomicInteger; @@ -32,7 +32,7 @@ import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.impl.IsolateSupport; -public final class GuestGraalNativeBridgeSupport implements NativeBridgeSupport { +public final class LibGraalNativeBridgeSupport implements NativeBridgeSupport { private static final String JNI_LIBGRAAL_TRACE_LEVEL_PROPERTY_NAME = "JNI_LIBGRAAL_TRACE_LEVEL"; private static final int UNINITIALIZED_TRACE_LEVEL = Integer.MIN_VALUE; @@ -70,7 +70,7 @@ public void trace(String message) { sb.append(" ".repeat(2 + (scope.depth() * 2))); } sb.append(message); - GuestGraal.ttyPrintf("%s%n", sb); + LibGraalEntryPoints.ttyPrintf("%s%n", sb); } finally { inTrace.remove(); } @@ -80,12 +80,12 @@ public void trace(String message) { private int traceLevel() { int res = traceLevel.get(); if (res == UNINITIALIZED_TRACE_LEVEL) { - String var = GuestGraal.getSavedProperty(JNI_LIBGRAAL_TRACE_LEVEL_PROPERTY_NAME); + String var = LibGraalEntryPoints.getSavedProperty(JNI_LIBGRAAL_TRACE_LEVEL_PROPERTY_NAME); if (var != null) { try { res = Integer.parseInt(var); } catch (NumberFormatException e) { - GuestGraal.ttyPrintf("Invalid value for %s: %s%n", JNI_LIBGRAAL_TRACE_LEVEL_PROPERTY_NAME, e); + LibGraalEntryPoints.ttyPrintf("Invalid value for %s: %s%n", JNI_LIBGRAAL_TRACE_LEVEL_PROPERTY_NAME, e); res = 0; } } else { diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/LibGraalObjectHandleScope.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalObjectHandleScope.java similarity index 97% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/LibGraalObjectHandleScope.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalObjectHandleScope.java index 327cb868e78a..3619c9c32819 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/LibGraalObjectHandleScope.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalObjectHandleScope.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import java.io.Closeable; diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/LibGraalObjectHandles.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalObjectHandles.java similarity index 98% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/LibGraalObjectHandles.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalObjectHandles.java index 52fe0a2071bd..2064db9dd8b3 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/LibGraalObjectHandles.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalObjectHandles.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import org.graalvm.nativeimage.ObjectHandles; import org.graalvm.word.WordFactory; diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalSubstitutions.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalSubstitutions.java similarity index 82% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalSubstitutions.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalSubstitutions.java index d10b3ee5cbd6..f2a621c580fa 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/GuestGraalSubstitutions.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/LibGraalSubstitutions.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import java.io.PrintStream; import java.lang.ref.Cleaner; @@ -63,9 +63,9 @@ import com.oracle.svm.core.c.CGlobalDataFactory; import com.oracle.svm.core.util.VMError; -class GuestGraalJVMCISubstitutions { +class LibGraalJVMCISubstitutions { - @TargetClass(className = "jdk.vm.ci.services.Services", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.vm.ci.services.Services", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_vm_ci_services_Services { /* * Static final boolean field Services.IS_IN_NATIVE_IMAGE is used in many places in the @@ -89,7 +89,7 @@ static final class Target_jdk_vm_ci_services_Services { private static Map savedProperties; } - @TargetClass(className = "jdk.vm.ci.hotspot.Cleaner", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.vm.ci.hotspot.Cleaner", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_vm_ci_hotspot_Cleaner { /* * Ensure the ReferenceQueue instance in Cleaner.queue that is in libgraal is not @@ -101,19 +101,19 @@ static final class Target_jdk_vm_ci_hotspot_Cleaner { /* * Make package-private clean() accessible so that it can be called from - * GuestGraal.doReferenceHandling(). + * LibGraalEntryPoints.doReferenceHandling(). */ @Alias static native void clean(); } - @TargetClass(className = "jdk.vm.ci.hotspot.CompilerToVM", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = {GuestGraalFeature.IsEnabled.class, JDKLatest.class}) + @TargetClass(className = "jdk.vm.ci.hotspot.CompilerToVM", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = {LibGraalFeature.IsEnabled.class, JDKLatest.class}) static final class Target_jdk_vm_ci_hotspot_CompilerToVM { /* * For libgraal the implementation of CompilerToVM.lookupType needs to take into account - * that the passed-in classloader can also be an instance of GuestGraalClassLoader. Checking + * that the passed-in classloader can also be an instance of LibGraalClassLoader. Checking * if that classLoader is the same as the one of the HotSpotResolvedJavaType class itself - * (which is the GuestGraalClassLoader) takes care of that. + * (which is the LibGraalClassLoader) takes care of that. */ @Substitute Target_jdk_vm_ci_hotspot_HotSpotResolvedJavaType lookupType(ClassLoader classLoader, String name) throws NoClassDefFoundError { @@ -137,20 +137,20 @@ native Target_jdk_vm_ci_hotspot_HotSpotResolvedJavaType lookupType(String name, long accessingKlassPointer, int accessingClassLoader, boolean resolve) throws NoClassDefFoundError; } - @TargetClass(className = "jdk.vm.ci.hotspot.HotSpotResolvedJavaType", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.vm.ci.hotspot.HotSpotResolvedJavaType", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_vm_ci_hotspot_HotSpotResolvedJavaType { } - @TargetClass(className = "jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl { } } -public class GuestGraalSubstitutions { +public class LibGraalSubstitutions { private static final String GLOBAL_ATOMIC_LONG = "jdk.graal.compiler.serviceprovider.GlobalAtomicLong"; - @TargetClass(className = GLOBAL_ATOMIC_LONG, classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = GLOBAL_ATOMIC_LONG, classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_serviceprovider_GlobalAtomicLong { @Inject// @@ -199,7 +199,7 @@ private static class GlobalAtomicLongAddressProvider implements FieldValueTransf public Object transform(Object receiver, Object originalValue) { long initialValue; try { - initialValue = (long) ImageSingletons.lookup(GuestGraalFeature.class).handleGlobalAtomicLongGetInitialValue.invoke(receiver); + initialValue = (long) ImageSingletons.lookup(LibGraalFeature.class).handleGlobalAtomicLongGetInitialValue.invoke(receiver); } catch (Throwable e) { throw VMError.shouldNotReachHere(e); } @@ -207,7 +207,7 @@ public Object transform(Object receiver, Object originalValue) { } } - @TargetClass(className = "jdk.graal.compiler.serviceprovider.VMSupport", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.serviceprovider.VMSupport", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) final class Target_jdk_graal_compiler_serviceprovider_VMSupport { @Substitute @@ -234,7 +234,7 @@ static class LibGraalCompilationRequestScope implements AutoCloseable { final JNIMethodScope scope; LibGraalCompilationRequestScope() { - JNI.JNIEnv env = GuestGraal.getJNIEnv(); + JNI.JNIEnv env = LibGraalEntryPoints.getJNIEnv(); /* * This scope is required to allow Graal compilations of host methods to call * methods in the TruffleCompilerRuntime. This is, for example, required to find out @@ -254,7 +254,7 @@ public void close() { * libgraal doesn't use a dedicated reference handler thread, so we trigger the * reference handling manually when a compilation finishes. */ - GuestGraal.doReferenceHandling(); + LibGraalEntryPoints.doReferenceHandling(); } } } @@ -289,7 +289,7 @@ public static void shutdownLibGraal() { @Substitute public static void invokeShutdownCallback(String cbClassName, String cbMethodName) { - JNI.JNIEnv env = GuestGraal.getJNIEnv(); + JNI.JNIEnv env = LibGraalEntryPoints.getJNIEnv(); JNI.JClass cbClass = JNIUtil.findClass(env, JNIUtil.getSystemClassLoader(env), JNIUtil.getBinaryName(cbClassName), true); JNI.JMethodID cbMethod = JNIUtil.findMethod(env, cbClass, true, cbMethodName, "()V"); @@ -304,19 +304,19 @@ public static void notifyLowMemoryPoint(boolean hintFullGC, boolean forceFullGC) } else { Heap.getHeap().getGC().collectionHint(hintFullGC); } - GuestGraal.doReferenceHandling(); + LibGraalEntryPoints.doReferenceHandling(); } } - @TargetClass(className = "jdk.graal.compiler.phases.BasePhase", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.phases.BasePhase", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_phases_BasePhase { /* - * Redirect method to image build-time pre-computed statistics in GuestGraalCompilerSupport. + * Redirect method to image build-time pre-computed statistics in LibGraalCompilerSupport. */ @Substitute static Target_jdk_graal_compiler_phases_BasePhase_BasePhaseStatistics getBasePhaseStatistics(Class clazz) { - Object result = GuestGraalCompilerSupport.get().getBasePhaseStatistics().get(clazz); + Object result = LibGraalCompilerSupport.get().getBasePhaseStatistics().get(clazz); if (result == null) { throw VMError.shouldNotReachHere(String.format("Missing statistics for phase class: %s%n", clazz.getName())); } @@ -324,19 +324,19 @@ static Target_jdk_graal_compiler_phases_BasePhase_BasePhaseStatistics getBasePha } } - @TargetClass(className = "jdk.graal.compiler.phases.BasePhase", innerClass = "BasePhaseStatistics", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.phases.BasePhase", innerClass = "BasePhaseStatistics", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_phases_BasePhase_BasePhaseStatistics { } - @TargetClass(className = "jdk.graal.compiler.lir.phases.LIRPhase", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.lir.phases.LIRPhase", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_lir_phases_LIRPhase { /* - * Redirect method to image build-time pre-computed statistics in GuestGraalCompilerSupport. + * Redirect method to image build-time pre-computed statistics in LibGraalCompilerSupport. */ @Substitute static Target_jdk_graal_compiler_lir_phases_LIRPhase_LIRPhaseStatistics getLIRPhaseStatistics(Class clazz) { - Object result = GuestGraalCompilerSupport.get().getLirPhaseStatistics().get(clazz); + Object result = LibGraalCompilerSupport.get().getLirPhaseStatistics().get(clazz); if (result == null) { throw VMError.shouldNotReachHere(String.format("Missing statistics for phase class: %s%n", clazz.getName())); } @@ -344,20 +344,20 @@ static Target_jdk_graal_compiler_lir_phases_LIRPhase_LIRPhaseStatistics getLIRPh } } - @TargetClass(className = "jdk.graal.compiler.lir.phases.LIRPhase", innerClass = "LIRPhaseStatistics", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.lir.phases.LIRPhase", innerClass = "LIRPhaseStatistics", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_lir_phases_LIRPhase_LIRPhaseStatistics { } - @TargetClass(className = "jdk.graal.compiler.graph.NodeClass", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.graph.NodeClass", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_graph_NodeClass { /* * Redirect method to image build-time pre-computed nodeClasses map in - * GuestGraalCompilerSupport. + * LibGraalCompilerSupport. */ @Substitute public static Target_jdk_graal_compiler_graph_NodeClass get(Class clazz) { - Object nodeClass = GuestGraalCompilerSupport.get().nodeClasses.get(clazz); + Object nodeClass = LibGraalCompilerSupport.get().nodeClasses.get(clazz); if (nodeClass == null) { throw VMError.shouldNotReachHere(String.format("Unknown node class: %s%n", clazz.getName())); } @@ -378,16 +378,16 @@ public String shortName() { } } - @TargetClass(className = "jdk.graal.compiler.lir.LIRInstructionClass", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.lir.LIRInstructionClass", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_lir_LIRInstructionClass { /* * Redirect method to image build-time pre-computed instructionClasses map in - * GuestGraalCompilerSupport. + * LibGraalCompilerSupport. */ @Substitute public static Target_jdk_graal_compiler_lir_LIRInstructionClass get(Class clazz) { - Object instructionClass = GuestGraalCompilerSupport.get().instructionClasses.get(clazz); + Object instructionClass = LibGraalCompilerSupport.get().instructionClasses.get(clazz); if (instructionClass == null) { throw VMError.shouldNotReachHere(String.format("Unknown instruction class: %s%n", clazz.getName())); } @@ -395,16 +395,16 @@ public static Target_jdk_graal_compiler_lir_LIRInstructionClass get(Class cla } } - @TargetClass(className = "jdk.graal.compiler.lir.CompositeValueClass", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.lir.CompositeValueClass", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) static final class Target_jdk_graal_compiler_lir_CompositeValueClass { /* * Redirect method to image build-time pre-computed compositeValueClasses map in - * GuestGraalCompilerSupport. + * LibGraalCompilerSupport. */ @Substitute public static Target_jdk_graal_compiler_lir_CompositeValueClass get(Class clazz) { - Object compositeValueClass = GuestGraalCompilerSupport.get().compositeValueClasses.get(clazz); + Object compositeValueClass = LibGraalCompilerSupport.get().compositeValueClasses.get(clazz); if (compositeValueClass == null) { throw VMError.shouldNotReachHere(String.format("Unknown composite value class: %s%n", clazz.getName())); } @@ -412,26 +412,26 @@ public static Target_jdk_graal_compiler_lir_CompositeValueClass get(Class cla } } - @TargetClass(className = "jdk.graal.compiler.hotspot.HotSpotGraalOptionValues", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.hotspot.HotSpotGraalOptionValues", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) final class Target_jdk_graal_compiler_hotspot_HotSpotGraalOptionValues { @Substitute private static void notifyLibgraalOptions(Map vmOptionSettings) { - GuestGraal.initializeOptions(vmOptionSettings); + LibGraalEntryPoints.initializeOptions(vmOptionSettings); } @Substitute private static void printLibgraalProperties(PrintStream out, String prefix) { - GuestGraal.printOptions(out, prefix); + LibGraalEntryPoints.printOptions(out, prefix); } } - @TargetClass(className = "jdk.graal.compiler.core.GraalServiceThread", classLoader = GuestGraalClassLoaderSupplier.class, onlyWith = GuestGraalFeature.IsEnabled.class) + @TargetClass(className = "jdk.graal.compiler.core.GraalServiceThread", classLoader = LibGraalClassLoaderSupplier.class, onlyWith = LibGraalFeature.IsEnabled.class) final class Target_jdk_graal_compiler_core_GraalServiceThread { @Substitute() void beforeRun() { Thread thread = SubstrateUtil.cast(this, Thread.class); - if (!GuestGraal.attachCurrentThread(thread.isDaemon(), null)) { + if (!LibGraalEntryPoints.attachCurrentThread(thread.isDaemon(), null)) { throw new InternalError("Couldn't attach to HotSpot runtime"); } } @@ -439,20 +439,20 @@ void beforeRun() { @Substitute @SuppressWarnings("static-method") void afterRun() { - GuestGraal.detachCurrentThread(false); + LibGraalEntryPoints.detachCurrentThread(false); } } } /* - * This supplier is used by all GuestGraalSubstitutions and ensures that the substitution target - * classes are classes from the GuestGraalClassLoader (instead of hosted Graal & JVMCI classes). + * This supplier is used by all LibGraalSubstitutions and ensures that the substitution target + * classes are classes from the LibGraalClassLoader (instead of hosted Graal & JVMCI classes). */ @Platforms(HOSTED_ONLY.class) -class GuestGraalClassLoaderSupplier implements Supplier { +class LibGraalClassLoaderSupplier implements Supplier { @Override public ClassLoader get() { - GuestGraalClassLoader loader = ImageSingletons.lookup(GuestGraalFeature.class).loader; + LibGraalClassLoader loader = ImageSingletons.lookup(LibGraalFeature.class).loader; VMError.guarantee(loader != null); return loader; } diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/NativeImageHostEntryPoints.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/NativeImageHostEntryPoints.java similarity index 98% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/NativeImageHostEntryPoints.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/NativeImageHostEntryPoints.java index 3299c09f93f6..c48c198665b8 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/NativeImageHostEntryPoints.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/NativeImageHostEntryPoints.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import com.oracle.truffle.compiler.TruffleCompilerOptionDescriptor; import org.graalvm.jniutils.HSObject; diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/TruffleFromLibGraalCalls.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/TruffleFromLibGraalCalls.java similarity index 97% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/TruffleFromLibGraalCalls.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/TruffleFromLibGraalCalls.java index 25ea115f7144..2e5246905d71 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/TruffleFromLibGraalCalls.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/TruffleFromLibGraalCalls.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id; import org.graalvm.jniutils.JNI.JClass; diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/TruffleFromLibGraalStartPoints.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/TruffleFromLibGraalStartPoints.java similarity index 78% rename from substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/TruffleFromLibGraalStartPoints.java rename to substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/TruffleFromLibGraalStartPoints.java index 6450418f4b19..c7c656a6d550 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.guestgraal/src/com/oracle/svm/graal/hotspot/guestgraal/TruffleFromLibGraalStartPoints.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/TruffleFromLibGraalStartPoints.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.svm.graal.hotspot.guestgraal; +package com.oracle.svm.graal.hotspot.libgraal; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal; import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id; @@ -42,54 +42,54 @@ import java.util.LinkedHashMap; import java.util.Map; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callAddInlinedTarget; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callAddTargetToDequeue; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callAsJavaConstant; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callCancelCompilation; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callCompilableToString; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callConsumeOptimizedAssumptionDependency; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callCountDirectCallNodes; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callCreateStringSupplier; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callEngineId; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetCompilableCallCount; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetCompilableName; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetCompilerOptions; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetConstantFieldInfo; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetDebugProperties; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetDescription; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetFailedSpeculationsAddress; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetHostMethodInfo; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetKnownCallSiteCount; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetLanguage; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetLineNumber; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetNodeClassName; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetNodeId; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetNonTrivialNodeCount; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetOffsetEnd; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetOffsetStart; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetPartialEvaluationMethodInfo; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetPosition; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetSuppliedString; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callGetURI; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callHasNextTier; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callIsCancelled; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callIsLastTier; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callIsSameOrSplit; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callIsSuppressedFailure; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callIsTrivial; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callIsValueType; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callLog; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnCodeInstallation; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnCompilationFailed; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnCompilationRetry; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnFailure; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnGraalTierFinished; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnIsolateShutdown; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnSuccess; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callOnTruffleTierFinished; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callPrepareForCompilation; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callRegisterOptimizedAssumptionDependency; -import static com.oracle.svm.graal.hotspot.guestgraal.TruffleFromLibGraalStartPointsGen.callSetCallCounts; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callAddInlinedTarget; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callAddTargetToDequeue; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callAsJavaConstant; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callCancelCompilation; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callCompilableToString; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callConsumeOptimizedAssumptionDependency; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callCountDirectCallNodes; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callCreateStringSupplier; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callEngineId; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetCompilableCallCount; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetCompilableName; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetCompilerOptions; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetConstantFieldInfo; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetDebugProperties; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetDescription; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetFailedSpeculationsAddress; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetHostMethodInfo; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetKnownCallSiteCount; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetLanguage; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetLineNumber; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetNodeClassName; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetNodeId; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetNonTrivialNodeCount; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetOffsetEnd; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetOffsetStart; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetPartialEvaluationMethodInfo; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetPosition; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetSuppliedString; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callGetURI; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callHasNextTier; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callIsCancelled; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callIsLastTier; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callIsSameOrSplit; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callIsSuppressedFailure; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callIsTrivial; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callIsValueType; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callLog; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnCodeInstallation; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnCompilationFailed; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnCompilationRetry; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnFailure; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnGraalTierFinished; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnIsolateShutdown; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnSuccess; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callOnTruffleTierFinished; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callPrepareForCompilation; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callRegisterOptimizedAssumptionDependency; +import static com.oracle.svm.graal.hotspot.libgraal.TruffleFromLibGraalStartPointsGen.callSetCallCounts; import static org.graalvm.jniutils.JNIMethodScope.env; import static org.graalvm.jniutils.JNIUtil.createString; diff --git a/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetCompilerConfig.java b/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetCompilerConfig.java index 6c275f1edbb9..c9e0cff1d55c 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetCompilerConfig.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetCompilerConfig.java @@ -45,7 +45,7 @@ import jdk.graal.compiler.hotspot.HotSpotGraalOptionValues; import jdk.graal.compiler.options.OptionKey; import jdk.graal.compiler.options.OptionValues; -import jdk.graal.compiler.hotspot.guestgraal.CompilerConfig; +import jdk.graal.compiler.hotspot.libgraal.CompilerConfig; /** * Gets the map created in a JVM subprocess by running {@link CompilerConfig}. diff --git a/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetJNIConfig.java b/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetJNIConfig.java index fc3624cf17bd..92178a4c508a 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetJNIConfig.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot/src/com/oracle/svm/graal/hotspot/GetJNIConfig.java @@ -150,7 +150,7 @@ private Class findClass(String name) { try { return Class.forName(internalName, false, loader); } catch (ClassNotFoundException e) { - throw VMError.shouldNotReachHere("Cannot find class GuestGraal JNIConfiguration registration", e); + throw VMError.shouldNotReachHere("Cannot find class during LibGraal JNIConfiguration registration", e); } } diff --git a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalObject.java b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalObject.java index 4b4092f068e3..2311fb04bf23 100644 --- a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalObject.java +++ b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalObject.java @@ -113,7 +113,7 @@ public long getHandle() { * @return {@code false} if {@code} is not a valid handle in the isolate */ // Implementation: - // com.oracle.svm.graal.hotspot.guestgraal.GuestGraalTruffleToLibGraalEntryPoints.releaseHandle + // com.oracle.svm.graal.hotspot.libgraal.LibGraalTruffleToLibGraalEntryPoints.releaseHandle static native boolean releaseHandle(long isolateThreadId, long handle); @Override diff --git a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalScope.java b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalScope.java index b56cd354755a..4aec3af5481b 100644 --- a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalScope.java +++ b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/hotspot/libgraal/LibGraalScope.java @@ -197,14 +197,14 @@ public String toString() { * @return the address of the attached IsolateThread */ // Implementation: - // com.oracle.svm.graal.hotspot.guestgraal.GuestGraalLibGraalScope.attachThreadTo + // com.oracle.svm.graal.hotspot.libgraal.LibGraalLibGraalScope.attachThreadTo static native long attachThreadTo(long isolateAddress); /** * Detaches the current thread from the isolate at {@code isolateAddress}. */ // Implementation: - // com.oracle.svm.graal.hotspot.guestgraal.GuestGraalLibGraalScope.detachThreadFrom + // com.oracle.svm.graal.hotspot.libgraal.LibGraalLibGraalScope.detachThreadFrom static native void detachThreadFrom(long isolateThreadAddress); /** @@ -213,7 +213,7 @@ public String toString() { * @return 0L if the current thread is not attached to the isolate at {@code isolateAddress} */ // Implementation: - // com.oracle.svm.graal.hotspot.guestgraal.GuestGraalLibGraalScope.getIsolateThreadIn + // com.oracle.svm.graal.hotspot.libgraal.LibGraalLibGraalScope.getIsolateThreadIn @SuppressWarnings("unused") static native long getIsolateThreadIn(long isolateAddress); @@ -222,7 +222,7 @@ public String toString() { * to be unique for the first {@code 2^64 - 1} isolates in the process. */ // Implementation: - // com.oracle.svm.graal.hotspot.guestgraal.GuestGraalLibGraalScope.getIsolateId + // com.oracle.svm.graal.hotspot.libgraal.LibGraalLibGraalScope.getIsolateId private static native long getIsolateId(long isolateThreadAddress); /**