From 73fc8f1722865adc27189bc9cafcf825e0a6c145 Mon Sep 17 00:00:00 2001
From: Danilo Ansaloni <danilo.ansaloni@oracle.com>
Date: Sun, 8 Apr 2018 11:07:53 +0200
Subject: [PATCH] Update the launchers to the latest in vm-enterprise.

---
 com.oracle.truffle.r.release/src/R_legacy       | 13 +++++++++----
 com.oracle.truffle.r.release/src/Rscript_legacy | 13 +++++++++----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/com.oracle.truffle.r.release/src/R_legacy b/com.oracle.truffle.r.release/src/R_legacy
index 99ecc9d7f8..6013194c05 100755
--- a/com.oracle.truffle.r.release/src/R_legacy
+++ b/com.oracle.truffle.r.release/src/R_legacy
@@ -25,9 +25,9 @@ PROGRAM_ARGS=()
 for opt in "${@:1}"
 do
     case $opt in
-        -J:*)
-            opt=${opt:3}
-            JAVA_ARGS+=("$opt") ;;
+        --jvm.*)
+            opt=${opt:6}
+            JAVA_ARGS+=("-$opt") ;;
         *)
             PROGRAM_ARGS+=("$opt") ;;
     esac
@@ -42,6 +42,11 @@ do
     GRAALVMCP="$GRAALVMCP$JAVA_HOME/$cp:"
 done
 
+# internal variable used to pass args to child R processes
+if [ -z "$FASTR_INTERNAL_ARGS" ]; then
+    FASTR_INTERNAL_ARGS=()
+fi
+
 # we can invoke FastR directly, but we do have to set R_HOME
 export R_HOME="$JRE/languages/R"
-exec "$JAVA_HOME/bin/java" -cp "$GRAALVMCP" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx8g "${JAVA_ARGS[@]}" com.oracle.truffle.r.launcher.LegacyLauncher com.oracle.truffle.r.launcher.RCommand "${PROGRAM_ARGS[@]}"
+exec "$JAVA_HOME/bin/java" -cp "$GRAALVMCP" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx8g "${JAVA_ARGS[@]}" com.oracle.truffle.r.launcher.LegacyLauncher com.oracle.truffle.r.launcher.RCommand "${FASTR_INTERNAL_ARGS[@]}" "${PROGRAM_ARGS[@]}"
diff --git a/com.oracle.truffle.r.release/src/Rscript_legacy b/com.oracle.truffle.r.release/src/Rscript_legacy
index 0f0a61f602..7adf97999c 100755
--- a/com.oracle.truffle.r.release/src/Rscript_legacy
+++ b/com.oracle.truffle.r.release/src/Rscript_legacy
@@ -25,9 +25,9 @@ PROGRAM_ARGS=()
 for opt in "${@:1}"
 do
     case $opt in
-        -J:*)
-            opt=${opt:3}
-            JAVA_ARGS+=("$opt") ;;
+        --jvm.*)
+            opt=${opt:6}
+            JAVA_ARGS+=("-$opt") ;;
         *)
             PROGRAM_ARGS+=("$opt") ;;
     esac
@@ -42,6 +42,11 @@ do
     GRAALVMCP="$GRAALVMCP$JAVA_HOME/$cp:"
 done
 
+# internal variable used to pass args to child R processes
+if [ -z "$FASTR_INTERNAL_ARGS" ]; then
+    FASTR_INTERNAL_ARGS=()
+fi
+
 # we can invoke FastR directly, but we do have to set R_HOME
 export R_HOME="$JRE/languages/R"
-exec "$JAVA_HOME/bin/java" -cp "$GRAALVMCP" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx4g "${JAVA_ARGS[@]}" com.oracle.truffle.r.launcher.LegacyLauncher com.oracle.truffle.r.launcher.RscriptCommand "${PROGRAM_ARGS[@]}"
+exec "$JAVA_HOME/bin/java" -cp "$GRAALVMCP" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx4g "${JAVA_ARGS[@]}" com.oracle.truffle.r.launcher.LegacyLauncher com.oracle.truffle.r.launcher.RscriptCommand "${FASTR_INTERNAL_ARGS[@]}" "${PROGRAM_ARGS[@]}"
-- 
GitLab