[m-dev.] compute_inst_var_sub: inst_matches_initial failed

David Overton dmo at cs.mu.OZ.AU
Sun Oct 15 00:46:31 AEDT 2000


On Sat, Oct 14, 2000 at 06:00:35PM +1100, Fergus Henderson wrote:
> The compiler failed to bootstrap on hg and taifun last night,
> with the following error message when compiling `modes'
> and `unique_modes' in the stage2/compiler directory:
> 
> 	Uncaught exception:
> 	Software Error: compute_inst_var_sub: inst_matches_initial failed
> 	Stack dump not available in this grade.
> 
> This is most likely a result of David Overton's changes to support
> polymorphic insts.  David, could you please investigate this one ASAP,
> and either fix it or back out your changes?

Hi,

This change fixes the immediate problem of the compiler not
bootstrapping with the `--excess-assign' optimisation turned on.

These two modules contained some mode-incorrect code that couldn't be
picked up by the mode checker without alias tracking.

The problem is in situations such as:

	A = B,
	clobber(B),
	use(A)

where
	:- mode clobber(ground -> clobbered).
	:- mode use(in).

The mode checker doesn't know that A and B are aliased so it quite
happily allows us to clobber B and then use A.  However, the excess
assignment optimisation turns this into

	clobber(B),
	use(B)

which the mode checker _can_ detect as a mode error.  Unfortunately,
this is picked up inside `recompute_instmap_delta' which expects the
code to be mode-correct so it aborts.

Obviously this change is only a workaround and does not fix the
underlying problem, but I'm working on that :-)

------------------------------

Estimated hours taken: 2

Fix some mode errors in a couple of uses of the mode_info type.  These
mode errors can't actually be detected by the compiler without alias
tracking, but they cause problems in later compilation phases.  In
particular, the excess assignnment optimisation was producing code
that caused the compiler to abort when recomputing the instmap deltas.

compiler/modes.m:
compiler/unique_modes.m:
	Make sure that at most one version of the mode_info exists at
	any point during compilation.

Index: modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.248
diff -u -r1.248 modes.m
--- modes.m	2000/10/13 13:55:43	1.248
+++ modes.m	2000/10/14 13:10:23
@@ -1155,7 +1155,8 @@
 	{ mode_info_get_call_id(ModeInfo0, PredId, CallId) },
 	mode_info_set_call_context(call(call(CallId))),
 
-	{ mode_info_get_instmap(ModeInfo0, InstMap0) },
+	=(ModeInfo1),
+	{ mode_info_get_instmap(ModeInfo1, InstMap0) },
 	{ DeterminismKnown = no },
 	modecheck_call_pred(PredId, ProcId0, Args0, DeterminismKnown,
 				Mode, Args, ExtraGoals),
Index: unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.66
diff -u -r1.66 unique_modes.m
--- unique_modes.m	2000/10/13 13:56:02	1.66
+++ unique_modes.m	2000/10/14 13:10:27
@@ -398,14 +398,15 @@
 	%
 	{ goal_info_get_nonlocals(GoalInfo0, NonLocals) },
 	{ set__to_sorted_list(NonLocals, NonLocalsList) },
-	=(ModeInfo),
-	{ select_live_vars(NonLocalsList, ModeInfo, LiveNonLocals) },
+	=(ModeInfo0),
+	{ select_live_vars(NonLocalsList, ModeInfo0, LiveNonLocals) },
 	make_var_list_mostly_uniq(LiveNonLocals),
 	%
 	% But nothing is forward-live for the negated goal, since
 	% if the goal succeeds then execution will immediately backtrack.
 	% So we need to set the live variables set to empty here.
 	%
+	=(ModeInfo),
 	{ mode_info_get_live_vars(ModeInfo, LiveVars0) },
 	mode_info_set_live_vars([]),
 	%

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