[m-dev.] diff: fix aborts during deforestation
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Sep 4 12:59:56 AEDT 2000
On 01-Sep-2000, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
>
>
> Estimated hours taken: 2
>
> Fix bugs which caused compilation of Tom Conway's XML parser
> to fail during deforestation.
>
> compiler/inlining.m:
> If some of the output variables of an inlined call are not
> used by the caller, run quantification on the goal
> to push that information into the inlined goal.
That one is not a bug as such, because it is OK for the
non-locals field to be a superset of the true non-locals.
That should just be an optimization issue.
If you leave that change out, does anything break?
(If so, that other thing should be fixed.)
> Index: compiler/inlining.m
> @@ -558,7 +587,7 @@
>
> %-----------------------------------------------------------------------------%
>
> -inlining__do_inline_call(HeadTypeParams, ArgVars, PredInfo, ProcInfo,
> +inlining__do_inline_call(_, ArgVars, PredInfo, ProcInfo,
> VarSet0, VarSet, VarTypes0, VarTypes, TypeVarSet0, TypeVarSet,
> TypeInfoVarMap0, TypeInfoVarMap, Goal) :-
>
> @@ -610,6 +639,12 @@
> map__apply_to_list(ArgVars, VarTypes0, ArgTypes),
>
> pred_info_get_exist_quant_tvars(PredInfo, CalleeExistQVars),
> +
> + % Typechecking has already succeeded, so we don't need
> + % to check for binding of head type parameters.
> + % Also, existentially-typed head type parameters
> + % may be bound by inlining.
> + HeadTypeParams = [],
> inlining__get_type_substitution(HeadTypes, ArgTypes, HeadTypeParams,
> CalleeExistQVars, TypeSubn),
>
The log message didn't mention that change.
> Index: compiler/modes.m
> +compute_goal_instmap_delta(InstMap0, Goal,
> + GoalInfo0, GoalInfo, ModeInfo0, ModeInfo) :-
> + ( Goal = conj([]) ->
> + instmap_delta_init_reachable(DeltaInstMap),
> + mode_info_set_instmap(InstMap0, ModeInfo0, ModeInfo)
> + ;
> + mode_info_get_completed_nonlocals(GoalInfo0, NonLocals,
> + ModeInfo0, ModeInfo),
> + mode_info_get_instmap(ModeInfo, InstMap),
> + compute_instmap_delta(InstMap0, InstMap,
> + NonLocals, DeltaInstMap)
> + ),
> goal_info_set_instmap_delta(GoalInfo0, DeltaInstMap, GoalInfo).
It would be helpful to have a comment here explaining why `conj([])'
needs to be treated specially.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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