Skip to content

[GR-57997] Rename GuestGraal to LibGraal. #9635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
* System properties can be modified by application code so {@link GraalServices#getSavedProperty}
* should be used instead.
* <p>
* 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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static EconomicMap<OptionKey<?>, Object> parseOptions() {
Map<String, String> savedProps = GraalServices.getSavedProperties();

EconomicMap<String, String> 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<String, String> vmOptionSettings = new HashMap<>();

for (Map.Entry<String, String> e : savedProps.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

/**
Expand Down Expand Up @@ -113,14 +113,14 @@ public static Iterable<?> finalizeLibgraalOptions(List<Object> 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();
}
Expand Down Expand Up @@ -176,16 +176,16 @@ public static void configureGraalForLibGraal(String arch,
serviceLocators.forEach(cachedLocators::add);
jvmciServiceLocatorCachedLocatorsField.set(null, cachedLocators);

EconomicMap<String, Object> guestObjects = (EconomicMap<String, Object>) ObjectCopier.decode(encodedGuestObjects, LOADER);
EncodedSnippets encodedSnippets = (EncodedSnippets) guestObjects.get("encodedSnippets");
EconomicMap<String, Object> libgraalObjects = (EconomicMap<String, Object>) 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()) {
registerAsInHeap.accept(nodeClass.getClazz());
}
HotSpotReplacementsImpl.setEncodedSnippets(encodedSnippets);

List<ForeignCallSignature> foreignCallSignatures = (List<ForeignCallSignature>) guestObjects.get("foreignCallSignatures");
List<ForeignCallSignature> foreignCallSignatures = (List<ForeignCallSignature>) libgraalObjects.get("foreignCallSignatures");
HotSpotForeignCallLinkage.Stubs.initStubs(foreignCallSignatures);

hostedGraalSetFoldNodePluginClasses.accept(GeneratedInvocationPlugin.getFoldNodePluginClasses());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -63,9 +63,9 @@ public static void configureGraalForLibGraal() {
* Obtains a {@link Lookup} instance for resolving method handles to invoke Graal and JVMCI
* methods.
* <p>
* 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.
* </p>
*
* @param lookup a {@link Lookup} instance used to resolve handles for calling into the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<OptimizedAssumptionDependency> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
* 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;

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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -45,55 +44,55 @@ static void initializeHost(long runtimeClass) {
try {
HANDLES.initializeHost.invoke(runtimeClass);
} catch (Throwable t) {
throw handleException(t);
throw HSIndirectHandle.handleException(t);
}
}

static Object createLocalHandleForLocalReference(long jniLocalHandle) {
try {
return HANDLES.createLocalHandleForLocalReference.invoke(jniLocalHandle);
} catch (Throwable t) {
throw handleException(t);
throw HSIndirectHandle.handleException(t);
}
}

static Object createLocalHandleForWeakGlobalReference(long jniLocalHandle) {
try {
return HANDLES.createLocalHandleForWeakGlobalReference.invoke(jniLocalHandle);
} catch (Throwable t) {
throw handleException(t);
throw HSIndirectHandle.handleException(t);
}
}

static Object createGlobalHandle(Object hsHandle, boolean allowGlobalDuplicates) {
try {
return HANDLES.createGlobalHandle.invoke(hsHandle, allowGlobalDuplicates);
} catch (Throwable t) {
throw handleException(t);
throw HSIndirectHandle.handleException(t);
}
}

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);
}
}

static long getObjectClass(Object o) {
try {
return (long) HANDLES.getObjectClass.invoke(o);
} catch (Throwable t) {
throw handleException(t);
throw HSIndirectHandle.handleException(t);
}
}

static Object createTruffleCompilerOptionDescriptor(String name, int type, boolean deprecated, String help, String deprecationMessage) {
try {
return HANDLES.createTruffleCompilerOptionDescriptor.invoke(name, type, deprecated, help, deprecationMessage);
} catch (Throwable t) {
throw handleException(t);
throw HSIndirectHandle.handleException(t);
}
}

Expand Down
Loading