Skip to content

Commit

Permalink
[GR-7242] Fix --native --polyglot if defaultVMType is JVM
Browse files Browse the repository at this point in the history
  • Loading branch information
gilles-duboscq committed Nov 29, 2017
1 parent 0406062 commit 6f5a8c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public abstract class AbstractLanguageLauncher extends Launcher {
protected final void launch(String[] args) {
try {
try {
launch(new ArrayList<>(Arrays.asList(args)), null);
launch(new ArrayList<>(Arrays.asList(args)), null, true);
} catch (AbortException e) {
throw e;
} catch (Throwable t) {
Expand All @@ -60,20 +60,20 @@ protected final void launch(String[] args) {
}
}

final void launch(List<String> args, Map<String, String> defaultOptions) {
final void launch(List<String> args, Map<String, String> defaultOptions, boolean doNativeSetup) {
Map<String, String> polyglotOptions = defaultOptions;
if (polyglotOptions == null) {
polyglotOptions = new HashMap<>();
}

if (isAOT()) {
if (isAOT() && doNativeSetup) {
assert nativeAccess != null;
nativeAccess.setGraalVMProperties();
}

List<String> unrecognizedArgs = preprocessArguments(args, polyglotOptions);

if (isAOT()) {
if (isAOT() && doNativeSetup) {
assert nativeAccess != null;
nativeAccess.maybeExec(args, false, polyglotOptions, getDefaultVMType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,9 @@ private void printNativeHelp() {
}

private void execNativePolyglot(List<String> args, Map<String, String> polyglotOptions) {
List<String> command = new ArrayList<>(args.size() + (polyglotOptions == null ? 0 : polyglotOptions.size()) + 2);
List<String> command = new ArrayList<>(args.size() + (polyglotOptions == null ? 0 : polyglotOptions.size()) + 3);
Path executable = getGraalVMBinaryPath("polyglot");
command.add("--native");
serializePolyglotOptions(polyglotOptions, command);
command.add("--use-launcher");
command.add(getMainClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void switchToLauncher(String launcherName, Map<String, String> options,
try {
AbstractLanguageLauncher launcher = launcherClass.newInstance();
launcher.setPolyglot(true);
launcher.launch(args, options);
launcher.launch(args, options, false);
} catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException("Failed to instanciate launcher class " + launcherName, e);
}
Expand Down

0 comments on commit 6f5a8c5

Please sign in to comment.