[m-dev.] for review: fix bug in inter-module optimization

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jan 28 14:48:47 AEDT 2000


On 28-Jan-2000, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> +		% XXX this won't work if the predicate is
> +		% exported to sub-modules.
> +		intermod__add_proc(UserEqPredId, _, Info1, Info2)

Could you explain the XXX comment a bit more?
Why won't it work in that case?

It would be a good idea to add a test case for the
problem that the XXX comment is talking about,
even if we don't pass it yet.

If that XXX is really causing a bug, I think it would
be important to fix the bug.

> +++ intermod_user_equality.m	Fri Jan 28 11:31:27 2000
> @@ -0,0 +1,11 @@
> +:- module intermod_user_equality.
> +
> +:- interface.
> +
> +:- import_module intermod_user_equality2.
> +:- pred check_foo(foo::in) is semidet.
> +
> +:- implementation.
> +
> +check_foo(Foo) :- Foo = Foo.

I suggest you make that

	check_foo(Foo, Bar) :- Foo = Bar.

otherwise the compiler might well optimize away the unification,
rather than generating a call to the user defined equality.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list