[m-rev.] diff: heap_ref bug fixes
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Apr 6 15:38:23 AEST 2006
compiler/livemap.m:
compiler/middle_rec.m:
compiler/var_locn.m:
Fix the same bug in all these three places: treat the rval arguments
of mem_ref terms as rvals, instead of as the constants they used to be.
This is for both branches.
Index: livemap.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/livemap.m,v
retrieving revision 1.74
diff -u -b -r1.74 livemap.m
--- livemap.m 29 Mar 2006 08:06:53 -0000 1.74
+++ livemap.m 6 Apr 2006 05:17:40 -0000
@@ -424,10 +424,13 @@
:- pred livemap.make_live_in_mem_ref(mem_ref::in, lvalset::in, lvalset::out)
is det.
-livemap.make_live_in_mem_ref(stackvar_ref(_), !Live).
-livemap.make_live_in_mem_ref(framevar_ref(_), !Live).
-livemap.make_live_in_mem_ref(heap_ref(Rval, _, _), !Live) :-
+livemap.make_live_in_mem_ref(stackvar_ref(Rval), !Live) :-
livemap.make_live_in_rval(Rval, !Live).
+livemap.make_live_in_mem_ref(framevar_ref(Rval), !Live) :-
+ livemap.make_live_in_rval(Rval, !Live).
+livemap.make_live_in_mem_ref(heap_ref(Rval1, _, Rval2), !Live) :-
+ livemap.make_live_in_rval(Rval1, !Live),
+ livemap.make_live_in_rval(Rval2, !Live).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
Index: middle_rec.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/middle_rec.m,v
retrieving revision 1.115
diff -u -b -r1.115 middle_rec.m
--- middle_rec.m 29 Mar 2006 08:07:01 -0000 1.115
+++ middle_rec.m 6 Apr 2006 05:26:56 -0000
@@ -615,10 +615,13 @@
:- pred find_used_registers_mem_ref(mem_ref::in,
set(int)::in, set(int)::out) is det.
-find_used_registers_mem_ref(stackvar_ref(_), !Used).
-find_used_registers_mem_ref(framevar_ref(_), !Used).
-find_used_registers_mem_ref(heap_ref(Rval, _, _), !Used) :-
+find_used_registers_mem_ref(stackvar_ref(Rval), !Used) :-
find_used_registers_rval(Rval, !Used).
+find_used_registers_mem_ref(framevar_ref(Rval), !Used) :-
+ find_used_registers_rval(Rval, !Used).
+find_used_registers_mem_ref(heap_ref(Rval1, _, Rval2), !Used) :-
+ find_used_registers_rval(Rval1, !Used),
+ find_used_registers_rval(Rval2, !Used).
:- pred find_used_registers_maybe_rvals(list(maybe(rval))::in,
set(int)::in, set(int)::out) is det.
Index: var_locn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.36
diff -u -b -r1.36 var_locn.m
--- var_locn.m 30 Mar 2006 02:46:01 -0000 1.36
+++ var_locn.m 6 Apr 2006 05:26:26 -0000
@@ -2061,10 +2061,13 @@
MemRef = MemRef0,
Code = empty
;
- MemRef0 = heap_ref(PtrRval0, Ptag, FieldNum),
- materialize_vars_in_rval(ModuleInfo, PtrRval0, no, Avoid, PtrRval,
- Code, !VLI),
- MemRef = heap_ref(PtrRval, Ptag, FieldNum)
+ MemRef0 = heap_ref(PtrRval0, Ptag, FieldNumRval0),
+ materialize_vars_in_rval(ModuleInfo, PtrRval0, no, Avoid,
+ PtrRval, PtrCode, !VLI),
+ materialize_vars_in_rval(ModuleInfo, FieldNumRval0, no, Avoid,
+ FieldNumRval, FieldNumCode, !VLI),
+ Code = tree(PtrCode, FieldNumCode),
+ MemRef = heap_ref(PtrRval, Ptag, FieldNumRval)
).
:- type var_avail
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list