[m-dev.] for review: polymorphic ground insts

David Overton dmo at ender.cs.mu.oz.au
Fri Mar 17 15:42:05 AEDT 2000


On Tue, Mar 07, 2000 at 03:25:45AM +1100, Fergus Henderson wrote:
> On 06-Mar-2000, David Overton <dmo at ender.cs.mu.oz.au> wrote:
> > 
> > Here's another relative diff.  I'll commit this as soon as it passes a
> > bootcheck.
> 
> That diff looks fine.  
> 
> Just one small comment: does your cvs log message describe the changes to
> compiler/accumulator.m? You changed the assoc_info type in
> compiler/accumulator.m to use field names and record syntax, but that wasn't
> mentioned in the relative diff for the log message.
> 

Here is one more relative diff.  Some of the test cases fail due to
`type_util__get_cons_id_arg_types' not supporting existentially typed
cons_ids.  I have disabled these test cases.  Is that the best thing
to do for now?  If so, I'll commit this change.


David

--- cvslog.old	Fri Mar 17 15:17:22 2000
+++ cvslog	Fri Mar 17 15:31:52 2000
@@ -1,6 +1,6 @@
 
 
-Estimated hours taken: 50
+Estimated hours taken: 60
 
 Allow polymorphic ground insts.  This change assumes that all inst
 parameters in the mode declaration for a predicate or function are
@@ -104,6 +104,19 @@
 	Pass inst_varsets and types where needed.
 	Changes to reflect change in definition of the inst data type.
 
+compiler/accumulator.m:
+	Use field names and record syntax for the assoc_info data
+	structure.
+
+compiler/inlining.m:
+	Recompute the instmap deltas for a procedure after inlining.
+	This bug showed up compiling tests/hard_coded/lp.m with
+	inlining and deforestation turned on: deforestation was
+	getting incorrect instmap deltas from inlining, causing
+	the transformation to break mode-correctness.  It has only
+	just shown up because of the added call to
+	`inst_matches_initial' from within `recompute_instmap_delta'.
+
 tests/invalid/Mmakefile:
 tests/invalid/unbound_inst_var.m:
 tests/invalid/unbound_inst_var.err_exp:
@@ -111,3 +124,13 @@
 tests/valid/unbound_inst_var.m:
 	Move the `unbound_inst_var' test case from `invalid' to `valid'
 	and extend its coverage a bit.
+
+tests/hard_coded/Mmakefile:
+tests/valid/Mmakefile:
+	Disable the tests valid/existential_cons.m,
+	hard_coded/existential_rtti.m,
+	hard_coded/existential_type_switch.m,
+	hard_coded/existential_type_switch_opt.m, and
+	hard_coded/record_syntax.m.  These tests fail due to
+	type_util__get_cons_id_arg_types not yet supporting
+	existentially typed cons_ids.

Index: compiler/inlining.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.84
diff -u -r1.84 inlining.m
--- compiler/inlining.m	1999/10/25 03:48:59	1.84
+++ compiler/inlining.m	2000/03/17 03:50:38
@@ -382,6 +382,7 @@
 					% type variables to variables
 					% where their type_info is
 					% stored.
+		bool,			% Did we do any inlining in the proc?
 		bool			% Did we change the determinism
 					% of any subgoal?
 	).
@@ -410,28 +411,40 @@
 	proc_info_vartypes(ProcInfo0, VarTypes0),
 	proc_info_typeinfo_varmap(ProcInfo0, TypeInfoVarMap0),
 
+	DidInlining0 = no,
 	DetChanged0 = no,
 
 	InlineInfo0 = inline_info(
 		VarThresh, InlinedProcs, ModuleInfo0, UnivQTVars, Markers,
-		VarSet0, VarTypes0, TypeVarSet0, TypeInfoVarMap0, DetChanged0),
+		VarSet0, VarTypes0, TypeVarSet0, TypeInfoVarMap0, 
+		DidInlining0, DetChanged0),
 
 	inlining__inlining_in_goal(Goal0, Goal, InlineInfo0, InlineInfo),
 
 	InlineInfo = inline_info(_, _, _, _, _, VarSet, VarTypes, TypeVarSet, 
-		TypeInfoVarMap, DetChanged),
+		TypeInfoVarMap, DidInlining, DetChanged),
 
 	pred_info_set_typevarset(PredInfo0, TypeVarSet, PredInfo1),
 
 	proc_info_set_varset(ProcInfo0, VarSet, ProcInfo1),
 	proc_info_set_vartypes(ProcInfo1, VarTypes, ProcInfo2),
 	proc_info_set_typeinfo_varmap(ProcInfo2, TypeInfoVarMap, ProcInfo3),
