Skip to content

Commit a0aa634

Browse files
committed
make use of Platforms annotation to mark hosted-only code
1 parent 993aae5 commit a0aa634

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotReplacementsImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
import jdk.vm.ci.meta.MetaAccessProvider;
6565
import jdk.vm.ci.meta.ResolvedJavaMethod;
6666
import jdk.vm.ci.meta.ResolvedJavaType;
67+
import org.graalvm.nativeimage.Platform;
68+
import org.graalvm.nativeimage.Platforms;
6769

6870
/**
6971
* Filters certain method substitutions based on whether there is underlying hardware support for
@@ -274,6 +276,7 @@ public <T> T getInjectedArgument(Class<T> capability) {
274276
return super.getInjectedArgument(capability);
275277
}
276278

279+
@Platforms(Platform.HOSTED_ONLY.class)
277280
public ResolvedJavaMethod findSnippetMethod(ResolvedJavaMethod thisMethod) {
278281
if (snippetEncoder == null) {
279282
throw new GraalError("findSnippetMethod called before initialization of Replacements");

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,16 @@
5959
import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
6060
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
6161
import jdk.vm.ci.services.JVMCIServiceLocator;
62+
import org.graalvm.nativeimage.Platform;
63+
import org.graalvm.nativeimage.Platforms;
6264

6365
/**
6466
* This class is used at image build-time when a libgraal image gets built. Its static methods are
6567
* called from {@code com.oracle.svm.graal.hotspot.libgraal.LibGraalFeature} before static analysis.
6668
* These methods ensure the static field state of Graal and JVMCI classes loaded by the
6769
* LibGraalClassLoader is set up correctly for getting built into libgraal.
6870
*/
71+
@Platforms(Platform.HOSTED_ONLY.class)
6972
public class BuildTime {
7073

7174
private static final String VALID_LOADER_NAME = "LibGraalClassLoader";

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/truffle/BuildTime.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id;
2828
import jdk.graal.compiler.truffle.host.TruffleHostEnvironment;
2929
import org.graalvm.nativeimage.ImageInfo;
30+
import org.graalvm.nativeimage.Platform;
31+
import org.graalvm.nativeimage.Platforms;
3032

3133
import java.lang.invoke.MethodHandle;
3234
import java.lang.invoke.MethodHandles;
@@ -45,6 +47,7 @@
4547
/**
4648
* Class used to initialize the Truffle extensions to the Graal compiler in the image build time.
4749
*/
50+
@Platforms(Platform.HOSTED_ONLY.class)
4851
public class BuildTime {
4952

5053
private static Lookup hostLookup;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/serviceprovider/GraalServices.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import jdk.vm.ci.runtime.JVMCI;
4545
import jdk.vm.ci.services.Services;
4646
import org.graalvm.nativeimage.ImageInfo;
47+
import org.graalvm.nativeimage.Platform;
48+
import org.graalvm.nativeimage.Platforms;
4749

4850
/**
4951
* Interface to functionality that abstracts over which JDK version Graal is running on.
@@ -75,6 +77,7 @@ public static boolean isInLibgraal() {
7577
*/
7678
private static Map<Class<?>, List<?>> libgraalServices;
7779

80+
@Platforms(Platform.HOSTED_ONLY.class)
7881
@ExcludeFromJacocoGeneratedReport("only called when building libgraal")
7982
public static void setLibgraalServices(Map<Class<?>, List<?>> services) {
8083
GraalError.guarantee(libgraalServices == null, "Libgraal services must be set exactly once");

0 commit comments

Comments
 (0)