Pass a flag to the Java compiler to increase the maximum heap size of the

Branches: main

Pass a flag to the Java compiler to increase the maximum heap size of the
JVM.  The default size (at least with Sun Java) is too small to build the
Mercury standard library on 32-bit JVMs.  We choose a heap size of 256 MB
currently.  (There doesn't seem to be an option to just switch off the
maximum.)

As the flag may not work with non-Sun compilers, we have to check during
configuration whether it's accepted by the detected Java compiler.

aclocal.m4:
        Add a function to check if the Java compiler accepts the option
        `-J-Xmx<n>'.

        Bump Java SDK requirement to 1.5 (this was raised previously without
        updating the check).

        Update some comments.

configure.in:
        Add the configure option `--enable-javac-flags-for-heap-size',
        enabled by default.

        Check if the Java compiler accepts the maximum heap size option.

        Substitute the option in scripts.

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.vars.in:
        Add @JAVAC_FLAGS_FOR_HEAP_SIZE@ to default javac flags.
This commit is contained in:
Peter Wang
2009-08-18 05:10:40 +00:00
parent 7df1fc0548
commit ff5715c766
5 changed files with 47 additions and 6 deletions

View File

@@ -63,6 +63,7 @@ DEFAULT_MCFLAGS=\
--c-flag-to-name-object-file "@OBJFILE_OPT@" \
--java-classpath "$(INSTALL_JAVA_LIBRARY_DIR)/$(RT_LIB_NAME).jar" \
--java-classpath "$(INSTALL_JAVA_LIBRARY_DIR)/$(STD_LIB_NAME).jar" \
--java-flags "@JAVAC_FLAGS_FOR_HEAP_SIZE@" \
--object-file-extension ".@OBJ_SUFFIX@" \
--pic-object-file-extension ".@EXT_FOR_PIC_OBJECTS@" \
--link-with-pic-object-file-extension ".@EXT_FOR_LINK_WITH_PIC_OBJECTS@" \

View File

@@ -69,6 +69,7 @@ DEFAULT_MCFLAGS=\
--c-flag-to-name-object-file "@OBJFILE_OPT@" \
--java-classpath "$(INSTALL_JAVA_LIBRARY_DIR)/$(RT_LIB_NAME).jar" \
--java-classpath "$(INSTALL_JAVA_LIBRARY_DIR)/$(STD_LIB_NAME).jar" \
--java-flags "@JAVAC_FLAGS_FOR_HEAP_SIZE@" \
--object-file-extension ".@OBJ_SUFFIX@" \
--pic-object-file-extension ".@EXT_FOR_PIC_OBJECTS@" \
--link-with-pic-object-file-extension ".@EXT_FOR_LINK_WITH_PIC_OBJECTS@" \

View File

@@ -268,7 +268,7 @@ LIB_MS_CSCFLAGS =
JAVAC = @JAVAC@
ALL_JAVACFLAGS = $(JAVACFLAGS) $(EXTRA_JAVACFLAGS) $(TARGET_JAVACFLAGS) \
$(LIB_JAVACFLAGS)
JAVACFLAGS =
JAVACFLAGS = @JAVAC_FLAGS_FOR_HEAP_SIZE@
EXTRA_JAVACFLAGS =
# XXX Should we set LIB_JAVACFLAGS?
LIB_JAVACFLAGS =