Skip to content

Commit

Permalink
Drop polyglot.jar and truffle-api.jar from native-image launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
jerboaa committed Oct 13, 2023
1 parent c6bdbb6 commit 261dd42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 2 additions & 6 deletions sdk/mx.sdk/mx_sdk_vm_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2232,13 +2232,9 @@ def _get_extra_jvm_args():
extra_jvm_args = mx.list_to_cmd_line(image_config.extra_jvm_args)
if not _jlink_libraries():
if mx.is_windows():
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"',
r'--add-modules org.graalvm.polyglot',
r'--module-path "%location%\..\..\truffle\truffle-api.jar:%location%\..\..\jvmci\polyglot.jar"'])
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"'])
else:
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"',
'--add-modules org.graalvm.polyglot',
'--module-path "${location}/../../truffle/truffle-api.jar:${location}/../../jvmci/polyglot.jar"'])
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"'])
return extra_jvm_args

def _get_option_vars():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,25 +576,35 @@ public List<Path> getBuilderModulePath() {
}

private List<Path> createTruffleBuilderModulePath() {
List<Path> jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise");
Path libTruffleDir = rootDir.resolve(Paths.get("lib", "truffle"));
List<Path> jars = getJars(libTruffleDir, "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"));
jars.addAll(getJars(libTruffleDir, "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"));
if (libJvmciDir != null) {
// truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
// JDKs
jars.addAll(getJars(libJvmciDir, "polyglot"));
}
}
if (libJvmciDir != null) {
// truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
jars.addAll(getJars(libTruffleDir, "jniutils"));
}
}
/*
* Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
* image builder still needs it
*/
if (libJvmciDir != null) {
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
}

return jars;
Expand Down

0 comments on commit 261dd42

Please sign in to comment.