[m-rev.] for post-commit review: Reorder independant parallel conjunctions.

Peter Wang novalazy at gmail.com
Tue Jan 12 11:27:29 AEDT 2010


On 2010-01-11, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> 
> Re-order independent parallel conjunctions to prevent a pathological case of
> memory usage.

> +:- pred reorder_indep_par_conj_2(list(pred_proc_id)::in, vartypes::in,
> +    instmap::in, hlds_goals::in, hlds_goals::out, 
> +    module_info::in, module_info::out) is det.
> +
> +reorder_indep_par_conj_2(_, _, _, [], [], !ModuleInfo).
> +reorder_indep_par_conj_2(SCC, VarTypes, InstMapBefore, [ Goal | Goals0 ],
> +        Goals, !ModuleInfo) :-

The standard style is "[Goal | Goals0]".

> +search_scc(SCCs, PredProcId, SCC) :-
> +    % There should not be more than one solution here.  Operationally the
> +    % search stops after finding the first solution.
> +    promise_equivalent_solutions [SCC]
> +    (
> +        member(SCCPrime, SCCs),
> +        member(PredProcId, SCCPrime)
> +    ->
> +        SCC = SCCPrime
> +    ;
> +        unexpected(this_file, "Couldn't find SCC for pred/proc id.")
> +    ).

The opening bracket goes on the same line as promise_equivalent_solutions.

Should be a useful change.  I could never remember which parallel
conjunct would be certain to use the original context.  Of course the
user shouldn't need to know.

Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list