-	proc_info_set_goal(ProcInfo3, Goal, ProcInfo),
+	proc_info_set_goal(ProcInfo3, Goal, ProcInfo4),
 
+	(
+		DidInlining = yes,
+		recompute_instmap_delta_proc(yes, ProcInfo4, ProcInfo,
+			ModuleInfo0, ModuleInfo1)
+	;
+		DidInlining = no,
+		ProcInfo = ProcInfo4,
+		ModuleInfo1 = ModuleInfo0
+	),
+
 	map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo1, ProcTable, PredInfo),
 	map__det_update(PredTable0, PredId, PredInfo, PredTable),
-	module_info_set_preds(ModuleInfo0, PredTable, ModuleInfo1),
+	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo2),
 
 		% If the determinism of some sub-goals has changed,
 		% then we re-run determinism analysis, because
@@ -439,10 +452,10 @@
 		% the procedure may lead to more efficient code.
 	( DetChanged = yes,	
 		globals__io_get_globals(Globals, IoState0, IoState),
-		det_infer_proc(PredId, ProcId, ModuleInfo1, ModuleInfo,
+		det_infer_proc(PredId, ProcId, ModuleInfo2, ModuleInfo,
 			Globals, _, _, _)
 	; DetChanged = no,
-		ModuleInfo = ModuleInfo1,
+		ModuleInfo = ModuleInfo2,
 		IoState = IoState0
 	).
 
@@ -486,7 +499,8 @@
 
 	InlineInfo0 = inline_info(VarThresh, InlinedProcs, ModuleInfo,
 		HeadTypeParams, Markers,
-		VarSet0, VarTypes0, TypeVarSet0, TypeInfoVarMap0, DetChanged0),
+		VarSet0, VarTypes0, TypeVarSet0, TypeInfoVarMap0,
+		DidInlining0, DetChanged0),
 
 	% should we inline this call?
 	(
@@ -517,6 +531,7 @@
 			% on this proc.
 		goal_info_get_determinism(GoalInfo0, Determinism0),
 		goal_info_get_determinism(GoalInfo, Determinism),
+		DidInlining = yes,
 		( Determinism0 = Determinism ->
 			DetChanged = DetChanged0
 		;
@@ -529,11 +544,13 @@
 		VarTypes = VarTypes0,
 		TypeVarSet = TypeVarSet0,
 		TypeInfoVarMap = TypeInfoVarMap0,
+		DidInlining = DidInlining0,
 		DetChanged = DetChanged0
 	),
 	InlineInfo = inline_info(
 		VarThresh, InlinedProcs, ModuleInfo, HeadTypeParams, Markers,
-		VarSet, VarTypes, TypeVarSet, TypeInfoVarMap, DetChanged).
+		VarSet, VarTypes, TypeVarSet, TypeInfoVarMap, DidInlining,
+		DetChanged).
 
 inlining__inlining_in_goal(generic_call(A, B, C, D) - GoalInfo,
 		generic_call(A, B, C, D) - GoalInfo) --> [].
Index: tests/hard_coded//Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.78
diff -u -r1.78 Mmakefile
--- tests/hard_coded//Mmakefile	2000/02/17 06:38:21	1.78
+++ tests/hard_coded//Mmakefile	2000/03/17 03:57:35
@@ -34,9 +34,9 @@
 	elim_special_pred \
 	existential_bound_tvar \
 	existential_reordering \
-	existential_rtti \
-	existential_type_switch \
-	existential_type_switch_opt \
+#	existential_rtti \
+#	existential_type_switch \
+#	existential_type_switch_opt \
 	existential_types_test \
 	eqv_type_bug \
 	error_func \
@@ -88,7 +88,7 @@
 	quantifier2 \
 	quoting_bug_test \
 	rational_test \
-	record_syntax \
+#	record_syntax \
 	redoip_clobber \
 	relation_test \
 	remove_file \
Index: tests/valid//Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.57
diff -u -r1.57 Mmakefile
--- tests/valid//Mmakefile	2000/02/22 10:56:39	1.57
+++ tests/valid//Mmakefile	2000/03/08 00:01:41
@@ -44,7 +44,7 @@
 	empty_bound_inst_list.m \
 	empty_switch.m \
 	error.m \
-	existential_cons.m \
+#	existential_cons.m \
 	explicit_quant.m \
 	fail_ite.m \
 	followcode_det_problem.m \
-- 
David Overton       Department of Computer Science & Software Engineering
PhD Student         The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159     http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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