Skip to content

Commit 261dd42

Browse files
committed
Drop polyglot.jar and truffle-api.jar from native-image launcher
1 parent c6bdbb6 commit 261dd42

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

sdk/mx.sdk/mx_sdk_vm_impl.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,13 +2232,9 @@ def _get_extra_jvm_args():
22322232
extra_jvm_args = mx.list_to_cmd_line(image_config.extra_jvm_args)
22332233
if not _jlink_libraries():
22342234
if mx.is_windows():
2235-
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"',
2236-
r'--add-modules org.graalvm.polyglot',
2237-
r'--module-path "%location%\..\..\truffle\truffle-api.jar:%location%\..\..\jvmci\polyglot.jar"'])
2235+
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"'])
22382236
else:
2239-
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"',
2240-
'--add-modules org.graalvm.polyglot',
2241-
'--module-path "${location}/../../truffle/truffle-api.jar:${location}/../../jvmci/polyglot.jar"'])
2237+
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"'])
22422238
return extra_jvm_args
22432239

22442240
def _get_option_vars():

substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,25 +576,35 @@ public List<Path> getBuilderModulePath() {
576576
}
577577

578578
private List<Path> createTruffleBuilderModulePath() {
579-
List<Path> jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise");
579+
Path libTruffleDir = rootDir.resolve(Paths.get("lib", "truffle"));
580+
List<Path> jars = getJars(libTruffleDir, "truffle-api", "truffle-runtime", "truffle-enterprise");
580581
if (!jars.isEmpty()) {
581582
/*
582583
* If Truffle is installed as part of the JDK we always add the builder modules of
583584
* Truffle to the builder module path. This is legacy support and should in the
584585
* future no longer be needed.
585586
*/
586-
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
587+
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
587588
Path builderPath = rootDir.resolve(Paths.get("lib", "truffle", "builder"));
588589
if (Files.exists(builderPath)) {
589590
jars.addAll(getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm"));
591+
if (libJvmciDir != null) {
592+
// truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
593+
// JDKs
594+
jars.addAll(getJars(libJvmciDir, "polyglot"));
595+
}
596+
}
597+
if (libJvmciDir != null) {
598+
// truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
599+
jars.addAll(getJars(libTruffleDir, "jniutils"));
590600
}
591601
}
592602
/*
593603
* Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
594604
* image builder still needs it
595605
*/
596606
if (libJvmciDir != null) {
597-
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
607+
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
598608
}
599609

600610
return jars;

0 commit comments

Comments
 (0)