mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 22:35:41 +00:00
The default configuration of Mercury on Windows breaks when using the Java grade due to the argument we pass to the Java compiler's '-J' option, in order to set the maximum heap size, not being quoted in the @file we pass to the Java compiler when '--restricted-command-line' is enabled. What should be placed in the @file is: -J"-Xmx1024m" What we currently put in it is: -J-Xmx1024m The reason for this is that the setting of JAVAC_FLAGS_FOR_HEAP_SIZE in scripts/Mercury.config does not escape the double quotes, consequently they do not get passed through the Mercury compiler to the aforementioned @file. This problem was already correctly identified and documented in the comments accompanying the MERCURY_CHECK_JAVAC_HEAP_SIZE macro in m4/mercury.m4, but the actual behaviour of that macro is incorrect. In particular, it fails to account for the fact that the value of JAVAC_FLAGS_FOR_HEAP_SIZE should differ depending on whether mmake or 'mmc --make' is using that value. The current value will work for mmake but not with 'mmc --make' (and '--restricted-command-line'). The fix is to separate the handling of the mmake and 'mmc --make' cases and correctly escape the version that is put in Mercury.config. configure.ac: m4/mercury.m4: Define separate configuration variables for mmake and 'mmc --make' to set the Java compiler's maximum heap size. scripts/Mercury.config.in: scripts/Mercury.config.bootstrap.in: scripts/Mmake.vars.in: Conform to the above change.