[m-dev.] [reuse] diff: remove --no-static-ground-terms constraint on reuse

Peter Ross petdr at miscrit.be
Wed Oct 18 04:45:18 AEDT 2000


On Wed, Oct 18, 2000 at 04:23:04AM +1100, Fergus Henderson wrote:
> On 17-Oct-2000, Peter Ross <petdr at miscrit.be> wrote:
> > Remove the constraint the --infer-structure-reuse implies
> > --no-static-ground-terms.
> > 
> > handle_options.m:
> >     --infer-structure-reuse no longer implies --no-static-ground-terms.
> >     
> > mercury_compile.m:
> >     Call mark static ground terms before calling structure reuse phase
> >     so that we know which variables are constructed static.
> >
> > sr_data.m:
> >     We cannot reuse a variable which was constructed statically.
> > 
> > sr_indirect.m:
> >     Keep track of which variables are constructed statically.
> 
> Does this handle variables which are constructed statically
> in a procedure then reused in a different procedure?
> 
No it doesn't, aaargh!  You just need to mark which outputs of a
procedure are constructed statically.  Not to difficult to do.

> E.g.
> 
> 	:- type f ---> f(int).
> 
> 	:- pred foo(f::uo).
> 	:- pragma no_inline(foo/1).
> 	foo(f(42)).
> 
> 	:- pred bar(f::di, f::uo).
> 	bar(Y, X) :-
> 		Y = f(A),
> 		X = f(A + 1).	% reuse Y
> 
> 	:- pred baz(f::uo).
> 	baz(Y) :-
> 		foo(X),
> 		bar(X, Y).
> 
> Also what if the procedures are different modules?
> Will it handle that case correctly?
> 
No you will need to introduce some sort of pragma which informs which
outputs of a call are constructed statically, and write that into the
trans_opt file.

Pete
--------------------------------------------------------------------------
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