Skip to content

Commit 86f363c

Browse files
committed
[GR-43819] Split Graal-SDK into new modules: polyglot, word, collections and nativeimage. (Unchained Part 7)
PullRequest: graal/14984
2 parents 3a8e5a9 + 5bf5216 commit 86f363c

File tree

52 files changed

+916
-461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+916
-461
lines changed

compiler/mx.compiler/mx_compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ def __init__(self):
13001300
self.truffle_jars = []
13011301
self.jars = []
13021302

1303-
for component in mx_sdk_vm.graalvm_components():
1303+
for component in mx_sdk_vm_impl.registered_graalvm_components():
13041304
if isinstance(component, mx_sdk_vm.GraalVmJvmciComponent):
13051305
for jar in component.jvmci_jars:
13061306
d = mx.distribution(jar)
@@ -1337,7 +1337,7 @@ def _jvmci_jars():
13371337
dir_name='graal',
13381338
license_files=[],
13391339
third_party_license_files=[],
1340-
dependencies=['Truffle Compiler'],
1340+
dependencies=['Truffle Compiler', 'Graal SDK Compiler'],
13411341
jar_distributions=[ # Dev jars (annotation processors)
13421342
'compiler:GRAAL_PROCESSOR',
13431343
],

compiler/mx.compiler/suite.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@
162162
"subDir" : "src",
163163
"sourceDirs" : ["src"],
164164
"dependencies" : [
165-
"sdk:GRAAL_SDK",
165+
"sdk:WORD",
166+
"sdk:COLLECTIONS",
166167
"truffle:TRUFFLE_COMPILER",
167168
],
168169
"requires" : [
@@ -419,6 +420,7 @@
419420
"sourceDirs" : ["src"],
420421
"dependencies" : [
421422
"jdk.internal.vm.compiler",
423+
"sdk:COLLECTIONS",
422424
],
423425
"checkstyle" : "jdk.internal.vm.compiler",
424426
"javaCompliance" : "17+",
@@ -526,7 +528,8 @@
526528
"jdk.internal.vm.compiler"
527529
],
528530
"distDependencies" : [
529-
"sdk:GRAAL_SDK",
531+
"sdk:COLLECTIONS",
532+
"sdk:WORD",
530533
"truffle:TRUFFLE_COMPILER",
531534
],
532535
"allowsJavadocWarnings": True,
@@ -610,7 +613,7 @@
610613
"org.graalvm.profdiff",
611614
],
612615
"distDependencies" : [
613-
"sdk:GRAAL_SDK",
616+
"sdk:COLLECTIONS",
614617
"GRAAL",
615618
],
616619
"maven" : False,

compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/api/test/ModuleSupport.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.Collections;
3636
import java.util.HashSet;
3737
import java.util.List;
38+
import java.util.Optional;
3839
import java.util.Set;
3940

