Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-43819] Split Graal-SDK into new modules: polyglot, word, collections and nativeimage. (Unchained Part 7) #7171

Merged
merged 11 commits into from
Aug 9, 2023
4 changes: 2 additions & 2 deletions compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ def __init__(self):
self.truffle_jars = []
self.jars = []

for component in mx_sdk_vm.graalvm_components():
for component in mx_sdk_vm_impl.registered_graalvm_components():
if isinstance(component, mx_sdk_vm.GraalVmJvmciComponent):
for jar in component.jvmci_jars:
d = mx.distribution(jar)
Expand Down Expand Up @@ -1337,7 +1337,7 @@ def _jvmci_jars():
dir_name='graal',
license_files=[],
third_party_license_files=[],
dependencies=['Truffle Compiler'],
dependencies=['Truffle Compiler', 'Graal SDK Compiler'],
jar_distributions=[ # Dev jars (annotation processors)
'compiler:GRAAL_PROCESSOR',
],
Expand Down
9 changes: 6 additions & 3 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@
"subDir" : "src",
"sourceDirs" : ["src"],
"dependencies" : [
"sdk:GRAAL_SDK",
"sdk:WORD",
"sdk:COLLECTIONS",
"truffle:TRUFFLE_COMPILER",
],
"requires" : [
Expand Down Expand Up @@ -419,6 +420,7 @@
"sourceDirs" : ["src"],
"dependencies" : [
"jdk.internal.vm.compiler",
"sdk:COLLECTIONS",
],
"checkstyle" : "jdk.internal.vm.compiler",
"javaCompliance" : "17+",
Expand Down Expand Up @@ -526,7 +528,8 @@
"jdk.internal.vm.compiler"
],
"distDependencies" : [
"sdk:GRAAL_SDK",
"sdk:COLLECTIONS",
"sdk:WORD",
"truffle:TRUFFLE_COMPILER",
],
"allowsJavadocWarnings": True,
Expand Down Expand Up @@ -610,7 +613,7 @@
"org.graalvm.profdiff",
],
"distDependencies" : [
"sdk:GRAAL_SDK",
"sdk:COLLECTIONS",
"GRAAL",
],
"maven" : False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.graalvm.compiler.debug.DebugOptions;
Expand Down Expand Up @@ -71,7 +72,18 @@ public static void exportAllPackagesTo(Class<?> moduleMember, ClassLoader cl) {
* Exports and opens all packages in the module named {@code name} to all unnamed modules.
*/
public static void exportAndOpenAllPackagesToUnnamed(String name) {
Module module = ModuleLayer.boot().findModule(name).orElseThrow();
exportAndOpenAllPackagesToUnnamed(name, true);
}

/**
* Exports and opens all packages in the module named {@code name} to all unnamed modules.
*/
public static void exportAndOpenAllPackagesToUnnamed(String name, boolean required) {
Optional<Module> maybeModule = ModuleLayer.boot().findModule(name);
Module module = required ? maybeModule.orElseThrow() : maybeModule.orElse(null);
if (module == null) {
return;
}
Set<String> packages = module.getPackages();
for (String pkg : packages) {
Modules.addExportsToAllUnnamed(module, pkg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@
public final class CompileTheWorld {

static {
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.ci");
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.compiler");
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle");
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle.runtime");
// Truffle may not be on the module-path
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle", false);
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle.compiler", false);
ModuleSupport.exportAndOpenAllPackagesToUnnamed("org.graalvm.truffle.runtime", false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.graalvm.options.OptionDescriptor;

/**
* Describes the attributes of an option whose {@link OptionKey value} is in a static field
* annotated by this annotation type.
Expand Down
20 changes: 10 additions & 10 deletions espresso/mx.espresso/mx_espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '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')
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')
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')
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')
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')
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')
else:
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')
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')
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')
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')
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')
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')


register_espresso_envs(_suite)
19 changes: 11 additions & 8 deletions espresso/mx.espresso/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": [
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
"sdk:LAUNCHER_COMMON",
],
"javaCompliance" : "17+",
Expand All @@ -158,7 +158,7 @@
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": [
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
"sdk:LAUNCHER_COMMON",
],
"requires": [
Expand Down Expand Up @@ -338,7 +338,7 @@
],
"mainClass": "com.oracle.truffle.espresso.launcher.EspressoLauncher",
"distDependencies": [
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
"sdk:LAUNCHER_COMMON",
],
"description": "Espresso launcher using the polyglot API.",
Expand All @@ -352,7 +352,7 @@
"com.oracle.truffle.espresso.libjavavm",
],
"distDependencies": [
"sdk:GRAAL_SDK",
"sdk:POLYGLOT",
"sdk:LAUNCHER_COMMON",
],
"description": "provides native espresso entry points",
Expand Down Expand Up @@ -385,7 +385,7 @@
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
"dependency:espresso:POLYGLOT/*",
"dependency:espresso:ESPRESSO_POLYGLOT/*",
"dependency:espresso:HOTSWAP/*",
],
},
Expand All @@ -403,7 +403,7 @@
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
"dependency:espresso:POLYGLOT/*",
"dependency:espresso:ESPRESSO_POLYGLOT/*",
"dependency:espresso:HOTSWAP/*",
],
},
Expand All @@ -422,7 +422,7 @@
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
"dependency:espresso:POLYGLOT/*",
"dependency:espresso:ESPRESSO_POLYGLOT/*",
"dependency:espresso:HOTSWAP/*",
],
},
Expand All @@ -444,7 +444,7 @@
"maven": False,
},

"POLYGLOT": {
"ESPRESSO_POLYGLOT": {
"subDir": "src",
"dependencies": [
"com.oracle.truffle.espresso.polyglot"
Expand All @@ -457,6 +457,9 @@
"exports" : [
"com.oracle.truffle.espresso.polyglot",
]
},
"maven": {
"artifactId": "polyglot",
}
},

Expand Down
Loading