[m-rev.] for review: fix mantis bug #42

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Jun 11 19:36:50 AEST 2008


On Wed, 11 Jun 2008, Peter Wang wrote:

> Pending bootcheck.
>
> Estimated hours taken: 1
> Branches: main
>
> Fix Mantis bug #42.  --optimize-constructor-last-call wouldn't work together
> with --no-inline-builtins (or more commonly, --no-inlining).
>
> We didn't generate a valid definition for `private_builtin.store_at_ref': the
> procedure existed but had an empty body.  With `--no-inlining-builtins' the
> calls to `store_at_ref' introduced by the LCMC that would normally be replaced
> by inline code would go to the out-of-line procedure, which did nothing.

Hmmmm, ... it took me a while to see why that works.

> compiler/add_pred.m:
> 	Allow `add_builtin' to generate a body for `store_at_ref'.
> 	(builtin_compound_eq/builtin_compound_lt may require the same
> 	treatment for Erlang backend; I haven't tested.)
>
> tests/hard_coded/Mercury.options:
> tests/hard_coded/Mmakefile:
> tests/hard_coded/lco_no_inline.exp:
> tests/hard_coded/lco_no_inline.m:
> 	Add a test case.
>
> Index: compiler/add_pred.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pred.m,v
> retrieving revision 1.33
> diff -u -r1.33 add_pred.m
> --- compiler/add_pred.m	23 Nov 2007 07:34:53 -0000	1.33
> +++ compiler/add_pred.m	11 Jun 2008 06:13:13 -0000
> @@ -243,21 +243,15 @@
>     goal_info_set_nonlocals(NonLocals, GoalInfo0, GoalInfo),
>     (
>         Module = mercury_private_builtin_module,
> -        (
> -            Name = "store_at_ref",
> -            StubPrime = no
> -        ;
> -            ( Name = "builtin_compound_eq"
> -            ; Name = "builtin_compound_lt"
> -            ),
> -            StubPrime = yes
> +        ( Name = "builtin_compound_eq"
> +        ; Name = "builtin_compound_lt"
>         )
>     ->
>         GoalExpr = conj(plain_conj, []),
>         ExtraVars = [],
>         ExtraTypes = [],
>         VarSet = VarSet0,
> -        Stub = StubPrime
> +        Stub = yes
>     ;
>         Module = mercury_private_builtin_module,
>         Name = "trace_get_io_state"
> Index: tests/hard_coded/Mercury.options
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mercury.options,v
> retrieving revision 1.34
> diff -u -r1.34 Mercury.options
> --- tests/hard_coded/Mercury.options	22 May 2008 04:11:29 -0000	1.34
> +++ tests/hard_coded/Mercury.options	11 Jun 2008 06:23:27 -0000
> @@ -37,6 +37,7 @@
> MCFLAGS-intermod_type_qual2 =	--intermodule-optimization
> MCFLAGS-intermod_multimode =	--intermodule-optimization
> MCFLAGS-intermod_multimode_main = --intermodule-optimization
> +MCFLAGS-lco_no_inline	    =	--optimize-constructor-last-call --no-inline-builtins

Is --common-struct still masking this bug?  If so you should also
compile it with --no-common-struct.

The diff looks okay otherwise.

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