4041
import org.graalvm.compiler.debug.DebugOptions;
@@ -71,7 +72,18 @@ public static void exportAllPackagesTo(Class<?> moduleMember, ClassLoader cl) {
7172
* Exports and opens all packages in the module named {@code name} to all unnamed modules.
7273
*/
7374
public static void exportAndOpenAllPackagesToUnnamed(String name) {
74-
Module module = ModuleLayer.boot().findModule(name).orElseThrow();
75+
exportAndOpenAllPackagesToUnnamed(name, true);
76+
}
77+
78+
/**
79+
* Exports and opens all packages in the module named {@code name} to all unnamed modules.
80+
*/
81+
public static void exportAndOpenAllPackagesToUnnamed(String name, boolean required) {
82+
Optional<Module> maybeModule = ModuleLayer.boot().findModule(name);
83+
Module module = required ? maybeModule.orElseThrow() : maybeModule.orElse(null);
84+
if (module == null) {
85+
return;
86+
}
7587
Set<String> packages = module.getPackages();
7688
for (String pkg : packages) {
7789
Modules.addExportsToAllUnnamed(module, pkg);

compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorld.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,12 @@
138138
public final class CompileTheWorld {
139139

140140
static {
141+
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.ci");
141142
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.compiler");
142-
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle");
143-
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle.runtime");
143+
// Truffle may not be on the module-path
144+
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle", false);
145+
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle.compiler", false);
146+
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle.runtime", false);
144147
}
145148

146149
/**

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/options/Option.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import java.lang.annotation.RetentionPolicy;
3030
import java.lang.annotation.Target;
3131

32-
import org.graalvm.options.OptionDescriptor;
33-
3432
/**
3533
* Describes the attributes of an option whose {@link OptionKey value} is in a static field
3634
* annotated by this annotation type.

espresso/mx.espresso/mx_espresso.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,17 @@ def register_espresso_envs(suite):
326326
tools = ['cov', 'dap', 'ins', 'insight', 'insightheap', 'lsp', 'pro', 'truffle-json']
327327
_llvm_toolchain_wrappers = ['bgraalvm-native-clang', 'bgraalvm-native-clang-cl', 'bgraalvm-native-clang++', 'bgraalvm-native-flang', 'bgraalvm-native-ld', 'bgraalvm-native-binutil']
328328
if LLVM_JAVA_HOME:
329-
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')
330-
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')
331-
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')
332-
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')
333-
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')
329+
mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'elau' ] + tools, suite, env_file='jvm-llvm')
330+
mx_sdk_vm.register_vm_config('espresso-jvm-ce', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', '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')
331+
mx_sdk_vm.register_vm_config('espresso-jvm-ee', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', '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')
332+
mx_sdk_vm.register_vm_config('espresso-native-ce', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp', 'antlr4', 'llrc', 'llrn' , 'svm', 'svmt' , 'svmsl' , 'tflm' , 'spolyglot'] + _llvm_toolchain_wrappers + tools, suite, env_file='native-ce-llvm')
333+
mx_sdk_vm.register_vm_config('espresso-native-ee', ['java', 'ejvm', 'ellvm', 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', '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')
334334
else:
335-
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')
336-
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')
337-
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')
338-
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')
339-
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')
335+
mx_sdk_vm.register_vm_config('espresso-jvm', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp' , 'elau' ] + tools, suite, env_file='jvm')
336+
mx_sdk_vm.register_vm_config('espresso-jvm-ce', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp' , 'svm', 'svmt', 'svmsl' , 'tflm', 'elau', 'lg', 'bespresso', 'sjavavm', 'spolyglot' ] + tools, suite, env_file='jvm-ce')
337+
mx_sdk_vm.register_vm_config('espresso-jvm-ee', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', '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')
338+
mx_sdk_vm.register_vm_config('espresso-native-ce', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc' , 'cmp' , 'svm', 'svmt', 'svmsl' , 'tflm' , 'spolyglot' ] + tools, suite, env_file='native-ce')
339+
mx_sdk_vm.register_vm_config('espresso-native-ee', ['java', 'ejvm' , 'libpoly', 'nfi-libffi', 'nfi', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tfle', 'cmp' , 'cmpee', 'svm', 'svmt', 'svmsl', 'svmee', 'svmte', 'tflllm', 'tflm' , 'spolyglot' ] + tools, suite, env_file='native-ee')
340340

341341

342342
register_espresso_envs(_suite)

espresso/mx.espresso/suite.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"subDir": "src",
148148
"sourceDirs": ["src"],
149149
"dependencies": [
150-
"sdk:GRAAL_SDK",
150+
"sdk:POLYGLOT",
151151
"sdk:LAUNCHER_COMMON",
152152
],
153153
"javaCompliance" : "17+",
@@ -158,7 +158,7 @@
158158
"subDir": "src",
159159
"sourceDirs": ["src"],
160160
"dependencies": [
161-
"sdk:GRAAL_SDK",
161+
"sdk:POLYGLOT",
162162
"sdk:LAUNCHER_COMMON",
163163
],
164164
"requires": [
@@ -338,7 +338,7 @@
338338
],
339339
"mainClass": "com.oracle.truffle.espresso.launcher.EspressoLauncher",
340340
"distDependencies": [
341-
"sdk:GRAAL_SDK",
341+
"sdk:POLYGLOT",
342342
"sdk:LAUNCHER_COMMON",
343343
],
344344
"description": "Espresso launcher using the polyglot API.",
@@ -352,7 +352,7 @@
352352
"com.oracle.truffle.espresso.libjavavm",
353353
],
354354
"distDependencies": [
355-
"sdk:GRAAL_SDK",
355+
"sdk:POLYGLOT",
356356
"sdk:LAUNCHER_COMMON",
357357
],
358358
"description": "provides native espresso entry points",
@@ -385,7 +385,7 @@
385385
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
386386
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
387387
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
388-
"dependency:espresso:POLYGLOT/*",
388+
"dependency:espresso:ESPRESSO_POLYGLOT/*",
389389
"dependency:espresso:HOTSWAP/*",
390390
],
391391
},
@@ -403,7 +403,7 @@
403403
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
404404
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
405405
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
406-
"dependency:espresso:POLYGLOT/*",
406+
"dependency:espresso:ESPRESSO_POLYGLOT/*",
407407
"dependency:espresso:HOTSWAP/*",
408408
],
409409
},
@@ -422,7 +422,7 @@
422422
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
423423
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
424424
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
425-
"dependency:espresso:POLYGLOT/*",
425+
"dependency:espresso:ESPRESSO_POLYGLOT/*",
426426
"dependency:espresso:HOTSWAP/*",
427427
],
428428
},
@@ -444,7 +444,7 @@
444444
"maven": False,
445445
},
446446

447-
"POLYGLOT": {
447+
"ESPRESSO_POLYGLOT": {
448448
"subDir": "src",
449449
"dependencies": [
450450
"com.oracle.truffle.espresso.polyglot"
@@ -457,6 +457,9 @@
457457
"exports" : [
458458
"com.oracle.truffle.espresso.polyglot",
459459
]
460+
},
461+
"maven": {
462+
"artifactId": "polyglot",
460463
}
461464
},
462465

0 commit comments

Comments
 (0)