[m-rev.] diff: fix a bug in LLDS cell reuse

Peter Wang novalazy at gmail.com
Thu Jan 24 12:09:08 AEDT 2008


Branches: main

compiler/var_locn.m:
        Fix a bug when generating code for cell reuse where, if the lval in
        which to store the variable is a register, that register might also
        be used to save a field of the cell to be reused.

Index: compiler/var_locn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.55
diff -u -r1.55 var_locn.m
--- compiler/var_locn.m 21 Jan 2008 03:56:09 -0000      1.55
+++ compiler/var_locn.m 24 Jan 2008 01:00:56 -0000
@@ -889,6 +889,10 @@
         TotalOffset = MaybeOffset,
         TotalSize = Size
     ),
+    % This must appear before the call to `save_reused_cell_fields', otherwise
+    % `save_reused_cell_fields' won't know not to use Lval as a temporary
+    % register (if Lval is a register).
+    var_locn_set_magic_var_location(Var, Lval, !VLI),
     (
         HowToConstruct = construct_in_region(RegionVar),
         var_locn_produce_var(ModuleInfo, RegionVar, RegionRval,
@@ -951,7 +955,6 @@
 
         RegionVarCode = empty
     ),
-    var_locn_set_magic_var_location(Var, Lval, !VLI),
     (
         MaybeOffset = yes(Offset),
         StartOffset = -Offset


--------------------------------------------------------------------------
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