Skip to content

Commit 4edb47e

Browse files
eregonansalond
authored andcommitted
Avoid creating an Engine during RubyLauncher.preprocessArguments()
* This creates an Engine to check is Sulong is available, and currently that has the unfortunate side-effect of ignoring Truffle options. This only happens with the standalone, as we check if GraalVM before. * We need a better way to tell Sulong where libsulong is, but for now we assume Sulong is available when Ruby is in the RubyLauncher. (cherry picked from commit 8b1640d)
1 parent 863a586 commit 4edb47e

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/launcher/java/org/truffleruby/launcher/RubyLauncher.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.graalvm.nativeimage.ProcessProperties;
1414
import org.graalvm.options.OptionCategory;
1515
import org.graalvm.polyglot.Context;
16-
import org.graalvm.polyglot.Engine;
1716
import org.graalvm.polyglot.PolyglotException;
1817
import org.graalvm.polyglot.Source;
1918
import org.truffleruby.launcher.options.CommandLineException;
@@ -44,12 +43,6 @@ public static void main(String[] args) {
4443
new RubyLauncher().launch(args);
4544
}
4645

47-
static boolean isSulongAvailable() {
48-
try (Engine engine = Engine.create()) {
49-
return engine.getLanguages().containsKey(TruffleRuby.LLVM_ID);
50-
}
51-
}
52-
5346
@Override
5447
protected String getLanguageId() {
5548
return TruffleRuby.LANGUAGE_ID;
@@ -121,7 +114,7 @@ protected List<String> preprocessArguments(List<String> args, Map<String, String
121114
}
122115

123116
// In a native standalone distribution outside of GraalVM, we need to give the path to libsulong
124-
if (!isGraalVMAvailable() && isSulongAvailable()) {
117+
if (!isGraalVMAvailable()) { // TODO (eregon, 9 Jan 2019): This should check if Sulong is available.
125118
final String rubyHome = new File(launcher).getParentFile().getParent();
126119
final String libSulongPath = rubyHome + "/lib/cext/sulong-libs";
127120

0 commit comments

Comments
 (0)