[m-dev.] [reuse] diff: fill out fields for codegen structure reuse

Peter Ross peter.ross at miscrit.be
Thu Mar 8 05:07:40 AEDT 2001


Hi,


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


Estimated hours taken: 1
Branches: reuse

sr_split.m:
    When changing to the new hierachy of files, the change which sets
    the how_to_construct field was lost, meaning that no structure_reuse
    was done at codegen time.  Doh!

Index: sr_split.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_split.m,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 sr_split.m
--- sr_split.m	2001/03/07 17:20:33	1.1.2.9
+++ sr_split.m	2001/03/07 18:03:13
@@ -309,18 +309,41 @@
 	{ Goal = call(PredId, ProcId, Args, Builtin, MaybeContext, Name) }.
 
 process_goal(LocalReuseOnly, Goal0 - GoalInfo0, Goal - GoalInfo) -->
-	{ Goal0 = unify(_Var, _Rhs, _Mode, _Unification0, _Ctxt) },
+	{ Goal0 = unify(UVar, Rhs, Mode, Unification0, Ctxt) },
 	{
 		goal_info_get_reuse(GoalInfo0, Reuse),
-		Reuse = reuse(cell_reused(_ReuseVar, ConditionalReuse)),
-		ConditionalReuse = yes,
-		LocalReuseOnly = yes
+		Reuse = reuse(cell_reused(ReuseVar, ConditionalReuse))
 	->
-		goal_info_set_reuse(GoalInfo0, reuse(no_reuse), GoalInfo)
+		( ConditionalReuse = yes, LocalReuseOnly = yes ->
+			Unification = Unification0,
+			goal_info_set_reuse(GoalInfo0, reuse(no_reuse),
+					GoalInfo)
+		;
+			(
+				Unification0 = construct(Var, ConsId, Vars,
+						Modes, _HTC, IsUnique, MaybeRL)
+			->
+					% XXX Wrong cons_id but safe for the
+					% moment because we use the
+					% strategy that only cells with
+					% the same cons_id can be shared.
+				HTC = reuse_cell(cell_to_reuse(ReuseVar,
+						ConsId,
+						list__duplicate(
+							list__length(Vars), no)
+						)),
+				Unification = construct(Var, ConsId, Vars,
+						Modes, HTC, IsUnique, MaybeRL)
+			;
+				error("sr_split__process_goal: not a construction unification")
+			),
+			GoalInfo = GoalInfo0
+		)
 	;
+		Unification = Unification0,
 		GoalInfo = GoalInfo0
 	},
-	{ Goal = Goal0 }.
+	{ Goal = unify(UVar, Rhs, Mode, Unification, Ctxt) }.
 process_goal(_, Goal0 - GoalInfo, Goal - GoalInfo) -->
 	{ Goal0 = generic_call(_, _, _, _) },
 	{ Goal = Goal0 }.

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