[m-rev.] diff: fix bootchecking problems in the Java grade

Julien Fischer jfischer at opturion.com
Sat Oct 21 01:22:19 AEDT 2017


The following allows bootchecking in the Java grade to progress
past stage 2.  On my machine the JVM aborts due to a stack overflow
somewhere in the stage 3 library.  (IIRC, that can be setting a larger
stack size for the JVM -- I'll fix this separately.)

--------------------------

Fix bootchecking problems in the Java grade.

tools/bootcheck:
      Generate a new wrapper script for the stage 2 compiler that sets
      the CLASSPATH correctly.

      Don't pass any of the Mercury runtime options to the stage 2 compiler
      since the Java verison of the Mercury runtime doesn't currently understand
      them.

Julien.

diff --git a/tools/bootcheck b/tools/bootcheck
index 93c6f49..ea941aa 100755
--- a/tools/bootcheck
+++ b/tools/bootcheck
@@ -1140,6 +1140,30 @@ then
          cd $root
      fi

+    # In the java grade replace the generated mercury_compile wrapper script
+    # will not set the CLASSPATH correctly when building stage 3.  Replace it
+    # with one that will.
+    #
+    if test "$grade" = "java"
+    then
+cat > $root/$stage2dir/compiler/mercury_compile << EOF
+#!/bin/sh
+case \$WINDIR in
+   '') SEP=':' ;;
+   *)  SEP=';' ;;
+esac
+CLASSPATH=$root/$stage2dir/compiler/mercury_compile.jar\${SEP}$root/$stage2dir/library/mer_rt.jar\${SEP}$root/$stage2dir/library/mer_std.jar\${SEP}$root/$stage2dir/mdbcomp/mer_mdbcomp.jar
+export CLASSPATH
+JAVA=\${JAVA:-/usr/bin/java}
+exec "\$JAVA" jmercury.mercury_compile "\$@"
+EOF
+
+       # The Java version of the Mercury runtime does not currently support
+       # most of the runtime options and will abort if they are passed to it.
+       MERCURY_OPTIONS=
+       export MERCURY_OPTIONS
+    fi
+
      MERCURY_COMPILER=$root/$stage2dir/compiler/mercury_compile
      export MERCURY_COMPILER



More information about the reviews mailing list