[m-dev.] [reuse] diff: bug fixes

Peter Ross petdr at miscrit.be
Wed Oct 11 01:04:20 AEDT 2000


Hi,


===================================================================


Estimated hours taken: 2

Various bug fixes which were preventing structure reuse succeeding.

hlds_out.m:
    Check for the case where the reuse_goal_info is empty.

sr_choice.m:
    Fill out the short_reuse_info for deconstructions.

sr_direct.m:
    A cons cell is available for reuse when it is of the *same size* or
    smaller then the reuse cell.

Index: hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.243.2.6
diff -u -r1.243.2.6 hlds_out.m
--- hlds_out.m	2000/10/09 17:53:10	1.243.2.6
+++ hlds_out.m	2000/10/10 13:42:41
@@ -1121,7 +1121,7 @@
 
 		{ goal_info_get_reuse(GoalInfo, REUSE) } ,
 	        (
-			{ REUSE = reuse(no_reuse) }
+			{ REUSE = reuse(no_reuse) ; REUSE = empty }
 		->
 			[]
 		; 
Index: sr_choice.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_choice.m,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 sr_choice.m
--- sr_choice.m	2000/10/10 12:03:56	1.1.2.5
+++ sr_choice.m	2000/10/10 13:42:41
@@ -201,8 +201,24 @@
 			choice(construct(set__list_to_set(Canditates))),
 			GoalInfo) }.
 
-apply_constraint_unification(_Constraint, Unif, GoalInfo, GoalInfo) -->
+apply_constraint_unification(_Constraint, Unif, GoalInfo0, GoalInfo) -->
 	{ Unif = deconstruct(Var, ConsId, _Vars, _Modes, _CanFail, _CanCGC) },
+
+	{ goal_info_get_reuse(GoalInfo0, ReuseInfo) },
+	{ ReuseInfo = choice(deconstruct(MaybeDies)) ->
+		(
+			MaybeDies = yes(_Condition),
+			goal_info_set_reuse(GoalInfo0, reuse(cell_died),
+					GoalInfo)
+		;
+			MaybeDies = no,
+			goal_info_set_reuse(GoalInfo0, reuse(no_reuse),
+					GoalInfo)
+		)
+	;
+		error("sr_choice__apply_constraint_unification")
+	},
+
 	Map0 =^ map,
 	{ multi_map__set(Map0, Var, ConsId, Map) },
 	^ map := Map.
Index: sr_direct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_direct.m,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 sr_direct.m
--- sr_direct.m	2000/10/10 12:41:55	1.1.2.5
+++ sr_direct.m	2000/10/10 13:42:42
@@ -451,7 +451,7 @@
 
 cons_can_reuse( Arity, _Var - Extra ) :- 
 	Extra = extra( DeadArity, _, _), 
-	Arity < DeadArity.
+	Arity =< DeadArity.
 
 :- pred to_pair_var_condition( pair( prog_var, dead_extra_info), 
 		pair( prog_var, reuse_condition) ).

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list