[m-rev.] diff: disable --should-pretest-equality on java

Peter Wang novalazy at gmail.com
Fri Apr 24 12:58:26 AEST 2009

Branches: main

        Disable --should-pretest-equality when generating Java as it tries
        to compare pointer values by casting objects to integers.  (The
        optimisation probably is applicable but getting rid of the casts
        is more work.)

diff --git a/compiler/handle_options.m b/compiler/handle_options.m
index 58872bf..5e29318 100644
--- a/compiler/handle_options.m
+++ b/compiler/handle_options.m
@@ -661,6 +661,8 @@ postprocess_options_2(OptionTable0, Target,
GC_Method, TagsMethod0,
         %         intermodule optimization pulls in a lot of code which isn't
         %         needed, so ensure that this dead code is removed.
         %   - no library grade installation check with `mmc --make'.
+        %   - no pretest equality check
+        %     Because it assumes pointers can be cast to integers.

             Target = target_java,
@@ -680,6 +682,7 @@ postprocess_options_2(OptionTable0, Target,
GC_Method, TagsMethod0,
             globals.set_option(static_ground_cells, bool(no), !Globals),
             globals.set_option(put_nondet_env_on_heap, bool(yes), !Globals),
             globals.set_option(libgrade_install_check, bool(no), !Globals),
+            globals.set_option(should_pretest_equality, bool(no), !Globals),

                 AutoIntermodOptimization = yes,
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au

More information about the reviews mailing list