[m-rev.] diff: fix two rbmm bugs

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Aug 6 15:46:46 AEST 2007


Fix some RBMM problems reported by Quan.

compiler/code_info.m:
	When acquiring several temporary slots, we forgot to mark those slots
	as being in use. Fix that.

	Also fix an off-by-one error: mistaking the first unallocated slot
	for the last allocated slot.

compiler/llds_out.m:
	Make the output for region operations easier to read by removing the
	clutter of unnecessary casts.

Zoltan.

cvs diff: Diffing .
Index: code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.347
diff -u -b -r1.347 code_info.m
--- code_info.m	31 Jul 2007 01:56:33 -0000	1.347
+++ code_info.m	6 Aug 2007 05:13:01 -0000
@@ -4110,6 +4110,8 @@
         new_temp_slots([HeadItem | TailItems], StackVars,
             StackId, FirstSlotNum, LastSlotNum, !CI)
     ),
+    set.insert_list(TempsInUse0, StackVars, TempsInUse),
+    set_temps_in_use(TempsInUse, !CI),
     (
         Persistence = persistent_temp_slot,
         get_persistent_temps(!.CI, PersistentTemps0),
@@ -4146,9 +4148,10 @@
     CodeModel = get_proc_model(!.CI),
     StackId = code_model_to_main_stack(CodeModel),
     get_temp_content_map(!.CI, TempContentMap0),
-    record_new_temp_slots(Items, StackId, FirstSlotNum, LastSlotNum,
+    record_new_temp_slots(Items, StackId, FirstSlotNum, FirstUnusedSlotNum,
         TempSlotCount0, TempSlotCount, TempContentMap0, TempContentMap,
         StackVars),
+    LastSlotNum = FirstUnusedSlotNum - 1,
     set_max_temp_slot_count(TempSlotCount, !CI),
     set_temp_content_map(TempContentMap, !CI).
 
Index: llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.314
diff -u -b -r1.314 llds_out.m
--- llds_out.m	31 Jul 2007 01:56:36 -0000	1.314
+++ llds_out.m	6 Aug 2007 05:44:37 -0000
@@ -5126,25 +5126,38 @@
 output_rval(mem_addr(MemRef), !IO) :-
     (
         MemRef = stackvar_ref(Rval),
-        output_llds_type_cast(data_ptr, !IO),
         io.write_string("&MR_sv(", !IO),
-        output_rval(Rval, !IO),
+        % Don't clutter the output with unnecessary casts.
+        ( Rval = const(llconst_int(SlotNum)) ->
+            io.write_int(SlotNum, !IO)
+        ;
+            output_rval_as_type(Rval, integer, !IO)
+        ),
         io.write_string(")", !IO)
     ;
         MemRef = framevar_ref(Rval),
-        output_llds_type_cast(data_ptr, !IO),
         io.write_string("&MR_fv(", !IO),
-        output_rval(Rval, !IO),
+        % Don't clutter the output with unnecessary casts.
+        ( Rval = const(llconst_int(SlotNum)) ->
+            io.write_int(SlotNum, !IO)
+        ;
+            output_rval_as_type(Rval, integer, !IO)
+        ),
         io.write_string(")", !IO)
     ;
         MemRef = heap_ref(BaseRval, Tag, FieldNumRval),
-        output_llds_type_cast(data_ptr, !IO),
         io.write_string("&MR_tfield(", !IO),
         io.write_int(Tag, !IO),
         io.write_string(", ", !IO),
         output_rval(BaseRval, !IO),
         io.write_string(", ", !IO),
         output_rval(FieldNumRval, !IO),
+        % Don't clutter the output with unnecessary casts.
+        ( FieldNumRval = const(llconst_int(FieldNum)) ->
+            io.write_int(FieldNum, !IO)
+        ;
+            output_rval_as_type(FieldNumRval, integer, !IO)
+        ),
         io.write_string(")", !IO)
     ).
 
cvs diff: Diffing notes
--------------------------------------------------------------------------
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