[m-dev.] [reuse] diff: within n cell size difference

Peter Ross petdr at miscrit.be
Thu Oct 12 00:51:35 AEDT 2000


Hi,


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


Estimated hours taken: 1

sr_choice.m:
    Change same_size to be within n cell size difference, just set N to
    0 to get the same effect.


Index: sr_choice.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_choice.m,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 sr_choice.m
--- sr_choice.m	2000/10/11 10:58:13	1.1.2.7
+++ sr_choice.m	2000/10/11 13:45:19
@@ -30,7 +30,7 @@
 	% reuse.
 :- type constraint
 	--->	same_cons_id
-	;	same_size
+	;	within_n_cells_difference(int)
 	.
 
 	% After the constraint has been applied to the set of cells
@@ -50,7 +50,7 @@
 :- implementation.
 
 :- import_module hlds_data, prog_data.
-:- import_module multi_map, require, set.
+:- import_module int, multi_map, require, set.
 
 process_goal(Strategy, Goal0, Goal, MaybeReuseConditions) :-
 	Strategy = strategy(Constraint, SelectionRule),
@@ -197,7 +197,7 @@
 			multi_map__search(Map, CandidateVar, [ConsId])
 		)}
 	;
-		{ Constraint = same_size },
+		{ Constraint = within_n_cells_difference(Difference) },
 
 			% XXX Are two cells with the same arity the same
@@ -214,7 +214,7 @@
 			=>
 				(
 					cons_id_arity(ReuseConsId, ReuseArity),
-					ReuseArity = Arity
+					ReuseArity - Arity =< Difference
 				)
 			)
 		)}

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