[m-rev.] for review: allow inlining of java foreign_procs

Julien Fischer juliensf at csse.unimelb.edu.au
Thu May 6 13:24:46 AEST 2010


On Thu, 6 May 2010, Peter Wang wrote:

> Branches: main, 10.04
>
> Allow inlining of Java foreign_procs.
>
> This revealed a problem with directly using the `succeeded' flag directly as
> the success indicator in Java foreign_procs.  When the code of the foreign_proc
> becomes a nested function, and after nested functions are eliminated, there may
> not be a variable called `succeeded' in that context; it is moved into
> environment struct, and the transformation is not able to update handwritten
> code to reflect that.  The solution is to declare a local variable for the
> foreign_proc, let the handwritten code assign that, then assign its final
> value to the `succeeded' flag with an MLDS statement.
>
> We take the opportunity to name the local variable `SUCCESS_INDICATOR', in
> line with other backends.
>
> compiler/inlining.m:
>        Allow inlining of Java foreign_procs.
>
> compiler/ml_foreign_proc_gen.m:
>        In the code generated for semidet Java foreign_procs, declare a local
>        `SUCCESS_INDICATOR' variable and assign its value to the `succeeded'
>        flag afterwards.
>
>        Add braces to give the foreign_proc variables a limited scope.
>
> doc/reference_manual.texi:
>        Update documentation for the renaming of the `succeeded' variable.

You will also need to update the code in make_hlds_warn.m that handles
--warn-suspicious-foreign-procs for the java grade.

The rest looks ok.

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