Skip to content

Commit aefacfb

Browse files
committed
[GR-64087] Turn truffle-enterprise into an optional dependency.
PullRequest: graal/20992
2 parents d2236c0 + 4a0c5c5 commit aefacfb

File tree

8 files changed

+271
-70
lines changed

8 files changed

+271
-70
lines changed

espresso/mx.espresso/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@
882882
"maven": False,
883883
},
884884

885-
"JAVA_COMMUNITY": {
885+
"JAVA_POM": {
886886
"class": "DynamicPOMDistribution",
887887
"description": "Java on Truffle (aka Espresso): a Java bytecode interpreter",
888888
"distDependencies": [
@@ -891,7 +891,7 @@
891891
"truffle:TRUFFLE_NFI_LIBFFI",
892892
"truffle:TRUFFLE_RUNTIME",
893893
# sulong is not strictly required, but it'll work out of the box in more cases if it's there
894-
"sulong:LLVM_NATIVE_COMMUNITY",
894+
"sulong:LLVM_NATIVE_POM",
895895
],
896896
# optionally provides:
897897
# - ESPRESSO_RUNTIME_RESOURCES

sdk/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This changelog summarizes major changes between GraalVM SDK versions. The main f
1313
* GR-55223 The option sandbox.MaxStackFrames is no longer mandatory for the UNTRUSTED polyglot sandbox policy thanks to improved deoptimization handling of compiled code.
1414
* GR-64488 FileSystem implementations can now provide disk-related metadata, including [total space](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html##getFileStoreTotalSpace(java.nio.file.Path)), [usable space](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html#getFileStoreUsableSpace(java.nio.file.Path)), [unallocated space](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html#getFileStoreUnallocatedSpace(java.nio.file.Path)), [block size](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html#getFileStoreBlockSize(java.nio.file.Path)), and [read-only status](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html#isFileStoreReadOnly(java.nio.file.Path)).
1515
* GR-22699(EE-only) Added the ability to spawn `Engine` or `Context` isolated in a separate process by setting `Context.Builder.option("engine.IsolateMode", "external").`.
16+
* GR-64087 Removed the dependency on `org.graalvm.truffle:truffle-enterprise` from all language and tool POM artifacts. As a result, the community Maven artifacts (those with an artifact ID ending in `-community`) are now identical to their corresponding non-community artifacts. Consequently, all community language and tool POM artifacts have been deprecated. The only exception is `org.graalvm.truffle:java-community` vs. `org.graalvm.truffle:java`, which differ in the bundled Java runtime. Embedders using auxiliary engine caching, polyglot isolates, a isolated/untrusted sandbox policy, or the sandbox resource limits must now explicitly add the `org.graalvm.truffle:truffle-enterprise` Maven artifact to the classpath or module path.
1617

1718
## Version 24.2.0
1819
* GR-54905 When using Truffle NFI with the Panama backend, native access must now be granted to the Truffle module instead of the NFI Panama module. Use the `--enable-native-access=org.graalvm.truffle` Java command line option to enable the native access for the NFI Panama backend.

sulong/mx.sulong/suite.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@
17491749
"noMavenJavadoc": True,
17501750
},
17511751

1752-
"LLVM_NATIVE_COMMUNITY": {
1752+
"LLVM_NATIVE_POM": {
17531753
"type": "pom",
17541754
"runtimeDependencies": [
17551755
"SULONG_CORE",
@@ -1759,23 +1759,36 @@
17591759
"truffle:TRUFFLE_RUNTIME",
17601760
],
17611761
"maven": {
1762-
"artifactId": "llvm-native-community",
1762+
"artifactId": "llvm-native",
17631763
"tag": ["default", "public"],
17641764
},
17651765
"description": "Graal native LLVM engine.",
17661766
"license": "BSD-new",
17671767
},
1768+
# GR-64088: Remove when changes in language repositories are merged
1769+
"LLVM_NATIVE_COMMUNITY": {
1770+
"type": "pom",
1771+
"runtimeDependencies": [
1772+
"LLVM_NATIVE_POM",
1773+
],
1774+
"maven": {
1775+
"artifactId": "llvm-native-transient",
1776+
"tag": ["default", "public"],
1777+
},
1778+
"description": "Temporary module to overcome cross-repository merge.",
1779+
"license": "BSD-new",
1780+
},
17681781

1769-
"LLVM_COMMUNITY": {
1782+
"LLVM_POM": {
17701783
"type": "pom",
17711784
"runtimeDependencies": [
1772-
"LLVM_NATIVE_COMMUNITY",
1785+
"LLVM_NATIVE_POM",
17731786
],
17741787
"maven": {
17751788
"artifactId": "llvm-community",
17761789
"tag": ["default", "public"],
17771790
},
1778-
"description": "Graal LLVM engine.",
1791+
"description": "Deprecated: Please use the \'llvm-native\' Maven artifact instead.",
17791792
"license": "BSD-new",
17801793
},
17811794

tools/mx.tools/suite.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,15 @@
391391
},
392392
"description" : "The core module of the polyglot debugging backend for chrome inspector.",
393393
},
394-
"INSPECT_COMMUNITY": {
394+
"INSPECT_POM": {
395395
"type": "pom",
396396
"runtimeDependencies": [
397397
"CHROMEINSPECTOR",
398398
"truffle:TRUFFLE_RUNTIME",
399399
],
400400
"maven": {
401401
"groupId" : "org.graalvm.polyglot",
402-
"artifactId": "inspect-community",
402+
"artifactId": "inspect",
403403
"tag": ["default", "public"],
404404
},
405405
"description": "The polyglot debugging backend for chrome inspector.",
@@ -454,15 +454,15 @@
454454
},
455455
"description" : "The core module of the Insights Gathering Platform",
456456
},
457-
"INSIGHT_COMMUNITY": {
457+
"INSIGHT_POM": {
458458
"type": "pom",
459459
"runtimeDependencies": [
460460
"INSIGHT",
461461
"truffle:TRUFFLE_RUNTIME",
462462
],
463463
"maven": {
464464
"groupId" : "org.graalvm.polyglot",
465-
"artifactId": "insight-community",
465+
"artifactId": "insight",
466466
"tag": ["default", "public"],
467467
},
468468
"description": "The Ultimate Insights Gathering Platform",
@@ -491,15 +491,15 @@
491491
},
492492
"description" : "The core module of Heap Dump for Insight",
493493
},
494-
"HEAP_COMMUNITY": {
494+
"HEAP_POM": {
495495
"type": "pom",
496496
"runtimeDependencies": [
497497
"INSIGHT_HEAP",
498498
"truffle:TRUFFLE_RUNTIME",
499499
],
500500
"maven": {
501501
"groupId" : "org.graalvm.polyglot",
502-
"artifactId": "heap-community",
502+
"artifactId": "heap",
503503
"tag": ["default", "public"],
504504
},
505505
"description": "The Heap Dump for the Insights Gathering Platform",
@@ -564,15 +564,15 @@
564564
"javadocType" : "api",
565565
"description" : "The core module of the Truffle profiler"
566566
},
567-
"PROFILER_COMMUNITY": {
567+
"PROFILER_POM": {
568568
"type": "pom",
569569
"runtimeDependencies": [
570570
"TRUFFLE_PROFILER",
571571
"truffle:TRUFFLE_RUNTIME",
572572
],
573573
"maven": {
574574
"groupId" : "org.graalvm.polyglot",
575-
"artifactId": "profiler-community",
575+
"artifactId": "profiler",
576576
"tag": ["default", "public"],
577577
},
578578
"description": "The truffle profiler, supporting CPU sampling and tracing. Memory tracing support is experimental"
@@ -624,15 +624,15 @@
624624
"description" : "Core module of the Truffle code coverage tool",
625625
"javadocType" : "api",
626626
},
627-
"COVERAGE_COMMUNITY": {
627+
"COVERAGE_POM": {
628628
"type": "pom",
629629
"runtimeDependencies": [
630630
"TRUFFLE_COVERAGE",
631631
"truffle:TRUFFLE_RUNTIME",
632632
],
633633
"maven": {
634634
"groupId" : "org.graalvm.polyglot",
635-
"artifactId": "coverage-community",
635+
"artifactId": "coverage",
636636
"tag": ["default", "public"],
637637
},
638638
"description": "The Truffle code coverage tool"
@@ -685,15 +685,15 @@
685685
},
686686
"description" : "Core module of the polyglot debugging backend for the Debug Adapter Protocol",
687687
},
688-
"DAP_COMMUNITY": {
688+
"DAP_POM": {
689689
"type": "pom",
690690
"runtimeDependencies": [
691691
"DAP",
692692
"truffle:TRUFFLE_RUNTIME",
693693
],
694694
"maven": {
695695
"groupId" : "org.graalvm.polyglot",
696-
"artifactId": "dap-community",
696+
"artifactId": "dap",
697697
"tag": ["default", "public"],
698698
},
699699
"description": "The polyglot debugging backend for the Debug Adapter Protocol"
@@ -776,15 +776,15 @@
776776
},
777777
"description" : "Core module of the polyglot Language Server backend",
778778
},
779-
"LSP_COMMUNITY": {
779+
"LSP_POM": {
780780
"type": "pom",
781781
"runtimeDependencies": [
782782
"LSP",
783783
"truffle:TRUFFLE_RUNTIME",
784784
],
785785
"maven": {
786786
"groupId" : "org.graalvm.polyglot",
787-
"artifactId": "lsp-community",
787+
"artifactId": "lsp",
788788
"tag": ["default", "public"],
789789
},
790790
"description": "The polyglot Language Server backend"

truffle/mx.truffle/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@
16581658
"TRUFFLE_API",
16591659
"TRUFFLE_COMPILER",
16601660
],
1661-
"description" : "The community edition of the Truffle runtime for Graal Languages. It is not recommended to depend on this artifact directly. Instead, use a POM dependency of one or more Graal Languages (for example `org.graalvm.polyglot:js-community`) to ensure all dependencies are pulled in correctly.", # pylint: disable=line-too-long
1661+
"description" : "The Truffle runtime for Graal Languages. It is not recommended to depend on this artifact directly. Instead, use a POM dependency of one or more Graal Languages (for example `org.graalvm.polyglot:js`) to ensure all dependencies are pulled in correctly.", # pylint: disable=line-too-long
16621662
"useModulePath": True,
16631663
"maven": {
16641664
"artifactId": "truffle-runtime",

truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotImpl.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@
6262
import java.nio.file.Path;
6363
import java.util.Collection;
6464
import java.util.HashMap;
65+
import java.util.HashSet;
6566
import java.util.Map;
6667
import java.util.Objects;
68+
import java.util.Set;
6769
import java.util.concurrent.atomic.AtomicReference;
6870
import java.util.function.Consumer;
6971
import java.util.function.Function;
7072
import java.util.function.Predicate;
7173
import java.util.function.Supplier;
7274
import java.util.logging.Level;
75+
import java.util.stream.Collectors;
7376

7477
import org.graalvm.options.OptionDescriptors;
7578
import org.graalvm.polyglot.Engine;
@@ -109,6 +112,14 @@
109112
*/
110113
public final class PolyglotImpl extends AbstractPolyglotImpl {
111114

115+
private static final Set<String> TRUFFLE_ENTERPRISE_OPTIONS = Set.of(
116+
"engine.Cache",
117+
"engine.CacheLoad",
118+
"engine.CacheStore",
119+
"engine.DebugCacheLoad",
120+
"engine.DebugCacheStore",
121+
"engine.SpawnIsolate");
122+
112123
/*
113124
* Used to prevent implementations of accessible API classes.
114125
*/
@@ -277,6 +288,7 @@ public Engine buildEngine(String[] permittedLanguages, SandboxPolicy sandboxPoli
277288
boolean registerInActiveEngines, Object polyglotHostService) {
278289
PolyglotEngineImpl impl = null;
279290
try {
291+
validateVendorOptions(options);
280292
validateSandbox(sandboxPolicy);
281293
if (TruffleOptions.AOT) {
282294
EngineAccessor.ACCESSOR.initializeNativeImageTruffleLocator();
@@ -406,6 +418,27 @@ private static void logTruffleRuntimeWarning(Map<String, String> options, Option
406418

407419
}
408420

421+
private void validateVendorOptions(Map<String, String> options) {
422+
if (this != this.getRootImpl()) {
423+
return;
424+
}
425+
Set<String> usedEnterpriseOptions = new HashSet<>();
426+
for (String key : options.keySet()) {
427+
if (TRUFFLE_ENTERPRISE_OPTIONS.contains(key) || key.startsWith("sandbox.") || key.equals("sandbox")) {
428+
usedEnterpriseOptions.add(key);
429+
}
430+
}
431+
if (!usedEnterpriseOptions.isEmpty()) {
432+
String optionNames = usedEnterpriseOptions.stream().map((s) -> '\'' + s + '\'').collect(Collectors.joining(", "));
433+
throw PolyglotEngineException.illegalArgument(String.format(
434+
"The following options %s require Truffle Enterprise Extensions to be available on the classpath or module path. " +
435+
"Please ensure that the 'org.graalvm.truffle:truffle-enterprise' Maven artifact is correctly included in your build configuration. " +
436+
"Note that Truffle Enterprise Extensions are only supported when running on Oracle GraalVM or Oracle JDK. " +
437+
"Remove these option or add the 'org.graalvm.truffle:truffle-enterprise' artefact to resolve this issue.",
438+
optionNames));
439+
}
440+
}
441+
409442
private void validateSandbox(SandboxPolicy sandboxPolicy) {
410443
// When The PolyglotImpl is used as a root polyglot it supports at most the CONSTRAINED
411444
// sandboxing policy . When it's used as a delegate of other polyglot it needs to support

0 commit comments

Comments
 (0)