From aff303578f47f35738bbb8ff4c926e88aac2116b Mon Sep 17 00:00:00 2001 From: Codrut Stancu Date: Mon, 10 Feb 2025 21:54:39 +0100 Subject: [PATCH] Add missing HOSTED_ONLY annotations to CGlobalData. --- .../src/com/oracle/svm/core/c/CGlobalDataImpl.java | 8 +++----- .../com/oracle/svm/core/graal/code/CGlobalDataInfo.java | 2 ++ .../src/com/oracle/svm/hosted/SVMHost.java | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/c/CGlobalDataImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/c/CGlobalDataImpl.java index 20bf1a71419f..748d11217bfe 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/c/CGlobalDataImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/c/CGlobalDataImpl.java @@ -36,9 +36,12 @@ public final class CGlobalDataImpl extends CGlobalData * The name of the symbol to create for this data (or null to create no symbol), or if the other * fields are null, the name of the symbol to be referenced by this instance. */ + @Platforms(Platform.HOSTED_ONLY.class) // public final String symbolName; + @Platforms(Platform.HOSTED_ONLY.class) // public final Supplier bytesSupplier; + @Platforms(Platform.HOSTED_ONLY.class) // public final IntSupplier sizeSupplier; public final boolean nonConstant; @@ -79,9 +82,4 @@ private CGlobalDataImpl(String symbolName, Supplier bytesSupplier, IntSu this.sizeSupplier = sizeSupplier; this.nonConstant = nonConstant; } - - @Override - public String toString() { - return "CGlobalData[symbol=" + symbolName + "]"; - } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/CGlobalDataInfo.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/CGlobalDataInfo.java index 0c3f082ae2e7..063c1b987ebf 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/CGlobalDataInfo.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/CGlobalDataInfo.java @@ -26,6 +26,7 @@ import java.util.function.Supplier; +import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platform.HOSTED_ONLY; import org.graalvm.nativeimage.Platforms; import org.graalvm.word.Pointer; @@ -53,6 +54,7 @@ public final class CGlobalDataInfo { /** Cache until writing the image in case the {@link Supplier} is costly or has side-effects. */ @Platforms(HOSTED_ONLY.class) private byte[] bytes; + @Platforms(Platform.HOSTED_ONLY.class) public CGlobalDataInfo(CGlobalDataImpl data) { assert data != null; this.data = data; diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java index eb99c352c3f2..d2c48ccc4c6a 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java @@ -520,6 +520,8 @@ private DynamicHub createHub(AnalysisType type) { String simpleBinaryName = stringTable.deduplicate(getSimpleBinaryName(javaClass), true); Class nestHost = javaClass.getNestHost(); + VMError.guarantee(platformSupported(nestHost), "The NestHost %s for %s is not available in this platform.", nestHost, javaClass); + boolean isHidden = javaClass.isHidden(); boolean isRecord = javaClass.isRecord(); boolean assertionStatus = RuntimeAssertionsSupport.singleton().desiredAssertionStatus(javaClass);