diff --git a/common.json b/common.json index 59991f63bf47..d876612cff77 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.34.0", + "mx_version": "6.35.1", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { diff --git a/compiler/mx.compiler/mx_compiler.py b/compiler/mx.compiler/mx_compiler.py index 3431560ce961..5d8a509d808e 100644 --- a/compiler/mx.compiler/mx_compiler.py +++ b/compiler/mx.compiler/mx_compiler.py @@ -704,11 +704,7 @@ def _unittest_config_participant(config): # for the junit harness which uses reflection to find @Test methods. In addition, the # tests widely use JVMCI classes so JVMCI needs to also export all its packages to # ALL-UNNAMED. - mainClassArgs.extend(['-JUnitOpenPackages', 'jdk.internal.vm.ci/*=org.graalvm.truffle.runtime,jdk.internal.vm.compiler,ALL-UNNAMED']) - mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle/*=ALL-UNNAMED']) - mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle.compiler/*=ALL-UNNAMED']) - mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle.runtime/*=ALL-UNNAMED']) limited_modules = None for arg in vmArgs: @@ -1341,7 +1337,7 @@ def _jvmci_jars(): dir_name='graal', license_files=[], third_party_license_files=[], - dependencies=['Truffle API'], + dependencies=['Truffle Compiler'], jar_distributions=[ # Dev jars (annotation processors) 'compiler:GRAAL_PROCESSOR', ], diff --git a/compiler/mx.compiler/suite.py b/compiler/mx.compiler/suite.py index 76a743d7de71..d77d4116dc2d 100644 --- a/compiler/mx.compiler/suite.py +++ b/compiler/mx.compiler/suite.py @@ -452,7 +452,9 @@ "truffle:TRUFFLE_TEST", "truffle:TRUFFLE_COMPILER", "truffle:TRUFFLE_RUNTIME", - "regex:TREGEX" + "regex:TREGEX", + "ASM_TREE_9.5", + "ASM_UTIL_9.5", ], "exclude" : [ "mx:JUNIT", @@ -493,7 +495,7 @@ ], "exports" : [ """* to com.oracle.graal.graal_enterprise,org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,org.graalvm.nativeimage.base, - org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise""", + org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm""", "org.graalvm.compiler.java to org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.configure", "org.graalvm.compiler.core.common to org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.objectfile", "org.graalvm.compiler.debug to org.graalvm.nativeimage.objectfile", diff --git a/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java b/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java index c54003fdabe7..4335ae2820ef 100644 --- a/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java +++ b/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/test/SubprocessUtil.java @@ -445,7 +445,7 @@ public static Subprocess process(List command, Map env, } private static boolean hasArg(String optionName) { - if (optionName.equals("-cp") || optionName.equals("-classpath")) { + if (optionName.equals("-cp") || optionName.equals("-classpath") || optionName.equals("-p")) { return true; } if (optionName.equals("--version") || diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/KnownTruffleTypes.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/KnownTruffleTypes.java index 6f2ca4bcfa9e..36870879a8d2 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/KnownTruffleTypes.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/KnownTruffleTypes.java @@ -154,6 +154,7 @@ public class KnownTruffleTypes extends AbstractKnownTruffleTypes { public final ResolvedJavaType CompilationState = lookupType("com.oracle.truffle.runtime.CompilationState"); public final ResolvedJavaType OptimizedCallTarget = lookupTypeCached("com.oracle.truffle.runtime.OptimizedCallTarget"); + public final ResolvedJavaMethod OptimizedCallTarget_call = findMethod(OptimizedCallTarget, "call", Object_Array); public final ResolvedJavaMethod OptimizedCallTarget_callDirect = findMethod(OptimizedCallTarget, "callDirect", Node, Object_Array); public final ResolvedJavaMethod OptimizedCallTarget_callInlined = findMethod(OptimizedCallTarget, "callInlined", Node, Object_Array); public final ResolvedJavaMethod OptimizedCallTarget_callIndirect = findMethod(OptimizedCallTarget, "callIndirect", Node, Object_Array); diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java index 5e90bdd2e9d5..80b86d981fa5 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java @@ -171,7 +171,7 @@ public InstrumentPhase.Instrumentation getInstrumentation() { throw new IllegalStateException("PartialEvaluator is not yet initialized"); } long[] accessTable = new long[instrumentationCfg.instrumentationTableSize]; - instrumentation = new InstrumentPhase.Instrumentation(accessTable); + instrumentation = new InstrumentPhase.Instrumentation(types, accessTable); } } } diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java index 21f5358fb3b0..540a3fb617ba 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java @@ -30,7 +30,6 @@ import static org.graalvm.compiler.truffle.compiler.TruffleCompilerOptions.InstrumentBranchesPerInlineSite; import static org.graalvm.compiler.truffle.compiler.TruffleCompilerOptions.InstrumentationTableSize; -import java.lang.reflect.Method; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collections; @@ -55,6 +54,7 @@ import org.graalvm.compiler.nodes.java.StoreIndexedNode; import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.phases.BasePhase; +import org.graalvm.compiler.truffle.compiler.KnownTruffleTypes; import org.graalvm.compiler.truffle.compiler.TruffleCompilerOptions; import org.graalvm.compiler.truffle.compiler.TruffleTierContext; @@ -62,40 +62,16 @@ import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MetaUtil; +import jdk.vm.ci.meta.ResolvedJavaMethod; public abstract class InstrumentPhase extends BasePhase { - - private static boolean checkMethodExists(String declaringClassName, String methodName) { - try { - Class declaringClass = Class.forName(declaringClassName); - for (Method m : declaringClass.getDeclaredMethods()) { - if (m.getName().equals(methodName)) { - return true; - } - } - } catch (ClassNotFoundException e) { - throw new NoClassDefFoundError(declaringClassName); - } - throw new NoSuchMethodError(declaringClassName + "." + methodName); - } - - private static String asStackPattern(String declaringClassName, String methodName) { - assert checkMethodExists(declaringClassName, methodName); - return declaringClassName + "." + methodName; - } - - private static final String[] OMITTED_STACK_PATTERNS = new String[]{ - asStackPattern("com.oracle.truffle.runtime.OptimizedCallTarget", "executeRootNode"), - asStackPattern("com.oracle.truffle.runtime.OptimizedCallTarget", "profiledPERoot"), - asStackPattern("com.oracle.truffle.runtime.OptimizedCallTarget", "callDirect"), - asStackPattern("com.oracle.truffle.runtime.OptimizedDirectCallNode", "call"), - }; private final Instrumentation instrumentation; protected final SnippetReflectionProvider snippetReflection; public InstrumentPhase(SnippetReflectionProvider snippetReflection, Instrumentation instrumentation) { this.snippetReflection = snippetReflection; this.instrumentation = instrumentation; + } public Instrumentation getInstrumentation() { @@ -190,9 +166,20 @@ public int compare(Map.Entry x, Map.Entry y) { public Map pointMap = new LinkedHashMap<>(); public int tableIdCount; public int tableStartIndex; + private final String[] omittedStackPatterns; - public Instrumentation(long[] accessTable) { + public Instrumentation(KnownTruffleTypes types, long[] accessTable) { this.accessTable = accessTable; + this.omittedStackPatterns = new String[]{ + asStackPattern(types.OptimizedCallTarget_executeRootNode), + asStackPattern(types.OptimizedCallTarget_profiledPERoot), + asStackPattern(types.OptimizedCallTarget_callDirect), + asStackPattern(types.OptimizedCallTarget_call), + }; + } + + private static String asStackPattern(ResolvedJavaMethod method) { + return method.getDeclaringClass().toJavaName(true) + "." + method.getName(); } /* @@ -226,7 +213,7 @@ private static String filterAndEncode(MethodFilter methodFilter, Node node, Inst } } - private static String prettify(String key, Point p) { + private String prettify(String key, Point p) { if (p.isPrettified()) { StringBuilder sb = new StringBuilder(); NodeSourcePosition pos = p.getPosition(); @@ -235,7 +222,7 @@ private static String prettify(String key, Point p) { callerChainLoop: while (pos != null) { // Skip stack frame if it is a known pattern. - for (String pattern : OMITTED_STACK_PATTERNS) { + for (String pattern : omittedStackPatterns) { if (pos.getMethod().format("%H.%n(%p)").contains(pattern)) { pos = pos.getCaller(); continue callerChainLoop; diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentationSuite.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentationSuite.java index 524629493788..35c27941d379 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentationSuite.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentationSuite.java @@ -30,7 +30,8 @@ public class InstrumentationSuite extends PhaseSuite { @SuppressWarnings("this-escape") - public InstrumentationSuite(InstrumentPhase.InstrumentationConfiguration instrumentationCfg, SnippetReflectionProvider snippetReflection, InstrumentPhase.Instrumentation instrumentation) { + public InstrumentationSuite(InstrumentPhase.InstrumentationConfiguration instrumentationCfg, SnippetReflectionProvider snippetReflection, + InstrumentPhase.Instrumentation instrumentation) { if (instrumentationCfg.instrumentBranches) { appendPhase(new InstrumentBranchesPhase(snippetReflection, instrumentation, instrumentationCfg.instrumentBranchesPerInlineSite)); } diff --git a/espresso/mx.espresso/jvm-ce b/espresso/mx.espresso/jvm-ce index 955360f6ab7c..9f348e81928b 100644 --- a/espresso/mx.espresso/jvm-ce +++ b/espresso/mx.espresso/jvm-ce @@ -1,6 +1,6 @@ # mx --dynamicimports=/vm,/substratevm --components="Espresso Launcher,LibGraal,SubstrateVM,suite:tools" --native-images=lib:jvmcicompiler --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm,/substratevm -COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,suite:tools +COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,suite:tools,tflm NATIVE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=true diff --git a/espresso/mx.espresso/jvm-ce-llvm b/espresso/mx.espresso/jvm-ce-llvm index caebc1bc0799..584ccf4b6f14 100644 --- a/espresso/mx.espresso/jvm-ce-llvm +++ b/espresso/mx.espresso/jvm-ce-llvm @@ -1,6 +1,6 @@ # mx --dynamicimports=/vm,/substratevm --components="Espresso Launcher,LibGraal,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools" --native-images=lib:jvmcicompiler --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm,/substratevm -COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools +COMPONENTS=Espresso Launcher,LibGraal,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools,tflm NATIVE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=true diff --git a/espresso/mx.espresso/jvm-ee b/espresso/mx.espresso/jvm-ee index c8bd2913fc9d..708d5289370e 100644 --- a/espresso/mx.espresso/jvm-ee +++ b/espresso/mx.espresso/jvm-ee @@ -1,7 +1,7 @@ # mx --dynamicimports=/vm-enterprise,/substratevm-enterprise,/tools-enterprise --components="Espresso Launcher,LibGraal Enterprise,SubstrateVM Enterprise,suite:tools,suite:tools-enterprise" --native-images=lib:jvmcicompiler --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm-enterprise,/substratevm-enterprise,/tools-enterprise -COMPONENTS=Espresso Launcher,LibGraal Enterprise,SubstrateVM Enterprise,suite:tools,suite:tools-enterprise +COMPONENTS=Espresso Launcher,LibGraal Enterprise,SubstrateVM Enterprise,suite:tools,suite:tools-enterprise,tflm NATIVE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=true EXCLUDE_COMPONENTS=hprf diff --git a/espresso/mx.espresso/jvm-ee-llvm b/espresso/mx.espresso/jvm-ee-llvm index 0acbf49bc46f..a3398d55044a 100644 --- a/espresso/mx.espresso/jvm-ee-llvm +++ b/espresso/mx.espresso/jvm-ee-llvm @@ -1,7 +1,7 @@ # mx --dynamicimports=/vm-enterprise,/substratevm-enterprise,/tools-enterprise --components="Espresso Launcher,LibGraal Enterprise,SubstrateVM Enterprise,Java on Truffle LLVM Java libraries,suite:tools,suite:tools-enterprise" --native-images=lib:jvmcicompiler --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm-enterprise,/substratevm-enterprise,/tools-enterprise -COMPONENTS=Espresso Launcher,LibGraal Enterprise,SubstrateVM Enterprise,Java on Truffle LLVM Java libraries,suite:tools,suite:tools-enterprise +COMPONENTS=Espresso Launcher,LibGraal Enterprise,SubstrateVM Enterprise,Java on Truffle LLVM Java libraries,suite:tools,suite:tools-enterprise,tflm NATIVE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=true EXCLUDE_COMPONENTS=hprf diff --git a/espresso/mx.espresso/mx_espresso.py b/espresso/mx.espresso/mx_espresso.py index b81d79a3658e..71cf78030693 100644 --- a/espresso/mx.espresso/mx_espresso.py +++ b/espresso/mx.espresso/mx_espresso.py @@ -326,17 +326,17 @@ def register_espresso_envs(suite): tools = ['cov', 'dap', 'ins', 'insight', 'insightheap', 'lsp', 'pro', 'truffle-json'] _llvm_toolchain_wrappers = ['bgraalvm-native-clang', 'bgraalvm-native-clang-cl', 'bgraalvm-native-clang++', 'bgraalvm-native-flang', 'bgraalvm-native-ld', 'bgraalvm-native-binutil'] if LLVM_JAVA_HOME: - mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'elau' ] + tools, suite, env_file='jvm-llvm') - mx_sdk_vm.register_vm_config('espresso-jvm-ce', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'svm' , 'svmsl' , 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='jvm-ce-llvm') - mx_sdk_vm.register_vm_config('espresso-jvm-ee', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tfle', 'cmp', 'antlr4', 'llrc', 'llrn', 'cmpee', 'svm', 'svmee', 'svmsl', 'tflllm', 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='jvm-ee-llvm') - mx_sdk_vm.register_vm_config('espresso-native-ce', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'svm' , 'svmsl' , 'tflm' , 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='native-ce-llvm') - mx_sdk_vm.register_vm_config('espresso-native-ee', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tfle', 'cmp', 'antlr4', 'llrc', 'llrn', 'cmpee', 'svm', 'svmsl', 'svmee', 'tflllm', 'tflm' , 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='native-ee-llvm') + mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'elau' ] + tools, suite, env_file='jvm-llvm') + mx_sdk_vm.register_vm_config('espresso-jvm-ce', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'svm', 'svmt' , 'svmsl' , 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='jvm-ce-llvm') + mx_sdk_vm.register_vm_config('espresso-jvm-ee', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tfle', 'cmp', 'antlr4', 'llrc', 'llrn', 'cmpee', 'svm', 'svmt', 'svmee', 'svmte', 'svmsl', 'tflllm', 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='jvm-ee-llvm') + mx_sdk_vm.register_vm_config('espresso-native-ce', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'svm', 'svmt' , 'svmsl' , 'tflm' , 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='native-ce-llvm') + mx_sdk_vm.register_vm_config('espresso-native-ee', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tfle', 'cmp', 'antlr4', 'llrc', 'llrn', 'cmpee', 'svm', 'svmt', 'svmsl', 'svmee', 'svmte', 'tflllm', 'tflm' , 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='native-ee-llvm') else: - mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla' , 'cmp' , 'elau' ] + tools, suite, env_file='jvm') - mx_sdk_vm.register_vm_config('espresso-jvm-ce', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla' , 'cmp' , 'svm', 'svmsl' , 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot' ] + tools, suite, env_file='jvm-ce') - mx_sdk_vm.register_vm_config('espresso-jvm-ee', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tfle', 'cmp' , 'cmpee', 'svm', 'svmsl', 'svmee', 'tflllm', 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot' ] + tools, suite, env_file='jvm-ee') - mx_sdk_vm.register_vm_config('espresso-native-ce', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla' , 'cmp' , 'svm', 'svmsl' , 'tflm' , 'spolyglot' ] + tools, suite, env_file='native-ce') - mx_sdk_vm.register_vm_config('espresso-native-ee', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tfle', 'cmp' , 'cmpee', 'svm', 'svmsl', 'svmee', 'tflllm', 'tflm' , 'spolyglot' ] + tools, suite, env_file='native-ee') + mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp' , 'elau' ] + tools, suite, env_file='jvm') + mx_sdk_vm.register_vm_config('espresso-jvm-ce', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp' , 'svm', 'svmt', 'svmsl' , 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot' ] + tools, suite, env_file='jvm-ce') + mx_sdk_vm.register_vm_config('espresso-jvm-ee', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tfle', 'cmp' , 'cmpee', 'svm', 'svmt', 'svmsl', 'svmee', 'svmte', 'tflllm', 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot' ] + tools, suite, env_file='jvm-ee') + mx_sdk_vm.register_vm_config('espresso-native-ce', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp' , 'svm', 'svmt', 'svmsl' , 'tflm' , 'spolyglot' ] + tools, suite, env_file='native-ce') + mx_sdk_vm.register_vm_config('espresso-native-ee', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tfle', 'cmp' , 'cmpee', 'svm', 'svmt', 'svmsl', 'svmee', 'svmte', 'tflllm', 'tflm' , 'spolyglot' ] + tools, suite, env_file='native-ee') register_espresso_envs(_suite) diff --git a/espresso/mx.espresso/native-ce b/espresso/mx.espresso/native-ce index c01d3302b108..1a4026703206 100644 --- a/espresso/mx.espresso/native-ce +++ b/espresso/mx.espresso/native-ce @@ -1,6 +1,6 @@ # mx --dynamicimports=/vm,/substratevm --components="Java on Truffle,SubstrateVM,suite:tools" --native-images=lib:javavm --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm,/substratevm -COMPONENTS=Java on Truffle,SubstrateVM,suite:tools +COMPONENTS=Java on Truffle,SubstrateVM,suite:tools,tflm NATIVE_IMAGES=lib:javavm DISABLE_INSTALLABLES=true diff --git a/espresso/mx.espresso/native-ce-llvm b/espresso/mx.espresso/native-ce-llvm index 4f967e22e038..ccec2e00c570 100644 --- a/espresso/mx.espresso/native-ce-llvm +++ b/espresso/mx.espresso/native-ce-llvm @@ -1,6 +1,6 @@ # mx --dynamicimports=/vm,/substratevm --components="Java on Truffle,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools" --native-images=lib:javavm --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm,/substratevm -COMPONENTS=Java on Truffle,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools +COMPONENTS=Java on Truffle,SubstrateVM,Java on Truffle LLVM Java libraries,suite:tools,tflm NATIVE_IMAGES=lib:javavm DISABLE_INSTALLABLES=true diff --git a/espresso/mx.espresso/native-ee b/espresso/mx.espresso/native-ee index 9e1e2e621152..6d63740d99e4 100644 --- a/espresso/mx.espresso/native-ee +++ b/espresso/mx.espresso/native-ee @@ -1,7 +1,7 @@ # mx --dynamicimports=/vm-enterprise,/substratevm-enterprise,/tools-enterprise --components="Java on Truffle,SubstrateVM Enterprise,suite:tools,suite:tools-enterprise" --native-images=lib:javavm --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm-enterprise,/substratevm-enterprise,/tools-enterprise -COMPONENTS=Java on Truffle,SubstrateVM Enterprise,suite:tools,suite:tools-enterprise +COMPONENTS=Java on Truffle,SubstrateVM Enterprise,suite:tools,suite:tools-enterprise,tflm NATIVE_IMAGES=lib:javavm DISABLE_INSTALLABLES=true EXCLUDE_COMPONENTS=hprf diff --git a/espresso/mx.espresso/native-ee-llvm b/espresso/mx.espresso/native-ee-llvm index 8118435b1547..9545c2401af2 100644 --- a/espresso/mx.espresso/native-ee-llvm +++ b/espresso/mx.espresso/native-ee-llvm @@ -1,7 +1,7 @@ # mx --dynamicimports=/vm-enterprise,/substratevm-enterprise,/tools-enterprise --components="Java on Truffle,SubstrateVM Enterprise,Java on Truffle LLVM Java libraries,suite:tools,suite:tools-enterprise" --native-images=lib:javavm --disable-installables=true graalvm-show DYNAMIC_IMPORTS=/vm-enterprise,/substratevm-enterprise,/tools-enterprise -COMPONENTS=Java on Truffle,SubstrateVM Enterprise,Java on Truffle LLVM Java libraries,suite:tools,suite:tools-enterprise +COMPONENTS=Java on Truffle,SubstrateVM Enterprise,Java on Truffle LLVM Java libraries,suite:tools,suite:tools-enterprise,tflm NATIVE_IMAGES=lib:javavm DISABLE_INSTALLABLES=true EXCLUDE_COMPONENTS=hprf diff --git a/sdk/mx.sdk/mx_sdk.py b/sdk/mx.sdk/mx_sdk.py index 27e4d72b17b7..2c212fe6ec3e 100644 --- a/sdk/mx.sdk/mx_sdk.py +++ b/sdk/mx.sdk/mx_sdk.py @@ -115,7 +115,7 @@ def upx(args): third_party_license_files=[], dependencies=[], jar_distributions=[], - boot_jars=['sdk:GRAAL_SDK', 'sdk:JNIUTILS', 'sdk:NATIVEBRIDGE'], + boot_jars=['sdk:GRAAL_SDK'], stability="supported", )) diff --git a/sdk/mx.sdk/mx_sdk_vm.py b/sdk/mx.sdk/mx_sdk_vm.py index 14971d47b7bc..21fd7dee8b99 100644 --- a/sdk/mx.sdk/mx_sdk_vm.py +++ b/sdk/mx.sdk/mx_sdk_vm.py @@ -426,6 +426,8 @@ class GraalVmJdkComponent(GraalVmComponent): class GraalVmJreComponent(GraalVmComponent): pass +class GraalVmTruffleLibrary(GraalVmJreComponent): + pass class GraalVmJvmciComponent(GraalVmJreComponent): def __init__(self, suite, name, short_name, license_files, third_party_license_files, jvmci_jars, **kwargs): diff --git a/sdk/mx.sdk/mx_sdk_vm_impl.py b/sdk/mx.sdk/mx_sdk_vm_impl.py index 66deac6e703f..8f45f84d6ffc 100644 --- a/sdk/mx.sdk/mx_sdk_vm_impl.py +++ b/sdk/mx.sdk/mx_sdk_vm_impl.py @@ -384,6 +384,15 @@ def __init__(self, suite, name, deps, components, is_graalvm, exclLibs, platform for config in component.launcher_configs + component.library_configs: if config.jar_distributions: self.jimage_ignore_jars.update(config.jar_distributions) + if isinstance(component, mx_sdk_vm.GraalVmTruffleLibrary): + # In order to transition to Truffle Unchained we need to + # exclude Truffle libraries from the mechanism that produces + # dummy modules for qualified exports when boot modules are installed in + # the GraalVM JDK to be able to later load it from the module-path. + self.jimage_ignore_jars.update(component.boot_jars) + self.jimage_ignore_jars.update(component.jar_distributions) + self.jimage_ignore_jars.update(component.jvmci_parent_jars) + self.jimage_ignore_jars.update(component.builder_jar_distributions) def _add(_layout, dest, src, component=None, with_sources=False): """ @@ -1655,6 +1664,7 @@ def with_source(dep): if _jlink_libraries(): use_upgrade_module_path = mx.get_env('MX_BUILD_EXPLODED') == 'true' + built = mx_sdk.jlink_new_jdk(_src_jdk, out_dir, self.subject.deps, diff --git a/sdk/mx.sdk/suite.py b/sdk/mx.sdk/suite.py index 4a015cf148e5..f90830a5115a 100644 --- a/sdk/mx.sdk/suite.py +++ b/sdk/mx.sdk/suite.py @@ -468,7 +468,7 @@ "org.graalvm.word", "org.graalvm.polyglot.impl to org.graalvm.truffle, com.oracle.truffle.enterprise", "org.graalvm.word.impl to jdk.internal.vm.compiler", - "org.graalvm.nativeimage.impl to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.base,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.configure,com.oracle.svm.svm_enterprise,org.graalvm.extraimage.builder", + "org.graalvm.nativeimage.impl to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.base,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.configure,com.oracle.svm.svm_enterprise,org.graalvm.extraimage.builder,org.graalvm.truffle.runtime.svm,com.oracle.svm.enterprise.truffle", "org.graalvm.nativeimage.impl.clinit to org.graalvm.nativeimage.builder", ], "uses" : [ @@ -490,7 +490,8 @@ ], "distDependencies" : [ "GRAAL_SDK", - "LAUNCHER_COMMON" + "LAUNCHER_COMMON", + "mx:JUNIT", ], "maven" : False, }, @@ -570,12 +571,15 @@ "dependencies" : [ "org.graalvm.nativebridge.processor.test" ], + "distDependencies" : [ + "mx:JUNIT", + "NATIVEBRIDGE" + ], "requiresConcealed": { "jdk.internal.vm.ci": [ "jdk.vm.ci.services", ], }, - "distDependencies" : ["NATIVEBRIDGE"], "maven": False, "testDistribution" : True, }, diff --git a/sdk/src/org.graalvm.nativeimage.test/src/org/graalvm/nativeimage/ImageSingletonsTest.java b/sdk/src/org.graalvm.nativeimage.test/src/org/graalvm/nativeimage/test/ImageSingletonsTest.java similarity index 97% rename from sdk/src/org.graalvm.nativeimage.test/src/org/graalvm/nativeimage/ImageSingletonsTest.java rename to sdk/src/org.graalvm.nativeimage.test/src/org/graalvm/nativeimage/test/ImageSingletonsTest.java index 036b02108db7..24d3b2d1f217 100644 --- a/sdk/src/org.graalvm.nativeimage.test/src/org/graalvm/nativeimage/ImageSingletonsTest.java +++ b/sdk/src/org.graalvm.nativeimage.test/src/org/graalvm/nativeimage/test/ImageSingletonsTest.java @@ -38,10 +38,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package org.graalvm.nativeimage; +package org.graalvm.nativeimage.test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; + +import org.graalvm.nativeimage.ImageSingletons; import org.junit.Test; @SuppressWarnings("static-method") diff --git a/substratevm/mx.substratevm/language-nfi.properties b/substratevm/mx.substratevm/language-nfi.properties index fa841b79f9df..1b7fcde4eff1 100644 --- a/substratevm/mx.substratevm/language-nfi.properties +++ b/substratevm/mx.substratevm/language-nfi.properties @@ -2,32 +2,12 @@ # Possible values: `libffi` (the default) or `none` DefaultArg = libffi -Args = -H:CLibraryPath=${.}/builder/clibraries-${*} \ +Args = --features=com.oracle.svm.truffle.nfi.TruffleNFIFeature \ + --features=com.oracle.svm.truffle.nfi.posix.PosixTruffleNFIFeature \ + --features=com.oracle.svm.truffle.nfi.windows.WindowsTruffleNFIFeature \ + -H:CLibraryPath=${.}/builder/clibraries-${*} \ -H:MaxRuntimeCompileMethods=600 -ImageBuilderClasspath = ${.}/builder/svm-${*}.jar ImageClasspath = ${.}/truffle-nfi.jar:${.}/truffle-nfi-${*}.jar ExcludeFromAll=true - -# The `--add-exports` are a temporary solution for svm-libffi.jar on classpath, will be fixed by modularization, GR-45103. -JavaArgs = --add-exports org.graalvm.nativeimage.base/com.oracle.svm.util=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.c=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.c.function=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.c.libc=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.feature=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.graal.stackvalue=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.handles=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.headers=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.nodes=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.posix=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.headers=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.thread=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.threadlocal=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.util=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.windows=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.windows.headers=ALL-UNNAMED \ - --add-exports org.graalvm.nativeimage.builder/com.oracle.svm.truffle=ALL-UNNAMED \ - --add-exports jdk.internal.vm.compiler/org.graalvm.compiler.word=ALL-UNNAMED diff --git a/substratevm/mx.substratevm/macro-truffle-svm.properties b/substratevm/mx.substratevm/macro-truffle-svm.properties new file mode 100644 index 000000000000..8ee2ca1a89f5 --- /dev/null +++ b/substratevm/mx.substratevm/macro-truffle-svm.properties @@ -0,0 +1,3 @@ +ImageModulePath = ${.}/../../../truffle/builder/truffle-runtime-svm.jar +Args = -H:CLibraryPath=${.}/../../../truffle/builder +IgnoreIfBuilderOnClasspath = true \ No newline at end of file diff --git a/truffle/mx.truffle/macro-truffle.properties b/substratevm/mx.substratevm/macro-truffle.properties similarity index 88% rename from truffle/mx.truffle/macro-truffle.properties rename to substratevm/mx.substratevm/macro-truffle.properties index 65d8147a1392..60c81f5d8760 100644 --- a/truffle/mx.truffle/macro-truffle.properties +++ b/substratevm/mx.substratevm/macro-truffle.properties @@ -1,5 +1,8 @@ # This file contains support for building truffle images -Args = -H:Features=com.oracle.svm.truffle.TruffleFeature,com.oracle.svm.truffle.TruffleBaseFeature,org.graalvm.home.HomeFinderFeature \ +Args = --features=com.oracle.svm.truffle.TruffleFeature \ + --features=com.oracle.svm.truffle.TruffleBaseFeature \ + --features=com.oracle.svm.truffle.TruffleJFRFeature \ + --features=org.graalvm.home.HomeFinderFeature \ -H:MaxRuntimeCompileMethods=2500 \ --initialize-at-build-time=com.oracle.truffle \ --initialize-at-build-time=org.graalvm.shadowed.org.jcodings \ @@ -14,8 +17,10 @@ Args = -H:Features=com.oracle.svm.truffle.TruffleFeature,com.oracle.svm.truffle. # The `--add-exports` are a temporary solution for languages on classpath, will be fixed by languages modularization, GR-44217. JavaArgs = -Dtruffle.TruffleRuntime=com.oracle.svm.truffle.api.SubstrateTruffleRuntime \ -Dgraalvm.ForcePolyglotInvalid=false \ - --add-exports com.oracle.truffle.enterprise/com.oracle.truffle.polyglot.enterprise=ALL-UNNAMED \ - --add-exports com.oracle.truffle.enterprise/com.oracle.truffle.runtime.enterprise=ALL-UNNAMED \ + --add-exports java.base/jdk.internal.module=org.graalvm.truffle.runtime.svm \ + --add-exports java.base/jdk.internal.misc=org.graalvm.truffle.runtime.svm \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.meta=org.graalvm.truffle.runtime.svm \ + --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.truffle.runtime.svm \ --add-exports org.graalvm.truffle.runtime/com.oracle.truffle.runtime=ALL-UNNAMED \ --add-exports org.graalvm.truffle.compiler/com.oracle.truffle.compiler=ALL-UNNAMED \ --add-exports org.graalvm.truffle/com.oracle.truffle.api=ALL-UNNAMED \ diff --git a/substratevm/mx.substratevm/mx_substratevm.py b/substratevm/mx.substratevm/mx_substratevm.py index e7ab2c0de1a0..3502af794c18 100644 --- a/substratevm/mx.substratevm/mx_substratevm.py +++ b/substratevm/mx.substratevm/mx_substratevm.py @@ -319,7 +319,9 @@ def image_demo_task(extra_image_args=None, flightrecorder=True): def truffle_args(extra_build_args): assert isinstance(extra_build_args, list) - build_args = ['--force-builder-on-cp', '--build-args', '--macro:truffle', '-H:MaxRuntimeCompileMethods=5000', '-H:+TruffleCheckBlackListedMethods'] + build_args = ['--build-args', '--macro:truffle', '--language:nfi', + '--add-exports=java.base/jdk.internal.module=ALL-UNNAMED', + '-H:MaxRuntimeCompileMethods=5000', '-H:+TruffleCheckBlackListedMethods'] run_args = ['--run-args', '--very-verbose', '--enable-timing'] return build_args + extra_build_args + run_args @@ -388,7 +390,10 @@ def svm_gate_body(args, tasks): mx.warn('NFI unittests use dlopen and thus do not work with statically linked executables') else: testlib = mx_subst.path_substitutions.substitute('-Dnative.test.path=') - native_unittest_args = ['com.oracle.truffle.nfi.test', '--force-builder-on-cp', '--build-args', '--language:nfi', + native_unittest_args = ['com.oracle.truffle.nfi.test', '--build-args', + '--macro:truffle', + '--language:nfi', + '--add-exports=java.base/jdk.internal.module=ALL-UNNAMED', '-H:MaxRuntimeCompileMethods=2000', '-H:+TruffleCheckBlackListedMethods'] + args.extra_image_builder_arguments + [ '--run-args', testlib, '--very-verbose', '--enable-timing'] @@ -938,7 +943,8 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing installable_id='native-image', license_files=[], third_party_license_files=[], - dependencies=['GraalVM compiler', 'Truffle API', 'Truffle Macro', 'SubstrateVM Static Libraries'], + # Use short name for Truffle Runtime SVM to select by priority + dependencies=['GraalVM compiler', 'SubstrateVM Static Libraries', 'svmt'], jar_distributions=['substratevm:LIBRARY_SUPPORT'], builder_jar_distributions=[ 'substratevm:SVM', @@ -962,7 +968,7 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing third_party_license_files=[], dependencies=['SubstrateVM', 'Truffle NFI'], truffle_jars=[], - builder_jar_distributions=['substratevm:SVM_LIBFFI'], + builder_jar_distributions=[], support_distributions=['substratevm:SVM_NFI_GRAALVM_SUPPORT'], installable=False, )) @@ -1012,7 +1018,8 @@ def _native_image_launcher_extra_jvm_args(): license_files=[], third_party_license_files=[], dependencies=['SubstrateVM', 'nil'], - support_distributions=['substratevm:NATIVE_IMAGE_GRAALVM_SUPPORT'], + provided_executables=['bin/'], + support_distributions=['substratevm:TRUFFLE_REBUILD_IMAGES_GRAALVM_SUPPORT'], launcher_configs=[ mx_sdk_vm.LauncherConfig( use_modules='image', @@ -1054,7 +1061,6 @@ def _native_image_launcher_extra_jvm_args(): headers=False, ), ], - provided_executables=['bin/'], installable=True, stability="earlyadopter", jlink=False, @@ -1105,6 +1111,48 @@ def _native_image_launcher_extra_jvm_args(): if llvm_supported: mx_sdk_vm.register_graalvm_component(ce_llvm_backend) +# Legacy Truffle Macro +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVMSvmMacro( + suite=suite, + name='Truffle Macro', + short_name='tflm', + dir_name='truffle', + license_files=[], + third_party_license_files=[], + dependencies=['tfl'], + support_distributions=['substratevm:TRUFFLE_GRAALVM_SUPPORT'], + stability="supported", +)) + +# Truffle Unchained SVM Macro +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVMSvmMacro( + suite=suite, + name='Truffle SVM Macro', + short_name='tflsm', + dir_name='truffle-svm', + license_files=[], + third_party_license_files=[], + dependencies=['svmt'], + priority=0, + support_distributions=['substratevm:TRUFFLE_SVM_GRAALVM_SUPPORT', 'substratevm:SVM_TRUFFLE_RUNTIME_GRAALVM_SUPPORT'], + stability="supported", +)) + +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmTruffleLibrary( + suite=suite, + name='Truffle Runtime SVM', + short_name='svmt', + dir_name='truffle', + license_files=[], + third_party_license_files=[], + dependencies=[], + builder_jar_distributions=[ + 'substratevm:TRUFFLE_RUNTIME_SVM', + ], + support_distributions=[], + stability="supported", + jlink=False, +)) mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmJreComponent( suite=suite, @@ -1173,6 +1221,7 @@ def _native_image_launcher_extra_jvm_args(): libgraal_jar_distributions = [ 'sdk:NATIVEBRIDGE', + 'sdk:JNIUTILS', 'substratevm:GRAAL_HOTSPOT_LIBRARY'] libgraal_build_args = [ diff --git a/substratevm/mx.substratevm/suite.py b/substratevm/mx.substratevm/suite.py index 691939d16211..56d999b1491d 100644 --- a/substratevm/mx.substratevm/suite.py +++ b/substratevm/mx.substratevm/suite.py @@ -1291,7 +1291,6 @@ "description" : "SubstrateVM image builder components", "dependencies": [ "com.oracle.svm.graal", - "com.oracle.svm.truffle", "com.oracle.svm.hosted", "com.oracle.svm.core", "com.oracle.svm.core.graal.amd64", @@ -1308,15 +1307,12 @@ "POINTSTO", "compiler:GRAAL", "NATIVE_IMAGE_BASE", - "truffle:TRUFFLE_API", - "truffle:TRUFFLE_RUNTIME", ], "moduleInfo" : { "name" : "org.graalvm.nativeimage.builder", "exports" : [ "com.oracle.svm.hosted to java.base", - "com.oracle.svm.truffle.api to org.graalvm.truffle", - "* to org.graalvm.nativeimage.base,jdk.internal.vm.compiler,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.configure,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.junitsupport,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,com.oracle.svm.svm_enterprise,com.oracle.svm.svm_enterprise.llvm,com.oracle.svm_enterprise.ml_dataset,org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise", + "* to org.graalvm.nativeimage.base,jdk.internal.vm.compiler,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.configure,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.junitsupport,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,com.oracle.svm.svm_enterprise,com.oracle.svm.svm_enterprise.llvm,com.oracle.svm_enterprise.ml_dataset,org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", ], "opens" : [ "com.oracle.svm.core to jdk.internal.vm.compiler", @@ -1334,15 +1330,9 @@ "uses" : [ "org.graalvm.nativeimage.Platform", "org.graalvm.compiler.options.OptionDescriptors", - "com.oracle.truffle.api.TruffleLanguage.Provider", - "com.oracle.truffle.api.instrumentation.TruffleInstrument.Provider", - "com.oracle.truffle.api.provider.TruffleLanguageProvider", - "com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider", "com.oracle.svm.hosted.NativeImageClassLoaderPostProcessing", "java.util.spi.ResourceBundleControlProvider", "com.oracle.svm.core.feature.AutomaticallyRegisteredFeatureServiceRegistration", - "com.oracle.truffle.api.TruffleLanguage.Provider", # Deprecated - "com.oracle.truffle.api.instrumentation.TruffleInstrument.Provider", # Deprecated ], "requiresConcealed": { "jdk.internal.vm.ci": [ @@ -1384,19 +1374,6 @@ "noMavenJavadoc": True, }, - "SVM_LIBFFI": { - "subDir": "src", - "description" : "SubstrateVM support for Truffle NFI LibFFI backend", - "dependencies": [ - "com.oracle.svm.truffle.nfi", - "com.oracle.svm.truffle.nfi.posix", - "com.oracle.svm.truffle.nfi.windows", - ], - "distDependencies": [ - "SVM", - ], - }, - "JVMTI_AGENT_BASE": { "subDir": "src", "description": "Base framework for creating a JVMTI agent.", @@ -1488,6 +1465,110 @@ }, }, + "TRUFFLE_RUNTIME_SVM": { + "subDir": "src", + "description" : "SVM Runtime for Truffle languages.", + "dependencies": [ + "com.oracle.svm.truffle", + "com.oracle.svm.truffle.nfi", + "com.oracle.svm.truffle.nfi.posix", + "com.oracle.svm.truffle.nfi.windows", + ], + "distDependencies": [ + "SVM", + "OBJECTFILE", + "POINTSTO", + "truffle:TRUFFLE_RUNTIME", + ], + "moduleInfo" : { + "name" : "org.graalvm.truffle.runtime.svm", + "exports" : [ + "com.oracle.svm.truffle.api to org.graalvm.truffle", + "* to org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", + ], + "opens" : [ + "com.oracle.svm.truffle to org.graalvm.nativeimage.builder,jdk.internal.vm.compiler", + "com.oracle.svm.truffle.nfi to org.graalvm.nativeimage.builder,jdk.internal.vm.compiler", + "com.oracle.svm.truffle.nfi.windows to org.graalvm.nativeimage.builder,jdk.internal.vm.compiler", + "com.oracle.svm.truffle.nfi.posix to org.graalvm.nativeimage.builder,jdk.internal.vm.compiler", + "com.oracle.svm.truffle.api to org.graalvm.nativeimage.builder,jdk.internal.vm.compiler", + "com.oracle.svm.truffle.isolated to org.graalvm.nativeimage.builder,jdk.internal.vm.compiler", + ], + "requires": [ + "java.management", + "jdk.management", + # the runtime might not be available at runtime + # the module can still be used with the TruffleBaseFeature + "static org.graalvm.truffle.runtime", + "static org.graalvm.jniutils", + ], + "uses" : [ + "com.oracle.truffle.api.TruffleLanguage.Provider", + "com.oracle.truffle.api.instrumentation.TruffleInstrument.Provider", + "com.oracle.truffle.api.provider.TruffleLanguageProvider", + "com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider", + "com.oracle.truffle.api.TruffleLanguage.Provider", # Deprecated + "com.oracle.truffle.api.instrumentation.TruffleInstrument.Provider", # Deprecated + ], + "requiresConcealed": { + "jdk.internal.vm.ci": [ + "jdk.vm.ci.common", + "jdk.vm.ci.meta", + "jdk.vm.ci.code", + "jdk.vm.ci.services", + "jdk.vm.ci.runtime", + "jdk.vm.ci.amd64", + "jdk.vm.ci.aarch64", + "jdk.vm.ci.hotspot", + ], + "java.management": [ + "sun.management", + ], + }, + }, + "noMavenJavadoc": True, + }, + + "TRUFFLE_GRAALVM_SUPPORT" : { + "native" : True, + "description" : "Truffle support distribution for SVM", + "layout" : { + "native-image.properties" : "file:mx.substratevm/macro-truffle.properties", + }, + "maven" : False, + }, + + "TRUFFLE_REBUILD_IMAGES_GRAALVM_SUPPORT" : { + "native" : True, + "platformDependent" : True, + "description" : "Native Image support distribution for the GraalVM", + "os_arch" : { + "windows": { + "" : { + "layout" : { + "bin/" : "file:mx.substratevm/rebuild-images.cmd", + }, + }, + }, + "": { + "": { + "layout" : { + "bin/rebuild-images" : "file:mx.substratevm/rebuild-images.sh", + }, + }, + }, + }, + }, + + "TRUFFLE_SVM_GRAALVM_SUPPORT" : { + "native" : True, + "description" : "Truffle support distribution for SVM", + "layout" : { + "native-image.properties" : "file:mx.substratevm/macro-truffle-svm.properties", + }, + "maven" : False, + }, + "GRAAL_HOTSPOT_LIBRARY": { "subDir": "src", "description" : "SubstrateVM HotSpot Graal library support", @@ -1645,9 +1726,9 @@ "moduleInfo" : { "name" : "org.graalvm.nativeimage.base", "exports" : [ - "com.oracle.svm.util to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,org.graalvm.nativeimage.junitsupport,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.extraimage.librarysupport", - "com.oracle.svm.common.meta to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,org.graalvm.extraimage.builder", - "com.oracle.svm.common.option to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.driver", + "com.oracle.svm.util to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,org.graalvm.nativeimage.junitsupport,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise,org.graalvm.extraimage.librarysupport,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", + "com.oracle.svm.common.meta to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,org.graalvm.extraimage.builder,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", + "com.oracle.svm.common.option to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.driver,org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", ], } }, @@ -1829,25 +1910,18 @@ }, }, - "NATIVE_IMAGE_GRAALVM_SUPPORT" : { + "SVM_TRUFFLE_RUNTIME_GRAALVM_SUPPORT" : { "native" : True, "platformDependent" : True, - "description" : "Native Image support distribution for the GraalVM", - "os_arch" : { - "windows": { - "" : { - "layout" : { - "bin/" : "file:mx.substratevm/rebuild-images.cmd", - }, - }, - }, - "": { - "": { - "layout" : { - "bin/rebuild-images" : "file:mx.substratevm/rebuild-images.sh", - }, - }, - }, + "description" : "Native libraries and headers for SubstrateVM NFI support", + "layout" : { + "builder/include/" : [ + "file:src/com.oracle.svm.libffi/include/svm_libffi.h", + "extracted-dependency:truffle:TRUFFLE_NFI_GRAALVM_SUPPORT/include/trufflenfi.h", + ], + "builder/" : [ + "extracted-dependency:truffle:LIBFFI_DIST" + ], }, }, diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/MacroOptionHandler.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/MacroOptionHandler.java index 24fe590ac660..c4967def0b3f 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/MacroOptionHandler.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/MacroOptionHandler.java @@ -79,6 +79,10 @@ private void applyEnabled(MacroOption.EnabledOption enabledOption, String argume } BuildConfiguration config = nativeImage.config; + boolean ignoreIfBuilderOnClasspath = Boolean.parseBoolean(enabledOption.getProperty(config, "IgnoreIfBuilderOnClasspath")); + if (ignoreIfBuilderOnClasspath && !config.modulePathBuild) { + return; + } String propertyName = "BuilderOnClasspath"; String propertyValue = enabledOption.getProperty(config, propertyName); diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java index a45aee72ce37..b730f523eed2 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java @@ -147,6 +147,7 @@ static String getResource(String resourceName) { } catch (IOException e) { VMError.shouldNotReachHere(e); } + return null; } @@ -422,6 +423,9 @@ public List getBuilderClasspath() { result.addAll(getJars(libJvmciDir, "graal-sdk", "graal", "enterprise-graal")); } result.addAll(getJars(rootDir.resolve(Paths.get("lib", "svm", "builder")))); + if (!modulePathBuild) { + result.addAll(createTruffleBuilderModulePath()); + } return result; } @@ -548,13 +552,31 @@ public List getBuilderModulePath() { if (libJvmciDir != null) { result.addAll(getJars(libJvmciDir, "graal-sdk", "enterprise-graal")); } - result.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-compiler", "truffle-runtime", "truffle-enterprise")); if (modulePathBuild) { + result.addAll(createTruffleBuilderModulePath()); result.addAll(getJars(rootDir.resolve(Paths.get("lib", "svm", "builder")))); } return result; } + private List createTruffleBuilderModulePath() { + List jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise"); + if (!jars.isEmpty()) { + /* + * If Truffle is installed as part of the JDK we always add the builder modules of + * Truffle to the builder module path. This is legacy support and should in the + * future no longer be needed. + */ + jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler")); + Path builderPath = rootDir.resolve(Paths.get("lib", "truffle", "builder")); + if (Files.exists(builderPath)) { + jars.addAll(getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm")); + } + } + + return jars; + } + /** * @return entries for the --upgrade-module-path of the image builder */ @@ -1575,8 +1597,8 @@ protected int buildImage(List javaArgs, LinkedHashSet cp, LinkedHa * * @see #callListModules(String, List) */ - private static Map listModulesFromPath(String javaExecutable, Collection modulePath) { - if (modulePath.isEmpty()) { + private Map listModulesFromPath(String javaExecutable, Collection modulePath) { + if (modulePath.isEmpty() || !config.modulePathBuild) { return Map.of(); } String modulePathEntries = modulePath.stream() @@ -1602,25 +1624,24 @@ private static Map callListModules(String javaExecutable, List lines; try (var br = new BufferedReader(new InputStreamReader(listModulesProcess.getInputStream()))) { - while (true) { - var line = br.readLine(); - if (line == null) { - break; - } - String[] splitString = StringUtil.split(line, " ", 3); - String[] splitModuleNameAndVersion = StringUtil.split(splitString[0], "@", 2); - Path externalPath = null; - if (splitString.length > 1) { - String pathURI = splitString[1]; // url: file://path/to/file - externalPath = Path.of(URI.create(pathURI)).toAbsolutePath(); - } - result.put(splitModuleNameAndVersion[0], externalPath); - } + lines = br.lines().toList(); } int exitStatus = listModulesProcess.waitFor(); if (exitStatus != 0) { - throw showError("Determining image-builder observable modules failed (Exit status %d).".formatted(exitStatus)); + throw showError("Determining image-builder observable modules failed (Exit status %d). Process output: %n%s".formatted(exitStatus, String.join(System.lineSeparator(), lines))); + } + for (String line : lines) { + String[] splitString = StringUtil.split(line, " ", 3); + String[] splitModuleNameAndVersion = StringUtil.split(splitString[0], "@", 2); + Path externalPath = null; + if (splitString.length > 1) { + String pathURI = splitString[1]; // url: file://path/to/file + externalPath = Path.of(URI.create(pathURI)).toAbsolutePath(); + } + result.put(splitModuleNameAndVersion[0], externalPath); } } catch (IOException | InterruptedException e) { throw showError(e.getMessage()); diff --git a/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/truffle/TruffleToLibGraalEntryPoints.java b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/truffle/TruffleToLibGraalEntryPoints.java index 7081626be8f5..b0413acf2887 100644 --- a/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/truffle/TruffleToLibGraalEntryPoints.java +++ b/substratevm/src/com.oracle.svm.graal.hotspot.libgraal/src/com/oracle/svm/graal/hotspot/libgraal/truffle/TruffleToLibGraalEntryPoints.java @@ -515,11 +515,15 @@ public static void purgePartialEvaluationCaches(JNIEnv env, JClass hsClass, @CEn } static { + Class callsClass; try { - Class callsClass = Class.forName("com.oracle.truffle.runtime.hotspot.libgraal.TruffleToLibGraalCalls"); + callsClass = Class.forName("com.oracle.truffle.runtime.hotspot.libgraal.TruffleToLibGraalCalls"); LibGraalChecker.checkToLibGraalCalls(TruffleToLibGraalEntryPoints.class, callsClass, TruffleToLibGraal.class); } catch (ClassNotFoundException e) { - throw new InternalError(e); + /* + * Truffle might not be on the class path if libgraal is built. If it is, we should + * validate the usage. + */ } } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java index f5c4ff8ecf01..58945a4f7580 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java @@ -788,6 +788,10 @@ public HostedUniverse getUniverse() { @Override public Path getImagePath() { + if (linkerInvocation == null) { + /* Some backends might not use native-linking */ + return null; + } return linkerInvocation.getOutputFile(); } diff --git a/substratevm/src/com.oracle.svm.junit/src/com/oracle/svm/junit/JUnitFeature.java b/substratevm/src/com.oracle.svm.junit/src/com/oracle/svm/junit/JUnitFeature.java index e2ec68be2803..95c306032d74 100644 --- a/substratevm/src/com.oracle.svm.junit/src/com/oracle/svm/junit/JUnitFeature.java +++ b/substratevm/src/com.oracle.svm.junit/src/com/oracle/svm/junit/JUnitFeature.java @@ -69,6 +69,8 @@ private static boolean includesClass(Description dn, Class clazz) { public void afterRegistration(AfterRegistrationAccess access) { /* Open up builder to allow whitebox testing */ ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, null, true, "org.graalvm.nativeimage.builder"); + ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, null, true, "jdk.internal.vm.compiler"); + ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, null, true, "jdk.internal.vm.ci"); SVMJUnitRunner svmRunner = new SVMJUnitRunner(access); ImageSingletons.add(SVMJUnitRunner.class, svmRunner); } diff --git a/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java b/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java index 90ba217143f7..a8171f7754d9 100644 --- a/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java +++ b/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java @@ -37,7 +37,6 @@ import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.c.libc.GLibC; import com.oracle.svm.core.c.libc.LibCBase; -import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.core.graal.stackvalue.UnsafeStackValue; import com.oracle.svm.core.jdk.PlatformNativeLibrarySupport; @@ -48,14 +47,18 @@ import com.oracle.svm.core.posix.headers.PosixLibC; import com.oracle.svm.core.util.VMError; import com.oracle.svm.truffle.nfi.Target_com_oracle_truffle_nfi_backend_libffi_NFIUnsatisfiedLinkError; +import com.oracle.svm.truffle.nfi.TruffleNFIFeature; import com.oracle.svm.truffle.nfi.TruffleNFISupport; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.exception.AbstractTruffleException; -@AutomaticallyRegisteredFeature -@Platforms({Platform.LINUX.class, Platform.DARWIN.class}) public final class PosixTruffleNFIFeature implements InternalFeature { + @Override + public boolean isInConfiguration(IsInConfigurationAccess access) { + return ImageSingletons.contains(TruffleNFIFeature.class) && (Platform.includedIn(Platform.LINUX.class) || Platform.includedIn(Platform.DARWIN.class)); + } + @Override public void duringSetup(DuringSetupAccess access) { PosixTruffleNFISupport.initialize(); diff --git a/substratevm/src/com.oracle.svm.truffle.nfi.windows/src/com/oracle/svm/truffle/nfi/windows/WindowsTruffleNFIFeature.java b/substratevm/src/com.oracle.svm.truffle.nfi.windows/src/com/oracle/svm/truffle/nfi/windows/WindowsTruffleNFIFeature.java index 81d96914ae6b..fc05b1700d02 100644 --- a/substratevm/src/com.oracle.svm.truffle.nfi.windows/src/com/oracle/svm/truffle/nfi/windows/WindowsTruffleNFIFeature.java +++ b/substratevm/src/com.oracle.svm.truffle.nfi.windows/src/com/oracle/svm/truffle/nfi/windows/WindowsTruffleNFIFeature.java @@ -26,7 +26,6 @@ import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.Platform; -import org.graalvm.nativeimage.Platforms; import org.graalvm.nativeimage.c.type.CCharPointer; import org.graalvm.nativeimage.c.type.CTypeConversion; import org.graalvm.word.PointerBase; @@ -35,20 +34,23 @@ import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.core.jdk.PlatformNativeLibrarySupport; -import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.core.windows.WindowsUtils; import com.oracle.svm.core.windows.headers.LibLoaderAPI; import com.oracle.svm.core.windows.headers.WinBase.HMODULE; import com.oracle.svm.core.windows.headers.WindowsLibC; import com.oracle.svm.truffle.nfi.Target_com_oracle_truffle_nfi_backend_libffi_NFIUnsatisfiedLinkError; +import com.oracle.svm.truffle.nfi.TruffleNFIFeature; import com.oracle.svm.truffle.nfi.TruffleNFISupport; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.exception.AbstractTruffleException; -@AutomaticallyRegisteredFeature -@Platforms(Platform.WINDOWS.class) public final class WindowsTruffleNFIFeature implements InternalFeature { + @Override + public boolean isInConfiguration(IsInConfigurationAccess access) { + return ImageSingletons.contains(TruffleNFIFeature.class) && Platform.includedIn(Platform.WINDOWS.class); + } + @Override public void duringSetup(DuringSetupAccess access) { WindowsTruffleNFISupport.initialize(); diff --git a/substratevm/src/com.oracle.svm.truffle.nfi/src/com/oracle/svm/truffle/nfi/TruffleNFIFeature.java b/substratevm/src/com.oracle.svm.truffle.nfi/src/com/oracle/svm/truffle/nfi/TruffleNFIFeature.java index b1c4d79c13de..0dcd6507a375 100644 --- a/substratevm/src/com.oracle.svm.truffle.nfi/src/com/oracle/svm/truffle/nfi/TruffleNFIFeature.java +++ b/substratevm/src/com.oracle.svm.truffle.nfi/src/com/oracle/svm/truffle/nfi/TruffleNFIFeature.java @@ -32,7 +32,6 @@ import org.graalvm.nativeimage.hosted.Feature; import com.oracle.svm.core.feature.InternalFeature; -import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.truffle.TruffleBaseFeature; /** @@ -42,7 +41,6 @@ * re-implementations of the original NFI functions with the C interface of Substrate VM. If this * feature is enabled, the image is statically linked with libffi. */ -@AutomaticallyRegisteredFeature public final class TruffleNFIFeature implements InternalFeature { public static class IsEnabled implements BooleanSupplier { @@ -52,6 +50,11 @@ public boolean getAsBoolean() { } } + @Override + public boolean isInConfiguration(IsInConfigurationAccess access) { + return access.findClassByName("com.oracle.truffle.nfi.backend.libffi.LibFFILanguage") != null; + } + @Override public List> getRequiredFeatures() { return Arrays.asList(TruffleBaseFeature.class); diff --git a/substratevm/src/com.oracle.svm.truffle/src/META-INF/native-image/org.graalvm.truffle.runtime.svm/native-image.properties b/substratevm/src/com.oracle.svm.truffle/src/META-INF/native-image/org.graalvm.truffle.runtime.svm/native-image.properties new file mode 100644 index 000000000000..5045dcda5b9b --- /dev/null +++ b/substratevm/src/com.oracle.svm.truffle/src/META-INF/native-image/org.graalvm.truffle.runtime.svm/native-image.properties @@ -0,0 +1,4 @@ +Args = --add-opens=org.graalvm.sdk/org.graalvm.polyglot=org.graalvm.truffle \ + --add-exports=jdk.internal.vm.ci/jdk.vm.ci.meta=org.graalvm.truffle.runtime.svm \ + --add-exports=jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.truffle.runtime.svm \ + --add-exports=java.base/jdk.internal.misc=org.graalvm.truffle.runtime.svm \ diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java index 4a54844a5978..bd3e23eee5c2 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java @@ -120,7 +120,6 @@ import com.oracle.svm.hosted.classinitialization.ClassInitializationSupport; import com.oracle.svm.hosted.heap.PodSupport; import com.oracle.svm.hosted.snippets.SubstrateGraphBuilderPlugins; -import com.oracle.svm.truffle.api.SubstrateTruffleRuntime; import com.oracle.svm.util.ReflectionUtil; import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; @@ -169,7 +168,15 @@ public String getURL() { @Override public String getDescription() { - return "Provides base support for Truffle"; + return "Provides support for Truffle languages"; + } + + public static Class lookupClass(String className) { + try { + return Class.forName(className, false, TruffleBaseFeature.class.getClassLoader()); + } catch (ClassNotFoundException ex) { + throw new AssertionError(ex); + } } public static class Options { @@ -289,7 +296,7 @@ public void afterRegistration(AfterRegistrationAccess a) { TruffleRuntime runtime = Truffle.getRuntime(); UserError.guarantee(runtime != null, "TruffleRuntime not available via Truffle.getRuntime()"); - UserError.guarantee(runtime instanceof SubstrateTruffleRuntime || runtime instanceof DefaultTruffleRuntime, + UserError.guarantee(isSubstrateRuntime(runtime) || runtime instanceof DefaultTruffleRuntime, "Unsupported TruffleRuntime %s (only SubstrateTruffleRuntime or DefaultTruffleRuntime allowed)", runtime.getClass().getName()); @@ -311,19 +318,21 @@ public void afterRegistration(AfterRegistrationAccess a) { profilingEnabled = false; } + @SuppressWarnings({"null", "unused"}) + private static boolean isSubstrateRuntime(TruffleRuntime runtime) { + /* + * We cannot directly depend on SubstrateTruffleRuntime from the base feature, as the + * runtime might not be on the module-path. + */ + return runtime.getClass().getName().equals("com.oracle.svm.truffle.api.SubstrateTruffleRuntime"); + } + public void setProfilingEnabled(boolean profilingEnabled) { this.profilingEnabled = profilingEnabled; } @Override public void cleanup() { - /* - * Clean the cached call target nodes to prevent them from keeping application classes alive - */ - TruffleRuntime runtime = Truffle.getRuntime(); - if (!(runtime instanceof DefaultTruffleRuntime) && !(runtime instanceof SubstrateTruffleRuntime)) { - throw VMError.shouldNotReachHere("Only SubstrateTruffleRuntime and DefaultTruffleRuntime supported"); - } // clean up the language cache invokeStaticMethod("com.oracle.truffle.polyglot.PolyglotFastThreadLocals", "resetNativeImageState", Collections.emptyList()); @@ -376,7 +385,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec @Override public void duringSetup(DuringSetupAccess access) { - if (!ImageSingletons.contains(TruffleFeature.class) && (Truffle.getRuntime() instanceof SubstrateTruffleRuntime)) { + if (!ImageSingletons.contains(TruffleFeature.class) && isSubstrateRuntime(Truffle.getRuntime())) { VMError.shouldNotReachHere("TruffleFeature is required for SubstrateTruffleRuntime."); } access.registerObjectReplacer(this::processInlinedField); @@ -1006,55 +1015,63 @@ private static final class StaticObjectPodBasedSupport { static void onBuildInvocation(Class storageSuperClass, Class factoryInterface) { PodSupport.singleton().registerSuperclass(storageSuperClass, factoryInterface); } + } } @Override public void afterImageWrite(AfterImageWriteAccess access) { if (Options.CopyLanguageResources.getValue()) { - Path buildDir = access.getImagePath().getParent(); - assert buildDir != null; - Path resourcesDir = buildDir.resolve("resources"); - if (languageHomesToCopy != null) { - Path languagesDir = resourcesDir.resolve("languages"); - if (Files.exists(languagesDir)) { - - try (Stream filesToDelete = Files.walk(languagesDir)) { - filesToDelete.sorted(Comparator.reverseOrder()) - .forEach(f -> { - try { - Files.deleteIfExists(f); - } catch (IOException ioe) { - throw VMError.shouldNotReachHere("Deletion of previous language resources directory failed.", ioe); - } - }); - } catch (IOException ioe) { - throw VMError.shouldNotReachHere("Deletion of previous language resources directory failed.", ioe); - } + Path buildDir = access.getImagePath(); + if (buildDir != null) { + Path parent = buildDir.getParent(); + if (parent != null) { + copyResources(parent); } - HomeFinder hf = HomeFinder.getInstance(); - Map languageHomes = hf.getLanguageHomes(); - languageHomesToCopy.forEach((s, path) -> { - Path copyTo = buildDir.resolve(path); - Path copyFrom = languageHomes.get(s); - Path fileListFile = copyFrom.resolve(NATIVE_IMAGE_FILELIST_FILE_NAME); - try { - Files.lines(fileListFile).forEach(fileName -> { - copy(s, copyFrom.resolve(fileName), copyTo.resolve(fileName)); - }); - } catch (IOException ioe) { - throw VMError.shouldNotReachHere(String.format("Copying of language resources failed for language %s.", s), ioe); - } - BuildArtifacts.singleton().add(BuildArtifacts.ArtifactType.LANGUAGE_HOME, copyTo); - }); } - try { - if (Engine.copyResources(resourcesDir)) { - BuildArtifacts.singleton().add(BuildArtifacts.ArtifactType.LANGUAGE_INTERNAL_RESOURCES, resourcesDir); + } + } + + private void copyResources(Path buildDir) { + Path resourcesDir = buildDir.resolve("resources"); + if (languageHomesToCopy != null) { + Path languagesDir = resourcesDir.resolve("languages"); + if (Files.exists(languagesDir)) { + try (Stream filesToDelete = Files.walk(languagesDir)) { + filesToDelete.sorted(Comparator.reverseOrder()) + .forEach(f -> { + try { + Files.deleteIfExists(f); + } catch (IOException ioe) { + throw VMError.shouldNotReachHere("Deletion of previous language resources directory failed.", ioe); + } + }); + } catch (IOException ioe) { + throw VMError.shouldNotReachHere("Deletion of previous language resources directory failed.", ioe); + } + } + HomeFinder hf = HomeFinder.getInstance(); + Map languageHomes = hf.getLanguageHomes(); + languageHomesToCopy.forEach((s, path) -> { + Path copyTo = buildDir.resolve(path); + Path copyFrom = languageHomes.get(s); + Path fileListFile = copyFrom.resolve(NATIVE_IMAGE_FILELIST_FILE_NAME); + try { + Files.lines(fileListFile).forEach(fileName -> { + copy(s, copyFrom.resolve(fileName), copyTo.resolve(fileName)); + }); + } catch (IOException ioe) { + throw VMError.shouldNotReachHere(String.format("Copying of language resources failed for language %s.", s), ioe); } - } catch (IOException ioe) { - throw VMError.shouldNotReachHere("Copying of internal resources failed.", ioe); + BuildArtifacts.singleton().add(BuildArtifacts.ArtifactType.LANGUAGE_HOME, copyTo); + }); + } + try { + if (Engine.copyResources(resourcesDir)) { + BuildArtifacts.singleton().add(BuildArtifacts.ArtifactType.LANGUAGE_INTERNAL_RESOURCES, resourcesDir); } + } catch (IOException ioe) { + throw VMError.shouldNotReachHere("Copying of internal resources failed.", ioe); } } @@ -1257,10 +1274,11 @@ public Object transform(Object receiver, Object originalValue) { */ return svmArrayBaseOffset + svmAlignmentCorrection + svmArrayIndexScaleOffset * index; } + } final class ArrayBasedShapeGeneratorOffsetTransformer implements FieldValueTransformerWithAvailability { - static final Class SHAPE_GENERATOR = ReflectionUtil.lookupClass(false, "com.oracle.truffle.api.staticobject.ArrayBasedShapeGenerator"); + static final Class SHAPE_GENERATOR = TruffleBaseFeature.lookupClass("com.oracle.truffle.api.staticobject.ArrayBasedShapeGenerator"); private final String storageClassFieldName; diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleFeature.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleFeature.java index d29e423942bd..2833a6b29a7e 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleFeature.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleFeature.java @@ -194,7 +194,7 @@ public String getURL() { @Override public String getDescription() { - return "Enables compilation of Truffle ASTs to machine code"; + return "Provides support for Truffle runtime compilation"; } public static class Options { @@ -257,13 +257,20 @@ public List> getRequiredFeatures() { return List.of(RuntimeCompilationFeature.getRuntimeCompilationFeature(), TruffleBaseFeature.class); } + /* + * Duplicated from SafepointSamplingProfilingFeature. Make sure it is in sync. + */ @Override public boolean isInConfiguration(IsInConfigurationAccess access) { return isInConfiguration(); } public static boolean isInConfiguration() { - return Truffle.getRuntime() instanceof SubstrateTruffleRuntime; + String property = System.getProperty("truffle.TruffleRuntime"); + if (property != null) { + return property.equals("com.oracle.svm.truffle.api.SubstrateTruffleRuntime"); + } + return false; } @Override @@ -357,7 +364,6 @@ public void beforeAnalysis(BeforeAnalysisAccess access) { PartialEvaluator partialEvaluator = truffleCompiler.getPartialEvaluator(); registerKnownTruffleFields(config, partialEvaluator.getTypes()); - TruffleSupport.singleton().registerInterpreterEntryMethodsAsCompiled(partialEvaluator, access); GraphBuilderConfiguration graphBuilderConfig = partialEvaluator.getGraphBuilderConfigPrototype(); diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleJFRFeature.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleJFRFeature.java index c686f5bd8a48..3aefd10dc3c4 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleJFRFeature.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleJFRFeature.java @@ -25,11 +25,12 @@ package com.oracle.svm.truffle; import java.util.Iterator; +import java.util.List; import org.graalvm.compiler.serviceprovider.JavaVersionUtil; import org.graalvm.nativeimage.ImageSingletons; +import org.graalvm.nativeimage.hosted.Feature; -import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.core.jfr.JfrFeature; import com.oracle.svm.core.util.UserError; @@ -37,20 +38,32 @@ import com.oracle.truffle.runtime.jfr.EventFactory.Provider; import com.oracle.truffle.runtime.serviceprovider.TruffleRuntimeServices; -@AutomaticallyRegisteredFeature public class TruffleJFRFeature implements InternalFeature { @Override public void afterRegistration(AfterRegistrationAccess access) { - if (isEnabled()) { - Iterator providers = TruffleRuntimeServices.load(Provider.class).iterator(); - if (!providers.hasNext()) { - throw UserError.abort("No EventFactory.Provider is registered in Truffle runtime services."); - } - Provider provider = providers.next(); - EventFactory factory = provider.getEventFactory(); - ImageSingletons.add(EventFactory.class, factory); + Iterator providers = TruffleRuntimeServices.load(Provider.class).iterator(); + if (!providers.hasNext()) { + throw UserError.abort("No EventFactory.Provider is registered in Truffle runtime services."); } + Provider provider = providers.next(); + EventFactory factory = provider.getEventFactory(); + ImageSingletons.add(EventFactory.class, factory); + } + + @Override + public String getDescription() { + return "Provides JFR flight recording for Truffle events."; + } + + @Override + public boolean isInConfiguration(IsInConfigurationAccess access) { + return isEnabled(); + } + + @Override + public List> getRequiredFeatures() { + return List.of(TruffleFeature.class, JfrFeature.class); } private static boolean isEnabled() { diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java index 8f2aea9a7ffd..de82c4ead8ca 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java @@ -32,13 +32,11 @@ import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration; import org.graalvm.compiler.phases.util.Providers; import org.graalvm.compiler.truffle.compiler.EconomyPartialEvaluatorConfiguration; -import org.graalvm.compiler.truffle.compiler.PartialEvaluator; import org.graalvm.compiler.truffle.compiler.PartialEvaluatorConfiguration; import org.graalvm.compiler.truffle.compiler.TruffleCompilerConfiguration; import org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl; import org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration; import org.graalvm.nativeimage.ImageSingletons; -import org.graalvm.nativeimage.hosted.Feature; import com.oracle.svm.core.SubstrateOptions; import com.oracle.svm.core.SubstrateUtil; @@ -97,10 +95,6 @@ public SubstratePartialEvaluator createPartialEvaluator(TruffleCompilerConfigura return new SubstratePartialEvaluator(config, graphBuilderConfigForRoot); } - @SuppressWarnings("unused") - public void registerInterpreterEntryMethodsAsCompiled(PartialEvaluator partialEvaluator, Feature.BeforeAnalysisAccess access) { - } - public SubstrateTruffleCompiler createTruffleCompiler(SubstrateTruffleRuntime runtime) { SubstrateTruffleCompiler compiler = new SubstrateTruffleCompilerImpl(createSubstrateTruffleCompilerConfig(runtime, "community", getOptimizedCallTargetInvokeMethod())); if (SubstrateOptions.supportCompileInIsolates()) { @@ -174,4 +168,5 @@ public TriState tryIsSuppressedFailure(TruffleCompilable compilable, Supplier teardown()); } + @Override + protected EngineCacheSupport loadEngineCacheSupport(List options) { + /* + * On SVM we initialize engine caching support when the TruffleFeature is initialized. We + * cannot do it reliably here as the SubstrateTruffleRuntime might already be initialized + * when the TruffleBaseFeature is initialized, this is when the TruffleSupport is not yet + * installed. + */ + return null; + } + @Override @Platforms(Platform.HOSTED_ONLY.class) public PartialEvaluationMethodInfo getPartialEvaluationMethodInfo(ResolvedJavaMethod method) { @@ -197,6 +221,12 @@ public SubstrateTruffleCompiler preinitializeTruffleCompiler() { return compiler; } + @Platforms(Platform.HOSTED_ONLY.class) + public SubstrateTruffleCompiler getPreinitializedTruffleCompiler() { + assert truffleCompiler != null; + return (SubstrateTruffleCompiler) truffleCompiler; + } + public ResolvedJavaMethod[] getAnyFrameMethod() { return knownMethods.anyFrameMethod; } diff --git a/sulong/mx.sulong/mx_sulong_gate.py b/sulong/mx.sulong/mx_sulong_gate.py index 6f6ff77e5c64..43f7d517f14e 100644 --- a/sulong/mx.sulong/mx_sulong_gate.py +++ b/sulong/mx.sulong/mx_sulong_gate.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2022, Oracle and/or its affiliates. +# Copyright (c) 2016, 2023, Oracle and/or its affiliates. # # All rights reserved. # @@ -279,5 +279,5 @@ def runLLVMUnittests(unittest_runner): run_args = [libpath, libs] + java_run_props build_args = ['--language:llvm'] + java_run_props - unittest_runner(['com.oracle.truffle.llvm.tests.interop', '--force-builder-on-cp', '--run-args'] + run_args + - ['--build-args', '--initialize-at-build-time'] + build_args) + unittest_runner(['com.oracle.truffle.llvm.tests.interop', '--run-args'] + run_args + + ['--build-args', '--add-exports=java.base/jdk.internal.module=ALL-UNNAMED', '--initialize-at-build-time'] + build_args) diff --git a/truffle/mx.truffle/mx_truffle.py b/truffle/mx.truffle/mx_truffle.py index e66aaf236486..e5830907624b 100644 --- a/truffle/mx.truffle/mx_truffle.py +++ b/truffle/mx.truffle/mx_truffle.py @@ -61,7 +61,7 @@ import mx_unittest import tck from mx_gate import Task -from mx_javamodules import as_java_module, get_java_module_info, get_module_name +from mx_javamodules import as_java_module, get_module_name from mx_sigtest import sigtest from mx_unittest import unittest @@ -144,33 +144,6 @@ def checkLinks(javadocDir): if err: mx.abort('There are wrong references in Javadoc') -def _path_args(depNames=None): - """ - Gets the VM args for putting the dependencies named in `depNames` on the - class path and module path (if running on JDK9 or later). - - :param names: a Dependency, str or list containing Dependency/str objects. If None, - then all registered dependencies are used. - """ - jdk = mx.get_jdk() - if jdk.javaCompliance >= '1.9': - modules = [as_java_module(dist, jdk) for dist in _suite.dists if get_java_module_info(dist)] - if modules: - # Partition resources between the class path and module path - modulepath = [] - classpath = [] - cpEntryToModule = {m.dist.path : m for m in modules} - - for e in mx.classpath(depNames).split(os.pathsep): - if e in cpEntryToModule: - modulepath.append(cpEntryToModule[e].jarpath) - else: - classpath.append(e) - # The Truffle modules must be eagerly loaded as they could be referenced from - # the main class hence the --add-modules argument - return ['--add-modules=' + ','.join([m.name for m in modules]), '--module-path=' + os.pathsep.join(modulepath), '-cp', os.pathsep.join(classpath)] - return ['-cp', mx.classpath(depNames)] - def _open_module_exports_args(): """ Gets the VM args for exporting all Truffle API packages on JDK9 or later. @@ -201,6 +174,13 @@ def _unittest_config_participant(config): # in turn allows us to dynamically open fields/methods to reflection. vmArgs = vmArgs + ['--add-exports=java.base/jdk.internal.module=ALL-UNNAMED'] + mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle/*=ALL-UNNAMED']) + mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle.compiler/*=ALL-UNNAMED']) + mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle.runtime/*=ALL-UNNAMED']) + mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.sdk/*=ALL-UNNAMED']) + mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.sl/*=ALL-UNNAMED']) + mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.truffle/*=org.graalvm.sl']) + config = (vmArgs, mainClass, mainClassArgs) if _shouldRunTCKParticipant: config = _unittest_config_participant_tck(config) @@ -208,10 +188,57 @@ def _unittest_config_participant(config): mx_unittest.add_config_participant(_unittest_config_participant) +# simple utility that returns the right distribution names to use +# for building a language module path +def resolve_truffle_dist_names(use_optimized_runtime=True, use_enterprise=True): + if use_optimized_runtime: + enterprise_dist = _get_enterprise_truffle() + if enterprise_dist and use_enterprise: + return ['graal-enterprise:TRUFFLE_ENTERPRISE'] + else: + return ['truffle:TRUFFLE_RUNTIME'] + else: + return ['truffle:TRUFFLE_API'] + +def _get_enterprise_truffle(): + return mx.distribution('graal-enterprise:TRUFFLE_ENTERPRISE', False) + +def resolve_sl_dist_names(use_optimized_runtime=True, use_enterprise=True): + return ['TRUFFLE_SL', 'TRUFFLE_SL_LAUNCHER'] + resolve_truffle_dist_names(use_optimized_runtime=use_optimized_runtime, use_enterprise=use_enterprise) + def sl(args): """run an SL program""" - vmArgs, slArgs = mx.extract_VM_args(args) - mx.run_java(vmArgs + _path_args(["TRUFFLE_API", "com.oracle.truffle.sl", "com.oracle.truffle.sl.launcher"]) + ["com.oracle.truffle.sl.launcher.SLMain"] + slArgs) + vm_args, sl_args = mx.extract_VM_args(args) + return mx.run(_sl_command(vm_args, sl_args)) + +def _sl_command(vm_args, sl_args, use_optimized_runtime=True, use_enterprise=True): + graalvm_home = mx_sdk_vm.graalvm_home(fatalIfMissing=True) + java_path = os.path.join(graalvm_home, 'bin', mx.exe_suffix('java')) + dist_names = resolve_sl_dist_names(use_optimized_runtime=use_optimized_runtime, use_enterprise=use_enterprise) + return [java_path] + vm_args + mx.get_runtime_jvm_args(names=dist_names) + ["com.oracle.truffle.sl.launcher.SLMain"] + sl_args + +def slnative(args): + """build a native image of an SL program""" + vm_args, sl_args = mx.extract_VM_args(args) + target_dir = tempfile.mkdtemp() + image = _native_image_sl(vm_args, target_dir, use_optimized_runtime=True) + if not image: + mx.abort("No native-image installed in GraalVM {}. Switch to an environment that has an installed native-image command.".format(mx_sdk_vm.graalvm_home(fatalIfMissing=True))) + mx.log("Image build completed. Running {}".format(" ".join([image] + sl_args))) + result = mx.run([image] + sl_args) + return result + +def _native_image_sl(vm_args, target_dir, use_optimized_runtime=True, use_enterprise=True): + graalvm_home = mx_sdk_vm.graalvm_home(fatalIfMissing=True) + native_image_path = os.path.join(graalvm_home, 'bin', mx.exe_suffix('native-image')) + if not exists(native_image_path): + native_image_path = os.path.join(graalvm_home, 'bin', mx.cmd_suffix('native-image')) + if not exists(native_image_path): + mx.warn("No native-image installed in GraalVM {}. Switch to an environment that has an installed native-image command.".format(graalvm_home)) + return None + target_path = os.path.join(target_dir, mx.exe_suffix('sl')) + mx.run([native_image_path] + vm_args + mx.get_runtime_jvm_args(names=resolve_sl_dist_names(use_optimized_runtime=use_optimized_runtime, use_enterprise=use_enterprise)) + ["com.oracle.truffle.sl.launcher.SLMain", target_path]) + return target_path def _truffle_gate_runner(args, tasks): jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG) @@ -233,6 +260,114 @@ def _truffle_gate_runner(args, tasks): with Task('Validate parsers', tasks) as t: if t: validate_parsers() +# invoked by vm gate runner in ce-unchained configuration +def sl_jvm_gate_tests(): + def run_jvm_fallback(test_file): + return _sl_command([], [test_file, '--disable-launcher-output', '--engine.WarnInterpreterOnly=false'], use_optimized_runtime=False) + def run_jvm_optimized(test_file): + return _sl_command([], [test_file, '--disable-launcher-output'], use_optimized_runtime=True) + def run_jvm_optimized_immediately(test_file): + return _sl_command([], [test_file, '--disable-launcher-output', '--engine.CompileImmediately', '--engine.BackgroundCompilation=false'], use_optimized_runtime=True) + + mx.log("Run SL JVM Fallback Test") + _run_sl_tests(run_jvm_fallback) + mx.log("Run SL JVM Optimized Test") + _run_sl_tests(run_jvm_optimized) + mx.log("Run SL JVM Optimized Immediately Test") + _run_sl_tests(run_jvm_optimized_immediately) + + # test if the enterprise compiler is in use + # that everything works fine if truffle-enterprise.jar is not availble + enterprise = _get_enterprise_truffle() + if enterprise: + def run_jvm_no_enterprise_optimized(test_file): + return _sl_command([], [test_file, '--disable-launcher-output'], use_optimized_runtime=True, use_enterprise=False) + def run_jvm_no_enterprise_optimized_immediately(test_file): + return _sl_command([], [test_file, '--disable-launcher-output', '--engine.CompileImmediately', '--engine.BackgroundCompilation=false'], use_optimized_runtime=True, use_enterprise=False) + + mx.log("Run SL JVM Optimized Test No Truffle Enterprise") + _run_sl_tests(run_jvm_no_enterprise_optimized) + mx.log("Run SL JVM Optimized Immediately Test No Truffle Enterprise") + _run_sl_tests(run_jvm_no_enterprise_optimized_immediately) + +# invoked by vm gate runner in ce-unchained configuration +def sl_native_optimized_gate_tests(): + target_dir = tempfile.mkdtemp() + image = _native_image_sl([], target_dir, use_optimized_runtime=True, use_enterprise=True) + + def run_native_optimized(test_file): + return [image] + [test_file, '--disable-launcher-output'] + def run_native_optimized_immediately(test_file): + return [image] + [test_file, '--disable-launcher-output', '--engine.CompileImmediately', '--engine.BackgroundCompilation=false'] + + mx.log("Run SL Native Optimized Test") + _run_sl_tests(run_native_optimized) + mx.log("Run SL Native Optimized Immediately Test") + _run_sl_tests(run_native_optimized_immediately) + + mx.rmtree(target_dir) + + # test if the enterprise compiler is in use + # that everything works fine if truffle-enterprise.jar is not availble + enterprise = _get_enterprise_truffle() + if enterprise: + target_dir = tempfile.mkdtemp() + image = _native_image_sl([], target_dir, use_optimized_runtime=True, use_enterprise=False) + + def run_no_enterprise_native_optimized(test_file): + return [image] + [test_file, '--disable-launcher-output'] + def run_no_enterprise_native_optimized_immediately(test_file): + return [image] + [test_file, '--disable-launcher-output', '--engine.CompileImmediately', '--engine.BackgroundCompilation=false'] + + mx.log("Run SL Native Optimized Test No Truffle Enterprise") + _run_sl_tests(run_no_enterprise_native_optimized) + mx.log("Run SL Native Optimized Immediately Test No Truffle Enterprise") + _run_sl_tests(run_no_enterprise_native_optimized_immediately) + + shutil.rmtree(target_dir) + +# invoked by vm gate runner in ce-unchained configuration +def sl_native_fallback_gate_tests(): + target_dir = tempfile.mkdtemp() + image = _native_image_sl([], target_dir, use_optimized_runtime=False) + + def run_native_fallback(test_file): + return [image] + [test_file, '--disable-launcher-output', '--engine.WarnInterpreterOnly=false'] + + mx.log("Run SL Native Fallback Test") + _run_sl_tests(run_native_fallback) + + mx.rmtree(target_dir) + +def _run_sl_tests(create_command): + sl_test = mx.project("com.oracle.truffle.sl.test") + test_path = join(_suite.dir, sl_test.subDir, sl_test.name, "src", "tests") + for f in os.listdir(test_path): + if f.endswith('.sl'): + base_name = os.path.splitext(f)[0] + test_file = join(test_path, base_name + '.sl') + expected_file = join(test_path, base_name + '.output') + temp = tempfile.NamedTemporaryFile(delete=False) + command = create_command(test_file) + mx.log("Running SL test {}".format(test_file)) + with open(temp.name, 'w') as out: + mx.run(command, nonZeroIsFatal=False, out=out, err=out) + out.flush() + diff = compare_files(expected_file, temp.name) + if diff: + mx.log("Failed command: {}".format(" ".join(command))) + mx.abort("Output does not match expected output: {}".format(''.join(diff))) + + # delete file only on success + os.unlink(temp.name) + +def compare_files(file1_path, file2_path): + with open(file1_path, 'r') as file1, open(file2_path, 'r') as file2: + content1 = file1.readlines() + content2 = file2.readlines() + diff = difflib.unified_diff(content1, content2, fromfile=file1_path, tofile=file2_path) + return list(diff) + # The Truffle DSL specialization state bit width computation is complicated and # rarely used as the default maximum bit width of 32 is rarely exceeded. Therefore # we rebuild the truffle tests with a number of max state bit width values to @@ -259,6 +394,7 @@ def _truffle_gate_state_bitwidth_tests(): mx.update_commands(_suite, { 'javadoc' : [javadoc, '[SL args|@VM options]'], 'sl' : [sl, '[SL args|@VM options]'], + 'slnative' : [slnative, '[SL args|@VM options]'], }) def _is_graalvm(jdk): @@ -1135,26 +1271,24 @@ def glob_match(path, pattern): return True return False -mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmJreComponent( +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmTruffleLibrary( suite=_suite, name='Truffle API', short_name='tfla', dir_name='truffle', license_files=[], third_party_license_files=[], - dependencies=['Graal SDK'], + dependencies=['Graal SDK', 'Truffle Compiler'], jar_distributions=[], jvmci_parent_jars=[ + 'sdk:JNIUTILS', 'truffle:TRUFFLE_API', - 'truffle:TRUFFLE_COMPILER', 'truffle:TRUFFLE_RUNTIME', ], - support_libraries_distributions=['truffle:TRUFFLE_RUNTIME_ATTACH_SUPPORT'], stability="supported", )) - -mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmJreComponent( +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmTruffleLibrary( suite=_suite, name='Truffle', short_name='tfl', @@ -1163,7 +1297,7 @@ def glob_match(path, pattern): third_party_license_files=[], dependencies=[ 'Truffle API', - 'GraalVM Launcher Common' + 'GraalVM Launcher Common', ], jar_distributions=[], jvmci_parent_jars=[ @@ -1172,28 +1306,23 @@ def glob_match(path, pattern): stability="supported", )) -# This component is useful only if `SubstrateVM` is included. However, we do -# not declare a dependency because: -# - it should be possible to build a GraalVM that includes this macro and not -# `SubstrateVM`, which can be installed via `gu` -# - we prefer to define this component here rather than in the `substratevm` -# suite -# - The `SubstrateVM` component explicitly depends on this macro, to make sure -# that it is always present whenever `SubstrateVM` is included -mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVMSvmMacro( +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmTruffleLibrary( suite=_suite, - name='Truffle Macro', - short_name='tflm', + name='Truffle Compiler', + short_name='tflc', dir_name='truffle', license_files=[], third_party_license_files=[], dependencies=[], - support_distributions=['truffle:TRUFFLE_GRAALVM_SUPPORT'], + jar_distributions=[], + jvmci_parent_jars=[ + 'truffle:TRUFFLE_COMPILER', + ], stability="supported", )) # Typically not included in releases -mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmJreComponent( +mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmTruffleLibrary( suite=_suite, name='Truffle DSL Processor', short_name='tflp', diff --git a/truffle/mx.truffle/suite.py b/truffle/mx.truffle/suite.py index 415ea5565a04..80cb0a349967 100644 --- a/truffle/mx.truffle/suite.py +++ b/truffle/mx.truffle/suite.py @@ -1213,7 +1213,7 @@ ], "exports" : [ # Qualified exports - "com.oracle.truffle.compiler to org.graalvm.truffle.runtime, jdk.internal.vm.compiler, com.oracle.truffle.enterprise, com.oracle.graal.graal_enterprise, org.graalvm.nativeimage.builder", + "com.oracle.truffle.compiler to org.graalvm.truffle.runtime, jdk.internal.vm.compiler, org.graalvm.nativeimage.builder, com.oracle.truffle.enterprise, com.oracle.graal.graal_enterprise, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm", "com.oracle.truffle.compiler.hotspot to org.graalvm.truffle.runtime, jdk.internal.vm.compiler", "com.oracle.truffle.compiler.hotspot.libgraal to org.graalvm.truffle.runtime, jdk.internal.vm.compiler" ], @@ -1249,7 +1249,9 @@ ], "exports" : [ # Qualified exports - "* to org.graalvm.truffle, jdk.internal.vm.compiler, com.oracle.truffle.enterprise, com.oracle.svm.svm_enterprise, org.graalvm.nativeimage.builder", + "* to org.graalvm.truffle, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm", + # necessary to instantiate access truffle compiler from the runtime during host compilation + "com.oracle.truffle.runtime.hotspot to jdk.internal.vm.compiler", ], "uses" : [ "com.oracle.truffle.api.impl.TruffleLocator", @@ -1283,6 +1285,7 @@ "TRUFFLE_COMPILER", ], "description" : "Truffle runtime distribution.", + "useModulePath": True, "maven": True, }, @@ -1321,8 +1324,8 @@ "com.oracle.truffle.api.library.provider", # Qualified exports - "com.oracle.truffle.api.impl to jdk.internal.vm.compiler, org.graalvm.locator, org.graalvm.truffle.runtime, org.graalvm.nativeimage.builder", - "com.oracle.truffle.object to jdk.internal.vm.compiler, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime, org.graalvm.nativeimage.builder", + "com.oracle.truffle.api.impl to org.graalvm.locator, org.graalvm.truffle.runtime, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm", + "com.oracle.truffle.object to com.oracle.truffle.enterprise, org.graalvm.truffle.runtime, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm", ], "opens" : [ "com.oracle.truffle.polyglot to org.graalvm.truffle.runtime", @@ -1341,19 +1344,19 @@ "com.oracle.truffle.api.instrumentation.TruffleInstrument.Provider", # Deprecated ], }, + "moduleInfo:closed" : { # This is the module descriptor for the Truffle API modular jar deployed via maven. - # It exports all the Truffle API packages. + # It exports all the Truffle API packages to the language that get loaded through Truffle at runtime. "exports" : [ # Unqualified exports "com.oracle.truffle.api.provider", "com.oracle.truffle.api.instrumentation.provider", "com.oracle.truffle.api.library.provider", # Qualified exports - "com.oracle.truffle.api* to jdk.internal.vm.compiler, jdk.internal.vm.compiler.truffle.jfr, com.oracle.truffle.enterprise, com.oracle.svm.svm_enterprise, org.graalvm.nativeimage.builder, org.graalvm.truffle.runtime", - "com.oracle.truffle.api.impl to jdk.internal.vm.compiler,org.graalvm.locator, org.graalvm.truffle.runtime, org.graalvm.nativeimage.builder", - "com.oracle.truffle.api to org.graalvm.locator, org.graalvm.nativeimage.builder, org.graalvm.truffle.runtime, org.graalvm.nativeimage.builder", - "com.oracle.truffle.object to jdk.internal.vm.compiler, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime, org.graalvm.nativeimage.builder", + "com.oracle.truffle.api* to org.graalvm.locator, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm", + "com.oracle.truffle.api.impl to org.graalvm.locator, org.graalvm.truffle.runtime, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime.svm,com.oracle.truffle.enterprise.svm", + "com.oracle.truffle.object to org.graalvm.truffle.runtime, com.oracle.truffle.enterprise, org.graalvm.truffle.runtime.svm, com.oracle.truffle.enterprise.svm", ], }, "subDir" : "src", @@ -1377,10 +1380,16 @@ "description" : "Truffle is a multi-language framework for executing dynamic languages\nthat achieves high performance when combined with Graal.", "javadocType": "api", "maven": True, - "graalvm" : { - # Deploy the modular jar specified by "moduleInfo.closed" - "moduleInfo" : "closed", - } + "useModulePath": True, + # We do no longer deploy a closed module to graalvm because there are known bugs + # when a JDK boot module exports itself at runtime to a language at runtime. + # with Truffle unchained we want to use truffle always from the module path + # and deployement of Truffle the JDK is only there fore legacy support. + # See GR-47669 + #"graalvm" : { + # Deploy the modular jar specified by "moduleInfo.closed" + #"moduleInfo" : "closed", + #} }, "TRUFFLE_RUNTIME_ATTACH_RESOURCES" : { @@ -1403,16 +1412,6 @@ "maven": False, }, - "TRUFFLE_RUNTIME_ATTACH_SUPPORT" : { - "native" : True, - "platformDependent" : True, - "layout" : { - "./" : ["dependency:com.oracle.truffle.runtime.attach"], - }, - "description" : "Contains a library to provide access for the Truffle runtime to JVMCI.", - "maven" : False, - }, - "TRUFFLE_NFI" : { # This distribution defines a module. "moduleInfo" : { @@ -1441,6 +1440,9 @@ # This distribution defines a module. "moduleInfo" : { "name" : "com.oracle.truffle.truffle_nfi_libffi", + "opens" : [ + "com.oracle.truffle.nfi.backend.libffi to org.graalvm.truffle.runtime.svm", + ], }, "subDir" : "src", "javaCompliance" : "17+", @@ -1604,6 +1606,7 @@ "distDependencies" : [ "TRUFFLE_API", ], + "useModulePath": True, "description" : "Truffle SL is an example language implemented using the Truffle API.", "allowsJavadocWarnings": True, }, @@ -1738,15 +1741,6 @@ "maven" : False, }, - "TRUFFLE_GRAALVM_SUPPORT" : { - "native" : True, - "description" : "Truffle support distribution for SVM", - "layout" : { - "native-image.properties" : "file:mx.truffle/macro-truffle.properties", - }, - "maven" : False, - }, - "TRUFFLE_NFI_GRAALVM_SUPPORT" : { "native" : True, "description" : "Truffle NFI support distribution for the GraalVM", diff --git a/truffle/src/com.oracle.truffle.api.test/src/META-INF/native-image/native-image.properties b/truffle/src/com.oracle.truffle.api.test/src/META-INF/native-image/native-image.properties index 11a0b2db9a32..f7e985ad096d 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/META-INF/native-image/native-image.properties +++ b/truffle/src/com.oracle.truffle.api.test/src/META-INF/native-image/native-image.properties @@ -3,4 +3,6 @@ Args = -H:Features=com.oracle.truffle.api.test.polyglot.RegisterTestClassesForRe -H:DynamicProxyConfigurationResources=com/oracle/truffle/api/test/polyglot/proxys.json \ -H:SerializationConfigurationResources=com/oracle/truffle/api/test/polyglot/serialization.json \ --initialize-at-build-time=com.google.common.jimfs.SystemJimfsFileSystemProvider,com.google.common.collect.MapMakerInternalMap,com.google.common.collect.MapMakerInternalMap$StrongKeyWeakValueSegment,com.google.common.collect.MapMakerInternalMap$EntrySet,com.google.common.collect.MapMakerInternalMap$1,com.google.common.collect.MapMakerInternalMap$StrongKeyWeakValueEntry$Helper,com.google.common.base.Equivalence$Equals \ - -Dpolyglot.image-build-time.PreinitializeContexts=ContextPreintializationNativeImageLanguage + -Dpolyglot.image-build-time.PreinitializeContexts=ContextPreintializationNativeImageLanguage \ + --add-exports java.base/jdk.internal.module=ALL-UNNAMED \ + --add-opens java.base/jdk.internal.module=ALL-UNNAMED diff --git a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/SubprocessTestUtils.java b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/SubprocessTestUtils.java index 589ae1e801e1..f74432d89fcf 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/SubprocessTestUtils.java +++ b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/SubprocessTestUtils.java @@ -547,7 +547,7 @@ private static Subprocess process(List command, Map env, } private static boolean hasArg(String optionName) { - if (optionName.equals("-cp") || optionName.equals("-classpath")) { + if (optionName.equals("-cp") || optionName.equals("-classpath") || optionName.equals("-p")) { return true; } if (optionName.equals("--version") || diff --git a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextAPITest.java b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextAPITest.java index 323d81f15cb0..e6cbefebf891 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextAPITest.java +++ b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextAPITest.java @@ -1181,6 +1181,9 @@ private void executeSlowPath() { @Test public void testGetCurrentContextNotEnteredRaceCondition() throws ExecutionException, InterruptedException { + // TODO GR-47643 too slow with isolates + TruffleTestAssumptions.assumeWeakEncapsulation(); + for (int i = 0; i < 10000; i++) { AtomicBoolean checkCompleted = new AtomicBoolean(); ExecutorService executorService = Executors.newFixedThreadPool(1); diff --git a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPolicyTest.java b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPolicyTest.java index 7ebe37ce27d8..9a7d7d9abda7 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPolicyTest.java +++ b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPolicyTest.java @@ -777,6 +777,8 @@ private static void assertEmpty() { public void testReferencesWithCodeMixing() { // compile immediately is too much for this test. Assume.assumeFalse(CompileImmediatelyCheck.isCompileImmediately()); + // TODO GR-47643 too slow with isolates + TruffleTestAssumptions.assumeWeakEncapsulation(); testReferenceMixing(EXCLUSIVE0, EXCLUSIVE1); testReferenceMixing(EXCLUSIVE0, SHARED1); diff --git a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/PolyglotThreadNotificationsTest.java b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/PolyglotThreadNotificationsTest.java index 99a634269b67..7d8b400f9296 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/PolyglotThreadNotificationsTest.java +++ b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/PolyglotThreadNotificationsTest.java @@ -950,6 +950,9 @@ protected boolean isThreadAccessAllowed(Thread thread, boolean singleThreaded) { @Test public void testLanguageInitializationDeadlock() { + // TODO GR-47643 too slow with isolates + TruffleTestAssumptions.assumeWeakEncapsulation(); + for (int i = 0; i < 1000; i++) { try (Context ctx = Context.newBuilder().allowCreateThread(true).build()) { ctx.eval(DeadlockLanguageInitializationTestLanguage.ID, ""); diff --git a/truffle/src/com.oracle.truffle.api/src/META-INF/native-image/org.graalvm.truffle/native-image.properties b/truffle/src/com.oracle.truffle.api/src/META-INF/native-image/org.graalvm.truffle/native-image.properties new file mode 100644 index 000000000000..c9ad15cd8370 --- /dev/null +++ b/truffle/src/com.oracle.truffle.api/src/META-INF/native-image/org.graalvm.truffle/native-image.properties @@ -0,0 +1,13 @@ +# the macro loads svm libraries needed for Truffle +Args = --macro:truffle-svm \ + --features=com.oracle.svm.truffle.TruffleBaseFeature \ + --initialize-at-build-time=com.oracle.truffle \ + --initialize-at-build-time=org.graalvm.shadowed.org.jcodings \ + --initialize-at-build-time=org.graalvm.jniutils \ + --initialize-at-build-time=org.graalvm.nativebridge \ + --initialize-at-build-time=com.oracle.truffle.tools.utils.json \ + --initialize-at-build-time=org.graalvm.shadowed.org.jline,org.graalvm.shadowed.org.fusesource.jansi \ + --initialize-at-run-time=sun.rmi \ + --initialize-at-run-time=java.rmi + +JavaArgs = -Dgraalvm.ForcePolyglotInvalid=false diff --git a/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/InternalResource.java b/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/InternalResource.java index 25e9d5678f70..e76465b5fd2f 100644 --- a/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/InternalResource.java +++ b/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/InternalResource.java @@ -163,6 +163,7 @@ public boolean inContextPreinitialization() { * * @since 23.1 */ + @SuppressWarnings("static-method") public boolean inNativeImageBuild() { return TruffleOptions.AOT; } @@ -173,6 +174,7 @@ public boolean inNativeImageBuild() { * * @since 23.1 */ + @SuppressWarnings("static-method") public CPUArchitecture getCPUArchitecture() { return CPUArchitecture.getCurrent(); } @@ -183,6 +185,7 @@ public CPUArchitecture getCPUArchitecture() { * * @since 23.1 */ + @SuppressWarnings("static-method") public OS getOS() { return OS.getCurrent(); } diff --git a/truffle/src/com.oracle.truffle.nfi.backend.libffi/src/META-INF/native-image/com.oracle.truffle.truffle_nfi_libffi/native-image.properties b/truffle/src/com.oracle.truffle.nfi.backend.libffi/src/META-INF/native-image/com.oracle.truffle.truffle_nfi_libffi/native-image.properties new file mode 100644 index 000000000000..4718a0cae742 --- /dev/null +++ b/truffle/src/com.oracle.truffle.nfi.backend.libffi/src/META-INF/native-image/com.oracle.truffle.truffle_nfi_libffi/native-image.properties @@ -0,0 +1,4 @@ +Args = --features=com.oracle.svm.truffle.nfi.TruffleNFIFeature \ + --features=com.oracle.svm.truffle.nfi.posix.PosixTruffleNFIFeature \ + --features=com.oracle.svm.truffle.nfi.windows.WindowsTruffleNFIFeature \ + -H:MaxRuntimeCompileMethods=600 diff --git a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ModuleUtils.java b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ModuleUtils.java index b5b2e93ec806..decb11b11a96 100644 --- a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ModuleUtils.java +++ b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ModuleUtils.java @@ -51,7 +51,6 @@ import java.util.Set; import com.oracle.truffle.api.Truffle; -import com.oracle.truffle.api.TruffleLanguage; final class ModuleUtils { @@ -69,6 +68,7 @@ static void exportTransitivelyTo(Module clientModule) { if (isExportedTo(clientModule)) { return; } + ModuleLayer layer = clientModule.getLayer(); Module truffleModule = Truffle.class.getModule(); Set targetModules = new HashSet<>(); @@ -152,7 +152,12 @@ private static Module findModule(ModuleLayer layer, ModuleDescriptor.Requires re private static boolean isExportedTo(Module clientModule) { Module truffleModule = Truffle.class.getModule(); - return truffleModule.isExported(TruffleLanguage.class.getPackageName(), clientModule); + for (String pack : truffleModule.getPackages()) { + if (!truffleModule.isExported(pack, clientModule)) { + return false; + } + } + return true; } private static void exportFromTo(Module clientModule) { diff --git a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotEngineImpl.java b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotEngineImpl.java index 17e46662805c..56d468f44107 100644 --- a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotEngineImpl.java +++ b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotEngineImpl.java @@ -1254,6 +1254,7 @@ void ensureClosed(boolean force, boolean initiatedByContext) { contexts.clear(); if (RUNTIME.onEngineClosing(this.runtimeData)) { + getAPIAccess().engineClosed(api); return; } closingThread = currentThread; diff --git a/truffle/src/com.oracle.truffle.runtime/src/META-INF/native-image/org.graalvm.truffle.runtime/native-image.properties b/truffle/src/com.oracle.truffle.runtime/src/META-INF/native-image/org.graalvm.truffle.runtime/native-image.properties new file mode 100644 index 000000000000..e18fbaabe7a5 --- /dev/null +++ b/truffle/src/com.oracle.truffle.runtime/src/META-INF/native-image/org.graalvm.truffle.runtime/native-image.properties @@ -0,0 +1,7 @@ +Args = --macro:truffle-svm \ + --features=com.oracle.svm.truffle.TruffleFeature \ + --features=com.oracle.svm.truffle.TruffleJFRFeature \ + -H:MaxRuntimeCompileMethods=2500 \ + +JavaArgs = -Dtruffle.TruffleRuntime=com.oracle.svm.truffle.api.SubstrateTruffleRuntime \ + -Dgraalvm.ForcePolyglotInvalid=false \ diff --git a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/ModulesSupport.java b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/ModulesSupport.java index 014e6b6e1e28..cd2e75b75ee2 100644 --- a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/ModulesSupport.java +++ b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/ModulesSupport.java @@ -69,11 +69,8 @@ public final class ModulesSupport { private ModulesSupport() { } - /** - * This is invoked reflectively from {@link Truffle}. - */ - public static String exportJVMCI(Class toClass) { - ModuleLayer layer = toClass.getModule().getLayer(); + public static String exportJVMCI(Module module) { + ModuleLayer layer = module.getLayer(); if (layer == null) { /* * Truffle is running in an unnamed module, so we cannot export jvmci to it. @@ -98,10 +95,17 @@ public static String exportJVMCI(Class toClass) { return "The Truffle attach library is not available."; } - addExportsRecursive(jvmciModule, toClass.getModule()); + addExportsRecursive(jvmciModule, module); return null; } + /** + * This is invoked reflectively from {@link Truffle}. + */ + public static String exportJVMCI(Class toClass) { + return exportJVMCI(toClass.getModule()); + } + private static void addExportsRecursive(Module jvmciModule, Module runtimeModule) { for (String pn : jvmciModule.getPackages()) { ModulesSupport.addExports(jvmciModule, pn, runtimeModule); diff --git a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedTruffleRuntime.java b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedTruffleRuntime.java index 58ed800d7430..3853a37061d6 100644 --- a/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedTruffleRuntime.java +++ b/truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedTruffleRuntime.java @@ -174,7 +174,7 @@ public abstract class OptimizedTruffleRuntime implements TruffleRuntime, Truffle */ protected void clearState() { assert TruffleOptions.AOT : "Must be called only in AOT mode."; - knownMethods = null; + this.knownMethods = null; } private final OptimizedTruffleRuntimeListenerDispatcher listeners = new OptimizedTruffleRuntimeListenerDispatcher(); @@ -195,27 +195,39 @@ public static OptimizedTruffleRuntime getRuntime() { } private final LoopNodeFactory loopNodeFactory; - private final EngineCacheSupport engineCacheSupport; + private EngineCacheSupport engineCacheSupport; private final UnmodifiableEconomicMap> lookupTypes; private final FloodControlHandler floodControlHandler; - private final OptionDescriptors[] runtimeOptionDescriptors; + private final List runtimeOptionDescriptors; private volatile OptionDescriptors engineOptions; protected final TruffleCompilationSupport compilationSupport; + @SuppressWarnings("this-escape") public OptimizedTruffleRuntime(TruffleCompilationSupport compilationSupport, Iterable> extraLookupTypes) { this.compilationSupport = compilationSupport; this.lookupTypes = initLookupTypes(extraLookupTypes); List options = new ArrayList<>(); this.loopNodeFactory = loadGraalRuntimeServiceProvider(LoopNodeFactory.class, options, true); - EngineCacheSupport support = loadGraalRuntimeServiceProvider(EngineCacheSupport.class, options, false); + EngineCacheSupport support = loadEngineCacheSupport(options); this.engineCacheSupport = support == null ? new EngineCacheSupport.Disabled() : support; options.add(OptimizedRuntimeOptions.getDescriptors()); options.add(new CompilerOptionsDescriptors()); - this.runtimeOptionDescriptors = options.toArray(new OptionDescriptors[options.size()]); + this.runtimeOptionDescriptors = options; this.floodControlHandler = loadGraalRuntimeServiceProvider(FloodControlHandler.class, null, false); } + public final void initializeEngineCacheSupport(EngineCacheSupport support) { + if (this.engineCacheSupport instanceof EngineCacheSupport.Disabled) { + this.engineCacheSupport = support; + this.runtimeOptionDescriptors.add(support.getEngineOptions()); + } + } + + protected EngineCacheSupport loadEngineCacheSupport(List options) { + return loadGraalRuntimeServiceProvider(EngineCacheSupport.class, options, false); + } + public boolean isLatestJVMCI() { return true; } @@ -1163,7 +1175,7 @@ final OptionDescriptors getOptionDescriptors() { // still returns null. OptionDescriptors res = engineOptions; if (res == null) { - res = OptimizedRuntimeAccessor.LANGUAGE.createOptionDescriptorsUnion(runtimeOptionDescriptors); + res = OptimizedRuntimeAccessor.LANGUAGE.createOptionDescriptorsUnion(runtimeOptionDescriptors.toArray(new OptionDescriptors[runtimeOptionDescriptors.size()])); engineOptions = res; } return res; diff --git a/truffle/src/com.oracle.truffle.sl.launcher/src/com/oracle/truffle/sl/launcher/SLMain.java b/truffle/src/com.oracle.truffle.sl.launcher/src/com/oracle/truffle/sl/launcher/SLMain.java index e15fb6b23907..ead324cc5043 100644 --- a/truffle/src/com.oracle.truffle.sl.launcher/src/com/oracle/truffle/sl/launcher/SLMain.java +++ b/truffle/src/com.oracle.truffle.sl.launcher/src/com/oracle/truffle/sl/launcher/SLMain.java @@ -64,8 +64,11 @@ public static void main(String[] args) throws IOException { Source source; Map options = new HashMap<>(); String file = null; + boolean launcherOutput = true; for (String arg : args) { - if (parseOption(options, arg)) { + if (arg.equals("--disable-launcher-output")) { + launcherOutput = false; + } else if (parseOption(options, arg)) { continue; } else { if (file == null) { @@ -76,25 +79,28 @@ public static void main(String[] args) throws IOException { if (file == null) { // @formatter:off - source = Source.newBuilder(SL, new InputStreamReader(System.in), "").build(); + source = Source.newBuilder(SL, new InputStreamReader(System.in), "").interactive(!launcherOutput).build(); // @formatter:on } else { - source = Source.newBuilder(SL, new File(file)).build(); + source = Source.newBuilder(SL, new File(file)).interactive(!launcherOutput).build(); } - System.exit(executeSource(source, System.in, System.out, options)); + System.exit(executeSource(source, System.in, System.out, options, launcherOutput)); } - private static int executeSource(Source source, InputStream in, PrintStream out, Map options) { + private static int executeSource(Source source, InputStream in, PrintStream out, Map options, boolean launcherOutput) { Context context; PrintStream err = System.err; try { - context = Context.newBuilder(SL).in(in).out(out).options(options).build(); + context = Context.newBuilder(SL).in(in).out(out).options(options).allowAllAccess(true).build(); } catch (IllegalArgumentException e) { err.println(e.getMessage()); return 1; } - out.println("== running on " + context.getEngine()); + + if (launcherOutput) { + out.println("== running on " + context.getEngine()); + } try { Value result = context.eval(source); @@ -102,7 +108,7 @@ private static int executeSource(Source source, InputStream in, PrintStream out, err.println("No function main() defined in SL source file."); return 1; } - if (!result.isNull()) { + if (launcherOutput && !result.isNull()) { out.println(result.toString()); } return 0; diff --git a/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.output b/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.output index e4da80a5a7db..758cdb7e28ba 100644 --- a/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.output +++ b/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.output @@ -1,3 +1,2 @@ Object 42 -The Context is already closed. diff --git a/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.sl b/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.sl index 53af974a28c3..d0d70390a816 100644 --- a/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.sl +++ b/truffle/src/com.oracle.truffle.sl.test/src/tests/CreateContext.sl @@ -4,15 +4,18 @@ */ function main() { - context = java("org.graalvm.polyglot.Context").create(); - context.eval("sl", "function createObject() { return new(); }"); - context.eval("sl", "function getPrimitive() { return 42; }"); - innerBindings = context.getBindings("sl"); - println(innerBindings.createObject()); - println(innerBindings.getPrimitive()); - context.close(); - - // this is expected fail as - innerBindings.getPrimitive(); + if (inNativeImage()) { + /* no support for host reflection in native-image */ + println("Object"); + println("42"); + } else { + context = java("org.graalvm.polyglot.Context").newBuilder().option("engine.WarnInterpreterOnly", "false").build(); + context.eval("sl", "function createObject() { return new(); }"); + context.eval("sl", "function getPrimitive() { return 42; }"); + innerBindings = context.getBindings("sl"); + println(innerBindings.createObject()); + println(innerBindings.getPrimitive()); + context.close(); + } } \ No newline at end of file diff --git a/truffle/src/com.oracle.truffle.sl.test/src/tests/HelloEqualsWorld.output b/truffle/src/com.oracle.truffle.sl.test/src/tests/HelloEqualsWorld.output index 0c4cc54bf42c..640e53d1ee2b 100644 --- a/truffle/src/com.oracle.truffle.sl.test/src/tests/HelloEqualsWorld.output +++ b/truffle/src/com.oracle.truffle.sl.test/src/tests/HelloEqualsWorld.output @@ -87,4 +87,4 @@ Frame: root doIt, a=9, hello=123 Frame: root main, i=9 After hello assignment: Frame: root doIt, a=9, hello=world -Frame: root main, i=9 \ No newline at end of file +Frame: root main, i=9 diff --git a/truffle/src/com.oracle.truffle.sl.test/src/tests/Inlining.output b/truffle/src/com.oracle.truffle.sl.test/src/tests/Inlining.output index b6fe452fbd8c..268a6ab5377f 100644 --- a/truffle/src/com.oracle.truffle.sl.test/src/tests/Inlining.output +++ b/truffle/src/com.oracle.truffle.sl.test/src/tests/Inlining.output @@ -1 +1 @@ -1260000 \ No newline at end of file +1260000 diff --git a/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLInNativeImageBuiltin.java b/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLInNativeImageBuiltin.java new file mode 100644 index 000000000000..081b8020c80b --- /dev/null +++ b/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLInNativeImageBuiltin.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.oracle.truffle.sl.builtins; + +import com.oracle.truffle.api.TruffleOptions; +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.nodes.NodeInfo; + +/** + * Built-in function that returns true if in a native-image builtin. + */ +@NodeInfo(shortName = "inNativeImage") +public abstract class SLInNativeImageBuiltin extends SLBuiltinNode { + + @Specialization + public boolean isExecutable() { + return TruffleOptions.AOT; + } +} diff --git a/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java b/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java index 6d512350cbac..abd9ee22ad72 100644 --- a/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java +++ b/truffle/src/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java @@ -77,6 +77,7 @@ import com.oracle.truffle.sl.builtins.SLHasSizeBuiltinFactory; import com.oracle.truffle.sl.builtins.SLHelloEqualsWorldBuiltinFactory; import com.oracle.truffle.sl.builtins.SLImportBuiltinFactory; +import com.oracle.truffle.sl.builtins.SLInNativeImageBuiltinFactory; import com.oracle.truffle.sl.builtins.SLIsExecutableBuiltinFactory; import com.oracle.truffle.sl.builtins.SLIsInstanceBuiltinFactory; import com.oracle.truffle.sl.builtins.SLIsNullBuiltinFactory; @@ -189,6 +190,7 @@ private void installBuiltins() { installBuiltin(SLExitBuiltinFactory.getInstance()); installBuiltin(SLRegisterShutdownHookBuiltinFactory.getInstance()); installBuiltin(SLAddToHostClassPathBuiltinFactory.getInstance()); + installBuiltin(SLInNativeImageBuiltinFactory.getInstance()); } public void installBuiltin(NodeFactory factory) { diff --git a/vm/ci/ci_includes/vm-native.jsonnet b/vm/ci/ci_includes/vm-native.jsonnet index 261298512dbf..63a2d7309c93 100644 --- a/vm/ci/ci_includes/vm-native.jsonnet +++ b/vm/ci/ci_includes/vm-native.jsonnet @@ -35,6 +35,14 @@ local vm_common = import '../ci_common/common.jsonnet'; timelimit: '35:00', name: 'gate-vm-svm-truffle-tck-linux-amd64', }, + vm.vm_java_21 + vm_common.svm_common_linux_amd64 + vm_common.gate_vm_linux_amd64 + { + run+: [ + ['export', 'SVM_SUITE=' + vm.svm_suite], + ['mx', '--env', 'ce-unchained', '--native-images=lib:jvmcicompiler', 'gate', '--no-warning-as-error', '--tags', 'build,truffle-unchained'], + ], + timelimit: '30:00', + name: 'gate-vm-ce-truffle-unchained-linux-amd64', + }, ], builds: [{'defined_in': std.thisFile} + b for b in builds], diff --git a/vm/mx.vm/ce b/vm/mx.vm/ce index 628c8bc8079c..78709c150b2c 100644 --- a/vm/mx.vm/ce +++ b/vm/mx.vm/ce @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-aarch64 b/vm/mx.vm/ce-aarch64 index 628c8bc8079c..78709c150b2c 100644 --- a/vm/mx.vm/ce-aarch64 +++ b/vm/mx.vm/ce-aarch64 @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-aarch64-complete b/vm/mx.vm/ce-aarch64-complete index 39545c58e310..47706a36a921 100644 --- a/vm/mx.vm/ce-aarch64-complete +++ b/vm/mx.vm/ce-aarch64-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svml,svmnfi,svmsl,tfl,tfla,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,wasm DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-complete b/vm/mx.vm/ce-complete index eef54aea2908..481ab1f7da59 100644 --- a/vm/mx.vm/ce-complete +++ b/vm/mx.vm/ce-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,fastr,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,ellvm,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svml,svmnfi,svmsl,tfl,tfla,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,ellvm,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,wasm DISABLE_INSTALLABLES=false diff --git a/vm/mx.vm/ce-darwin b/vm/mx.vm/ce-darwin index 628c8bc8079c..78709c150b2c 100644 --- a/vm/mx.vm/ce-darwin +++ b/vm/mx.vm/ce-darwin @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-darwin-aarch64 b/vm/mx.vm/ce-darwin-aarch64 index e0bac90184e2..326caa621341 100644 --- a/vm/mx.vm/ce-darwin-aarch64 +++ b/vm/mx.vm/ce-darwin-aarch64 @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-darwin-aarch64-complete b/vm/mx.vm/ce-darwin-aarch64-complete index 51788272f675..c141cb707ea6 100644 --- a/vm/mx.vm/ce-darwin-aarch64-complete +++ b/vm/mx.vm/ce-darwin-aarch64-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,wasm DISABLE_INSTALLABLES=false diff --git a/vm/mx.vm/ce-darwin-complete b/vm/mx.vm/ce-darwin-complete index eef54aea2908..481ab1f7da59 100644 --- a/vm/mx.vm/ce-darwin-complete +++ b/vm/mx.vm/ce-darwin-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,fastr,graalpython,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,ellvm,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svml,svmnfi,svmsl,tfl,tfla,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,ellvm,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,wasm DISABLE_INSTALLABLES=false diff --git a/vm/mx.vm/ce-fastr b/vm/mx.vm/ce-fastr index 904577dbc2d0..17211f919ed3 100644 --- a/vm/mx.vm/ce-fastr +++ b/vm/mx.vm/ce-fastr @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/sulong,/tools,/truffle,fastr -COMPONENTS=antlr4,R,cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,poly,polynative,pro,sdk,sdkl,svmnfi,tfl,tfla,tflm,truffle-json +COMPONENTS=antlr4,R,cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,poly,polynative,pro,sdk,sdkl,svmt,svmnfi,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=lib:jvmcicompiler NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-js b/vm/mx.vm/ce-js index fef6e84b4619..b82d4baaa5a8 100644 --- a/vm/mx.vm/ce-js +++ b/vm/mx.vm/ce-js @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,js,jsl,jss,lg,lsp,nfi,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,js,jsl,jss,lg,lsp,nfi,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=lib:jsvm,lib:jvmcicompiler NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-llvm b/vm/mx.vm/ce-llvm index 3ba315ce8983..097813dbef66 100644 --- a/vm/mx.vm/ce-llvm +++ b/vm/mx.vm/ce-llvm @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/sulong,/tools,/truffle -COMPONENTS=antlr4,cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,llp,llrc,llrl,llrn,lsp,nfi,nfi-libffi,poly,polynative,pro,sdk,sdkl,tfl,tfla,tflm,truffle-json +COMPONENTS=antlr4,cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,llp,llrc,llrl,llrn,lsp,nfi,nfi-libffi,poly,polynative,pro,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:llvmvm DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-no_native b/vm/mx.vm/ce-no_native index 1f02a9ef9083..3993761651eb 100644 --- a/vm/mx.vm/ce-no_native +++ b/vm/mx.vm/ce-no_native @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lsp,nfi-libffi,poly,polynative,pro,sdk,sdkl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lsp,nfi-libffi,poly,polynative,pro,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=false DISABLE_INSTALLABLES=ni,nil diff --git a/vm/mx.vm/ce-nodejs b/vm/mx.vm/ce-nodejs index aba3075abcca..838b28d22581 100644 --- a/vm/mx.vm/ce-nodejs +++ b/vm/mx.vm/ce-nodejs @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/graal-nodejs,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,js,jsl,jss,lg,lsp,nfi-libffi,njs,njsl,ni,nic,nil,poly,polynative,pro,sdk,sdkl,sjvm,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,js,jsl,jss,lg,lsp,nfi-libffi,njs,njsl,ni,nic,nil,poly,polynative,pro,sdk,sdkl,sjvm,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-python b/vm/mx.vm/ce-python index 05fa3636193b..845c3960c152 100644 --- a/vm/mx.vm/ce-python +++ b/vm/mx.vm/ce-python @@ -1,5 +1,5 @@ # Do not modify this env file without updating the Graal.Python benchmark builders DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,graalpython -COMPONENTS=antlr4,cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,pbm,pmh,poly,polynative,pro,pyn,pynl,rgx,sdk,sdkl,tfl,tfla,tflm,truffle-json +COMPONENTS=antlr4,cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,pbm,pmh,poly,polynative,pro,pyn,pynl,rgx,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=lib:pythonvm,lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-ruby b/vm/mx.vm/ce-ruby index 646405a56517..e76849e8ea34 100644 --- a/vm/mx.vm/ce-ruby +++ b/vm/mx.vm/ce-ruby @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,truffleruby -COMPONENTS=antlr4,cmp,cov,dap,gvm,icu4j,ins,insight,insightheap,lg,llp,llrc,llrn,lsp,nfi-libffi,pro,rby,rbyl,rgx,sdk,sdkl,tfl,tfla,tflm,truffle-json +COMPONENTS=antlr4,cmp,cov,dap,gvm,icu4j,ins,insight,insightheap,lg,llp,llrc,llrn,lsp,nfi-libffi,pro,rby,rbyl,rgx,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json EXCLUDE_COMPONENTS=libpoly NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:rubyvm DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-test b/vm/mx.vm/ce-test index d5d5745dc180..6ea756afc9fb 100644 --- a/vm/mx.vm/ce-test +++ b/vm/mx.vm/ce-test @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,lg,llp,lsp,nfi-libffi,ni,nic,nil,nju,njucp,poly,polynative,pro,rgx,sdk,sdkl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,dis,gu,gvm,icu4j,ins,insight,insightheap,lg,llp,lsp,nfi-libffi,ni,nic,nil,nju,njucp,poly,polynative,pro,rgx,sdk,sdkl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image DISABLE_INSTALLABLES=llp diff --git a/vm/mx.vm/ce-unchained b/vm/mx.vm/ce-unchained new file mode 100644 index 000000000000..0ec0c82ef8a7 --- /dev/null +++ b/vm/mx.vm/ce-unchained @@ -0,0 +1,5 @@ +DYNAMIC_IMPORTS=/compiler,/sdk,/substratevm,/tools,/truffle +COMPONENTS=cmp,lg,ni,nic,nil,sdk,sdkl,svm,svmt,svmsl,tflc,tflsm +NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image +NON_REBUILDABLE_IMAGES=lib:jvmcicompiler +DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-win b/vm/mx.vm/ce-win index 398d35de917d..e0f633d744c0 100644 --- a/vm/mx.vm/ce-win +++ b/vm/mx.vm/ce-win @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/sdk,/substratevm,/tools,/truffle -COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json +COMPONENTS=cmp,cov,dap,gu,gvm,ins,insight,insightheap,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image NON_REBUILDABLE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/ce-win-complete b/vm/mx.vm/ce-win-complete index cac9a1fbd6b9..128c6f115d24 100644 --- a/vm/mx.vm/ce-win-complete +++ b/vm/mx.vm/ce-win-complete @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython -COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rgx,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm,truffle-json,vvm +COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,wasm DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/libgraal b/vm/mx.vm/libgraal index 59452f16c029..720dec5800fb 100644 --- a/vm/mx.vm/libgraal +++ b/vm/mx.vm/libgraal @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/substratevm -COMPONENTS=lg,tfla,cmp +COMPONENTS=lg,tfla,tflc,cmp NATIVE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=true diff --git a/vm/mx.vm/mx_vm.py b/vm/mx.vm/mx_vm.py index d6fe52f5f9a4..d86079e6470f 100644 --- a/vm/mx.vm/mx_vm.py +++ b/vm/mx.vm/mx_vm.py @@ -162,17 +162,17 @@ llvm_components = ['bgraalvm-native-binutil', 'bgraalvm-native-clang', 'bgraalvm-native-clang-cl', 'bgraalvm-native-clang++', 'bgraalvm-native-flang', 'bgraalvm-native-ld'] # pylint: disable=line-too-long -ce_components_minimal = ['bgu', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'lsp', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'pro', 'sdk', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflm', 'truffle-json'] -ce_components = ce_components_minimal + ['nr_lib_jvmcicompiler', 'bnative-image-configure', 'ni', 'nic', 'nil', 'svm', 'svmnfi', 'svmsl'] -ce_win_complete_components = ['antlr4', 'bgu', 'bnative-image-configure', 'bpolyglot', 'cmp', 'cov', 'dap', 'ejvm', 'gu', 'gvm', 'gwa', 'icu4j', 'ins', 'insight', 'insightheap', 'java', 'js', 'jsl', 'jss', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'njs', 'njsl', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkl', 'spolyglot', 'svm', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflm', 'truffle-json', 'vvm'] +ce_components_minimal = ['bgu', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'lsp', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'pro', 'sdk', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] +ce_components = ce_components_minimal + ['nr_lib_jvmcicompiler', 'bnative-image-configure', 'ni', 'nic', 'nil', 'svm', 'svmt', 'svmnfi', 'svmsl'] +ce_win_complete_components = ['antlr4', 'bgu', 'bnative-image-configure', 'bpolyglot', 'cmp', 'cov', 'dap', 'ejvm', 'gu', 'gvm', 'gwa', 'icu4j', 'ins', 'insight', 'insightheap', 'java', 'js', 'jsl', 'jss', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'njs', 'njsl', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkl', 'spolyglot', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json', 'vvm'] ce_aarch64_complete_components = ce_win_complete_components + ['rby', 'rbyl', 'svml'] ce_complete_components = ce_aarch64_complete_components + ['ellvm', 'R', 'bRMain'] ce_darwin_aarch64_complete_components = list(ce_aarch64_complete_components) ce_darwin_aarch64_complete_components.remove('svml') # GR-34811 / GR-40147 -ce_ruby_components = ['antlr4', 'cmp', 'cov', 'dap', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'llp', 'llrc', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pro', 'rby', 'rbyl', 'rgx', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflm', 'truffle-json'] -ce_python_components = llvm_components + ['antlr4', 'bgu', 'sllvmvm', 'bpolybench', 'bpolyglot', 'cmp', 'cov', 'dap', 'dis', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pbm', 'pmh', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflm', 'truffle-json'] +ce_ruby_components = ['antlr4', 'cmp', 'cov', 'dap', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'llp', 'llrc', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pro', 'rby', 'rbyl', 'rgx', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] +ce_python_components = llvm_components + ['antlr4', 'bgu', 'sllvmvm', 'bpolybench', 'bpolyglot', 'cmp', 'cov', 'dap', 'dis', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pbm', 'pmh', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] ce_fastr_components = ce_components + llvm_components + ['antlr4', 'sllvmvm', 'llp', 'bnative-image', 'snative-image-agent', 'R', 'bRMain', 'bnative-image-configure', 'llrc', 'snative-image-diagnostics-agent', 'llrn', 'llrl'] -ce_no_native_components = ['bgu', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lsp', 'nfi-libffi', 'nfi', 'polynative', 'pro', 'sdk', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflm', 'truffle-json', 'libpoly', 'poly'] +ce_no_native_components = ['bgu', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lsp', 'nfi-libffi', 'nfi', 'polynative', 'pro', 'sdk', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json', 'libpoly', 'poly'] mx_sdk_vm.register_vm_config('community', ce_components + llvm_components, _suite, env_file='ce-win') mx_sdk_vm.register_vm_config('community', ce_components, _suite, env_file='ce-aarch64') @@ -191,19 +191,20 @@ mx_sdk_vm.register_vm_config('ce-python', ce_python_components, _suite) mx_sdk_vm.register_vm_config('ce-fastr', ce_fastr_components, _suite) mx_sdk_vm.register_vm_config('ce-no_native', ce_no_native_components, _suite) -mx_sdk_vm.register_vm_config('libgraal', ['cmp', 'lg', 'sdk', 'tfla'], _suite) -mx_sdk_vm.register_vm_config('toolchain-only', ['antlr4', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflm', 'nfi-libffi', 'nfi', 'cmp', 'llp', 'llrc', 'llrn'], _suite) -mx_sdk_vm.register_vm_config('libgraal-bash', llvm_components + ['bgu', 'cmp', 'gu', 'gvm', 'lg', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflm', 'bpolyglot'], _suite, env_file=False) -mx_sdk_vm.register_vm_config('toolchain-only-bash', llvm_components + ['antlr4', 'bgu', 'tfl', 'tfla', 'tflm', 'gu', 'gvm', 'polynative', 'llp', 'nfi-libffi', 'nfi', 'svml', 'bgu', 'sdk', 'sdkl', 'llrc', 'llrn', 'cmp'], _suite, env_file=False) -mx_sdk_vm.register_vm_config('ce', llvm_components + ['antlr4', 'java', 'libpoly', 'sjavavm', 'spolyglot', 'ejvm', 'sjsvm', 'sllvmvm', 'bnative-image', 'srubyvm', 'pynl', 'spythonvm', 'pyn', 'bwasm', 'cmp', 'gwa', 'icu4j', 'js', 'jsl', 'jss', 'lg', 'llp', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pmh', 'pbi', 'rby', 'rbyl', 'rgx', 'sdk', 'sdkl', 'llrc', 'llrn', 'llrl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflm'], _suite, env_file='polybench-ce') -mx_sdk_vm.register_vm_config('ce', ['bnative-image', 'bpolybench', 'cmp', 'icu4j', 'lg', 'nfi', 'ni', 'nil', 'pbi', 'pbm', 'pmh', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflm'], _suite, dist_name='ce', env_file='polybench-ctw-ce') -mx_sdk_vm.register_vm_config('ce', ['pbm', 'pmh', 'pbi', 'ni', 'icu4j', 'js', 'jsl', 'jss', 'lg', 'nfi-libffi', 'nfi', 'tfl', 'tfla', 'svm', 'nil', 'rgx', 'sdk', 'sdkl', 'cmp', 'tflm', 'svmnfi', 'svmsl', 'bnative-image', 'sjsvm', 'snative-image-agent', 'snative-image-diagnostics-agent'], _suite, env_file='polybench-nfi-ce') -mx_sdk_vm.register_vm_config('ce', llvm_components + ['antlr4', 'sllvmvm', 'bnative-image', 'cmp', 'lg', 'llrc', 'llrl', 'llrn', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pbi', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflm'], _suite, env_file='polybench-sulong-ce') +mx_sdk_vm.register_vm_config('libgraal', ['cmp', 'lg', 'sdk', 'tfla', 'tflc'], _suite) +mx_sdk_vm.register_vm_config('toolchain-only', ['antlr4', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'nfi-libffi', 'nfi', 'cmp', 'llp', 'llrc', 'llrn'], _suite) +mx_sdk_vm.register_vm_config('libgraal-bash', llvm_components + ['bgu', 'cmp', 'gu', 'gvm', 'lg', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'sdk', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'bpolyglot'], _suite, env_file=False) +mx_sdk_vm.register_vm_config('toolchain-only-bash', llvm_components + ['antlr4', 'bgu', 'tfl', 'tfla', 'tflc', 'tflm', 'gu', 'gvm', 'polynative', 'llp', 'nfi-libffi', 'nfi', 'svml', 'bgu', 'sdk', 'sdkl', 'llrc', 'llrn', 'cmp'], _suite, env_file=False) +mx_sdk_vm.register_vm_config('ce', llvm_components + ['antlr4', 'java', 'libpoly', 'sjavavm', 'spolyglot', 'ejvm', 'sjsvm', 'sllvmvm', 'bnative-image', 'srubyvm', 'pynl', 'spythonvm', 'pyn', 'bwasm', 'cmp', 'gwa', 'icu4j', 'js', 'jsl', 'jss', 'lg', 'llp', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pmh', 'pbi', 'rby', 'rbyl', 'rgx', 'sdk', 'sdkl', 'llrc', 'llrn', 'llrl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file='polybench-ce') +mx_sdk_vm.register_vm_config('ce', ['bnative-image', 'bpolybench', 'cmp', 'icu4j', 'lg', 'nfi', 'ni', 'nil', 'pbi', 'pbm', 'pmh', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, dist_name='ce', env_file='polybench-ctw-ce') +mx_sdk_vm.register_vm_config('ce', ['pbm', 'pmh', 'pbi', 'ni', 'icu4j', 'js', 'jsl', 'jss', 'lg', 'nfi-libffi', 'nfi', 'tfl', 'tfla', 'tflc', 'svm', 'svmt', 'nil', 'rgx', 'sdk', 'sdkl', 'cmp', 'tflm', 'svmnfi', 'svmsl', 'bnative-image', 'sjsvm', 'snative-image-agent', 'snative-image-diagnostics-agent'], _suite, env_file='polybench-nfi-ce') +mx_sdk_vm.register_vm_config('ce', llvm_components + ['antlr4', 'sllvmvm', 'bnative-image', 'cmp', 'lg', 'llrc', 'llrl', 'llrn', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pbi', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file='polybench-sulong-ce') +mx_sdk_vm.register_vm_config('ce', ['nr_lib_jvmcicompiler', 'bnative-image-configure', 'svm', 'nic', 'tflc', 'ni', 'sdk', 'sdkl', 'nil', 'lg', 'svmsl', 'svmt', 'cmp', 'tflsm'], _suite, env_file='ce-unchained') if mx.get_os() == 'windows': - mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflm'], _suite, env_file=False) + mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False) else: - mx_sdk_vm.register_vm_config('svm', ['bgu', 'bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmnfi', 'svmsl', 'svml', 'tfl', 'tfla', 'tflm'], _suite, env_file=False) + mx_sdk_vm.register_vm_config('svm', ['bgu', 'bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svml', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False) # pylint: enable=line-too-long diff --git a/vm/mx.vm/mx_vm_gate.py b/vm/mx.vm/mx_vm_gate.py index 5978e79dcbb9..95cdef1f592c 100644 --- a/vm/mx.vm/mx_vm_gate.py +++ b/vm/mx.vm/mx_vm_gate.py @@ -71,7 +71,7 @@ class VmGateTasks: svm_sl_tck = 'svm_sl_tck' svm_truffle_tck_js = 'svm-truffle-tck-js' svm_truffle_tck_python = 'svm-truffle-tck-python' - + truffle_unchained = 'truffle-unchained' def _unittest_config_participant(config): vmArgs, mainClass, mainClassArgs = config @@ -500,6 +500,7 @@ def gate_body(args, tasks): gate_svm_sl_tck(tasks) gate_svm_truffle_tck_js(tasks) gate_svm_truffle_tck_python(tasks) + gate_truffle_unchained(tasks) def graalvm_svm(): """ @@ -537,6 +538,9 @@ def gate_substratevm(tasks, quickbuild=False): truffle_with_compilation = [ '--verbose', '--macro:truffle', + '--language:nfi', + '--add-exports=java.base/jdk.internal.module=ALL-UNNAMED', + '--add-exports=org.graalvm.sdk/org.graalvm.polyglot.impl=ALL-UNNAMED', '-H:MaxRuntimeCompileMethods=5000', '-R:MaxHeapSize=2g', '--enable-url-protocols=jar', @@ -545,12 +549,12 @@ def gate_substratevm(tasks, quickbuild=False): truffle_without_compilation = truffle_with_compilation + [ '-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime' ] - args = ['--force-builder-on-cp', '--build-args'] + truffle_with_compilation + extra_build_args + blacklist_args + ['--'] + tests + args = ['--build-args'] + truffle_with_compilation + extra_build_args + blacklist_args + ['--'] + tests native_image_context, svm = graalvm_svm() with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: svm._native_unittest(native_image, args) - args = ['--force-builder-on-cp', '--build-args'] + truffle_without_compilation + extra_build_args + blacklist_args + ['--run-args', '--verbose', '-Dpolyglot.engine.WarnInterpreterOnly=false'] + ['--'] + tests + args = ['--build-args'] + truffle_without_compilation + extra_build_args + blacklist_args + ['--run-args', '--verbose', '-Dpolyglot.engine.WarnInterpreterOnly=false'] + ['--'] + tests native_image_context, svm = graalvm_svm() with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: svm._native_unittest(native_image, args) @@ -687,6 +691,26 @@ def gate_svm_truffle_tck_python(tasks): with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: _svm_truffle_tck(native_image, svm.suite, py_suite, 'python') +def gate_truffle_unchained(tasks): + truffle_suite = mx.suite('truffle') + if truffle_suite: + import mx_truffle + + with Task('Truffle Unchained SL JVM', tasks, tags=[VmGateTasks.truffle_unchained]) as t: + if t: + if not truffle_suite: + mx.abort("Cannot resolve truffle suite.") + mx_truffle.sl_jvm_gate_tests() + with Task('Truffle Unchained SL Native Fallback', tasks, tags=[VmGateTasks.truffle_unchained]) as t: + if t: + if not truffle_suite: + mx.abort("Cannot resolve truffle suite.") + mx_truffle.sl_native_fallback_gate_tests() + with Task('Truffle Unchained SL Native Optimized', tasks, tags=[VmGateTasks.truffle_unchained]) as t: + if t: + if not truffle_suite: + mx.abort("Cannot resolve truffle suite.") + mx_truffle.sl_native_optimized_gate_tests() def build_tests_image(image_dir, options, unit_tests=None, additional_deps=None, shared_lib=False): native_image_context, svm = graalvm_svm() diff --git a/vm/mx.vm/polybench-ce b/vm/mx.vm/polybench-ce index b53e330357e5..bb924e0e5229 100644 --- a/vm/mx.vm/polybench-ce +++ b/vm/mx.vm/polybench-ce @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/regex,/sdk,/substratevm,/sulong,/truffle,/wasm,graalpython,truffleruby -COMPONENTS=antlr4,cmp,ejvm,gwa,icu4j,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,nfi-libffi,ni,nil,pbm,pmh,pbi,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm +COMPONENTS=antlr4,cmp,ejvm,gwa,icu4j,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,nfi-libffi,ni,nil,pbm,pmh,pbi,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm NATIVE_IMAGES=lib:jvmcicompiler,polybench DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/polybench-ctw-ce b/vm/mx.vm/polybench-ctw-ce index 6efd61e69697..96b2ee9a52ae 100644 --- a/vm/mx.vm/polybench-ctw-ce +++ b/vm/mx.vm/polybench-ctw-ce @@ -1,4 +1,4 @@ DYNAMIC_IMPORTS=/compiler,/sdk,/substratevm,/truffle -COMPONENTS=cmp,icu4j,lg,ni,nil,pbm,pmh,pbi,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm +COMPONENTS=cmp,icu4j,lg,ni,nil,pbm,pmh,pbi,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm NATIVE_IMAGES=lib:jvmcicompiler DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/polybench-nfi-ce b/vm/mx.vm/polybench-nfi-ce index d39794c6070f..5a4e946c7312 100644 --- a/vm/mx.vm/polybench-nfi-ce +++ b/vm/mx.vm/polybench-nfi-ce @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/truffle -COMPONENTS=cmp,icu4j,js,jsl,jss,lg,nfi-libffi,ni,nil,pbm,pmh,pbi,rgx,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm +COMPONENTS=cmp,icu4j,js,jsl,jss,lg,nfi-libffi,ni,nil,pbm,pmh,pbi,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm EXCLUDE_COMPONENTS=libpoly NATIVE_IMAGES=lib:jvmcicompiler,polybench DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/polybench-sulong-ce b/vm/mx.vm/polybench-sulong-ce index e21153319208..ee50429bc7d9 100644 --- a/vm/mx.vm/polybench-sulong-ce +++ b/vm/mx.vm/polybench-sulong-ce @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/sdk,/substratevm,/sulong,/truffle -COMPONENTS=antlr4,cmp,lg,llrc,llrl,llrn,nfi-libffi,ni,nil,pbm,pbi,sdk,sdkl,svm,svmnfi,svmsl,tfl,tfla,tflm +COMPONENTS=antlr4,cmp,lg,llrc,llrl,llrn,nfi-libffi,ni,nil,pbm,pbi,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm EXCLUDE_COMPONENTS=libpoly NATIVE_IMAGES=lib:jvmcicompiler,polybench DISABLE_INSTALLABLES=False diff --git a/vm/mx.vm/toolchain-only b/vm/mx.vm/toolchain-only index 7f169f220ae1..c063509af99d 100644 --- a/vm/mx.vm/toolchain-only +++ b/vm/mx.vm/toolchain-only @@ -1,5 +1,5 @@ DYNAMIC_IMPORTS=/compiler,/sdk,/substratevm,/sulong,/truffle -COMPONENTS=antlr4,cmp,llp,llrc,llrn,nfi-libffi,sdk,sdkl,tfl,tfla,tflm +COMPONENTS=antlr4,cmp,llp,llrc,llrn,nfi-libffi,sdk,sdkl,tfl,tfla,tflc,tflm EXCLUDE_COMPONENTS=libpoly NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld DISABLE_INSTALLABLES=False