bug fixes: get alias branch to bootstrap at -O6 with LCO

David Matthew Overton dmo at cs.mu.OZ.AU
Mon Sep 21 11:36:37 AEST 1998


Andrew,

I've just committed the following bug fixes to the alias branch.


Estimated hours taken: 5

Fix some bugs that were stopping the alias branch from bootstrapping
at -O6 with the LCO modulo constructors optimisation.  With these
changes, the alias branch now bootstraps with flags
-O6 --no-optimize-value-number --optimize-constructor-last-call --no-follow-code

(The follow-code optimisation is waiting on Andrew Bromage's changes to the
way alias insts are merged.)

compiler/lco.m:
	Prevent the lco optimisation when the called predicate is
	opt_imported.  This was causing link errors when inter-module
	optimisation was turned on.  An alternative solution would be
	to make a local copy of the called predicate, but I'm not sure
	if this is worth doing.

	Change the test used to determine if a construction is
	constructing a higher-order term.  The previous test, looking
	at the final insts, doesn't always work (e.g. in
	tests/valid/lazy_list.m at -O2).

compiler/liveness.m:
	Make sure that goals with unreachable insts still retain the
	correct refs set.  This information is needed in the code
	generator for updating the exprn_info at the ends of branches.

Index: lco.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/lco.m,v
retrieving revision 1.7.2.7
diff -u -r1.7.2.7 lco.m
--- 1.7.2.7	1998/08/05 08:08:53
+++ lco.m	1998/09/18 05:44:47
@@ -210,19 +210,13 @@
 	goal_info_get_instmap_delta(GoalInfo0, InstMapDelta),
 	instmap__apply_instmap_delta(InstMap0, InstMapDelta, InstMap1),
 	(
-		GoalExpr0 = unify(_, _, LHSMode - RHSMode, Unif, _),
-		Unif = construct(_, _, _, _),
+		GoalExpr0 = unify(_, _, _, Unif, _),
+		Unif = construct(_, ConsId, _, _),
 
 		% XXX For now, don't allow LCO on constructions of
 		% higher-order terms.  This is because we currently
 		% can't express non-ground higher-order terms.
-		proc_info_inst_table(Proc0, InstTable),
-		LHSMode = _ - LFinalInst,
-		RHSMode = _ - RFinalInst,
-		\+ inst_is_higher_order_ground(LFinalInst, InstMap1,
-				InstTable, Module0),
-		\+ inst_is_higher_order_ground(RFinalInst, InstMap1,
-				InstTable, Module0)
+		ConsId \= pred_const(_, _)
 	->
 		Unifies1 = [Goal0 | Unifies0],
 		lco_in_conj(Goals0, Unifies1, Goals, Module0, Module, InstMap1,
@@ -244,7 +238,9 @@
 		% This is because a new proc will need to be created for the
 		% pred that is called.
 		module_info_pred_info(Module0, CalledPredId, PredInfo),
-		\+ pred_info_is_imported(PredInfo),
+		pred_info_import_status(PredInfo, ImportStatus),
+		ImportStatus \= imported,
+		ImportStatus \= opt_imported,
 
 		% XXX - Also, we currently only allow one reference per
 		% variable, so make sure there is no more than one reference
Index: liveness.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/liveness.m,v
retrieving revision 1.81.2.13
diff -u -r1.81.2.13 liveness.m
--- 1.81.2.13	1998/08/05 08:08:56
+++ liveness.m	1998/09/15 04:28:31
@@ -219,17 +219,18 @@
 			InstMapAfter),
 	( instmap_delta_is_unreachable(InstMapDelta) ->
 		Births = Empty,
-		RefBirths = Empty
+		Refs = Refs0
 	;
 		set__init(Births0),
 		set__init(RefBirths0),
 		find_value_giving_occurrences(NewVarsList, LiveInfo0,
 			InstMapBefore, InstMapAfter, Births0, Births,
-			RefBirths0, RefBirths)
+			RefBirths0, RefBirths),
+		set__union(Refs0, RefBirths, Refs1),
+		remove_bound_refs(Refs1, LiveInfo0, InstMapBefore,
+			InstMapAfter, Refs)
 	),
 	set__union(Liveness0, Births, Liveness),
-	set__union(Refs0, RefBirths, Refs1),
-	remove_bound_refs(Refs1, LiveInfo0, InstMapBefore, InstMapAfter, Refs),
 	(
 		goal_is_atomic(Goal0)
 	->
-- 
David Overton
MEngSc Student                       Email: dmo at cs.mu.oz.au     
Department of Computer Science       Web: http://www.cs.mu.oz.au/~dmo
The University of Melbourne          Phone: +61 3 9344 9159



More information about the developers mailing list