[m-dev.] ground->clobbered argument modes
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Aug 6 14:27:52 AEST 1999
On 06-Aug-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
>
> > According to this analysis, the code for sc_get/3 is OK;
> > the mode checker should allow that. Instead, the uncaught mode error
> > in this module is in the call to sc_set/3 in sc2/4; this code should
> > be illegal because sc2/4 calls sc_set/3 with an argument which is still
> > (in part) live, even though the final inst is `clobbered'.
> > When checking if a variable is live, mode analysis needs to also check whether
> > any of the variables that it (or any part of it) is aliased to are live.
>
> sc1(A, B, Foo0, Foo) :-
> sc_get(B::out, Foo0::(ground->clobbered), Foo1::out),
> sc_set(A::in, Foo1::(ground->clobbered), Foo::out).
>
> How does the mode checker know that `B' is aliased to part of
> `Foo1' before inlining?
Well, it doesn't know that `B' _is_ aliased to part of `Foo1',
but it knows that `B' _might be_ aliased to part of `Foo1',
since neither `B' nor `Foo1' have unique insts.
If mode analysis sees a call to a predicate where the inst of the variable
being passed to that call is not unique, then it should set the `is_live'
value for that variable to `yes'; if the predicate has mode `... -> clobbered',
then any call to that predicate where the argument's inst before the call
is not unique should result in a mode error.
(The relevant code here is in modecheck_var_is_live/4.)
--
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