[m-rev.] for review: support nondet code in Erlang backend
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu May 17 12:48:52 AEST 2007
On Thu, 17 May 2007, Peter Wang wrote:
> Estimated hours taken: 25
> Branches: main
>
> Add support for nondet code in the Erlang backend. Nondet procedures are
> supplied a success continuation as an extra argument, which is called for each
> solution.
>
> compiler/elds.m:
> Extend the ELDS with calls to Erlang builtins, and `try' and `throw'
> statements. These are used to implement commits.
>
> Add some comments.
>
> compiler/elds_to_erlang.m:
> Handle additions to the ELDS (builtins, try, throw).
>
> When writing `-export' annotations in .erl files, take into account
> that nondet procedures need an extra argument.
>
> Print the module name as an atom so it is quoted if necessary.
>
> Don't output `begin', `end' keywords in the generated code unless
> strictly necessary.
>
> Other cosmetic improvements to the generated code.
>
> compiler/erl_call_gen.m:
> Handle plain and higher-order calls to nondet procedures.
>
> compiler/erl_code_gen.m:
> Support nondet code and commits.
>
> Improve the generated code for switches. Previously we simply
> duplicated the success expression (the code that must be evaluated
> after the switch succeeds) directly into each branch of the switch.
> This leads to exponentially large output if switches follow one another.
> We avoid that by estimating the "size" of the success expression, and
> storing that once in a closure if it is too big. Then each branch of
> the case statement only calls the closure on success.
>
> compiler/erl_code_util.m:
> Replace `erl_gen_info_new_var' by `erl_gen_info_new_named_var'. The
> generated code is easier to read if introduced variables are named.
>
> Add `erl_expr_size', used to estimate the size of an ELDS expression.
>
> Conform to additions to the ELDS.
>
> compiler/erl_unify_gen.m:
> When creating closure expressions, take into account the extra argument
> for nondet procedures.
>
> Conform to some changes from above.
I've had a quick look at this and it seems okay.
Julien.
--------------------------------------------------------------------------
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