[m-rev.] for review: handling of unused arguments in ml_gen_wrapper_arg_lvals

Peter Wang novalazy at gmail.com
Fri May 22 17:01:17 AEST 2009

2009/5/22 Julien Fischer <juliensf at csse.unimelb.edu.au>:
> On Fri, 22 May 2009, Peter Wang wrote:
>> Bootchecked in hlc.gc.
> Did you try the buggy code with the C-backend before?


> Do you know why it worked and the Java version didn't?

It aborts in the Java backend here:

        Results = [_, _ | _],
        FuncInfo = func_info(FuncName, Params),
        Params = mlds_func_params(_Args, ReturnTypes),
        TypesAndResults = assoc_list.from_corresponding_lists(
            ReturnTypes, Results),
        io.write_string("return new java.lang.Object[] {\n", !IO),

where ReturnTypes contains only the type for the `out' variable,
but Results contains both the `unused' and `out' variables.

In the high level C backend output variables are passed by reference
instead of by value, so it doesn't do something similar.
The generated code isn't affect by the patch either.

> What happens in hl.gc?

Works there too.

Browsing the change history a bit, I see that the offending code was
originally written as an if-then-else before being converted to a switch.
My guess is that originally the top_unused possibility didn't exist
and the code didn't get updated when top_unused was added,
or it was just overlooked.

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