[m-dev.] for review: --delay-constructs
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Mar 8 19:12:56 AEDT 2001
On Thu, Mar 08, 2001 at 06:10:08PM +1100, Zoltan Somogyi wrote:
> For review by anyone. This optimization compensates for the lack of
> construction delays in the eager code generator. On tests/benchmark/query,
> the eager code generator used to take a lot longer than the lazy code
> generator; this optimization makes them equally fast.
> Index: compiler/delay_construct.m
> ===================================================================
> + Goal0 = GoalExpr0 - GoalInfo0,
> + delay_construct_skippable_expr(GoalExpr0),
> + goal_info_get_nonlocals(GoalInfo0, NonLocals),
> + proc_info_maybe_complete_with_typeinfo_vars(NonLocals,
> + DelayInfo ^ body_typeinfo_liveness,
> + DelayInfo ^ vartypes,
> + DelayInfo ^ type_info_varmap, CompletedNonLocals),
> + set__intersect(CompletedNonLocals, ConstructedVars0,
> + Intersection),
> + set__empty(Intersection),
> + \+ goal_info_has_feature(GoalInfo0, impure),
> + \+ goal_info_has_feature(GoalInfo0, semipure)
> + ->
> + delay_construct_in_conj(Goals0, DelayInfo, ConstructedVars0,
> + RevDelayedGoals0, Goals1),
> + Goals = [Goal0 | Goals1]
> + ;
> + list__reverse(RevDelayedGoals0, DelayedGoals),
> + delay_construct_in_conj(Goals0, DelayInfo, set__init, [],
> + Goals1),
> + list__append(DelayedGoals, [Goal0 | Goals1], Goals)
> + ).
This might cause problems with code such as:
:- type t ---> f(int, int).
:- pred p(t::in, t::out) is semidet.
p(X, Y) :-
% construction, A -> free, B -> free, Y -> f(free, free).
Y = f(A, B),
% deconstruction, A -> ground, B -> ground, Y -> ground.
X = f(A, B),
A > 1.
You probably need to recompute the instmap_deltas in cases like this.
Simon.
--------------------------------------------------------------------------
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