[m-rev.] Improved scheduling of solver type initialisation goals

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Sep 27 19:23:02 AEST 2004


On Fri, 24 Sep 2004, Ralph Becket wrote:

> Estimated hours taken: 40
> Branches: main
>
> This change allows the compiler to identify a minimal set of solver type
> variables for which it needs to insert initialisation calls in order to
> achieve a deterministic schedule if one exists.
>
...
> +	% Find a set of vars that, if they were instantiated, might
> +	% lead to a deterministic scheduling of the given goals.
> +	%
> +	% This approximation is fairly crude: it only considers variables as
> +	% being free or non-free, rather than having detailed insts.
> +	%
> +	% XXX Does not completely handle negation, disjunction, if_then_else
> +	% goals, foreign_code, or var/lambda unifications.
> +	%
> +:- pred candidate_init_vars(mode_info::in, list(hlds_goal)::in,
> +		set(prog_var)::in, set(prog_var)::out) is cc_nondet.
> +
> +candidate_init_vars(ModeInfo, Goals, NonFreeVars0, CandidateVars) :-
> +	CandidateVars0 = set__init,
> +	candidate_init_vars_2(ModeInfo, Goals, NonFreeVars0, NonFreeVars1,
> +		CandidateVars0, CandidateVars1),
> +	CandidateVars = set__difference(CandidateVars1, NonFreeVars1).
> +
> +
> +:- pred candidate_init_vars_2(mode_info::in, list(hlds_goal)::in,
> +		set(prog_var)::in, set(prog_var)::out,
> +		set(prog_var)::in, set(prog_var)::out) is nondet.
> +
> +candidate_init_vars_2(ModeInfo, Goals, !NonFree, !CandidateVars) :-
> +	list__foldl2(candidate_init_vars_3(ModeInfo), Goals,
> +		!.NonFree,       !:NonFree,
> +		!.CandidateVars, !:CandidateVars).
> +
Why not just !NonFree and !CandidateVars here?

Other than that, this looks fine.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list