[m-rev.] for review: fix another termination analysis bug

Julien Fischer juliensf at students.cs.mu.OZ.AU
Mon Dec 8 13:15:09 AEDT 2003


On Fri, 5 Dec 2003, Fergus Henderson wrote:

> On 05-Dec-2003, Julien Fischer <juliensf at students.cs.mu.OZ.AU> wrote:
> >
> > tests/term/Mmakefile:
> > 	Set the value of the TESTS variable after setting the value of
> > 	PROGS, otherwise the tests will not be run.
>
> The log message is a little bit misleading here.  The real issue is that
> the $(TESTS) variable and the $(PROGS) variable that it refers to need
> to be fully defined before Mmake.common is included.
>
Fixed.  It now reads as follows:

	Make sure the $(TESTS) and $(PROGS) variables are fully defined
	before Mmake.common is included, otherwise the tests will not
	run.

> > +++ compiler/term_norm.m	5 Dec 2003 02:38:09 -0000
> > @@ -146,26 +146,23 @@
> >  :- pred find_weights_for_cons(type_ctor::in, list(type_param)::in,
> >  	constructor::in, weight_table::in, weight_table::out) is det.
> >
> > -% XXX Currently, the weight of a functor is not affected by the presence
> > -% of any arguments that are type_info related.  However, the set of
> > -% arguments whose sizes should be counted towards the total size of
> > -% the term will include any type-info related arguments.
> > +% For existentially typed data items the compiler may insert some
> > +% type-info related arguments into the functor.  As these have zero-size
> > +% they are not counted towards the weight of the functor.
>
> The type-info related arguments do not necessarily have zero size,
> or even bounded size.  So this comment is not correct.
>

Strictly speaking that is true but for termination analysis
(and term-size profiling) they are treated as though they have
zero size even if they do not.

Actually, thinking about this a bit more there are really two
issues here.

(1) Do we include type-info related arguments in the weight of a functor?

This should not matter so long as it is consistent.  However, we've never
included them in the past and for consistency with below I'd argue that
we do not count them.

(2) Do we include type-info related arguments in the list of counted
    arguments?

Since they are treated as having zero size they aren't actually going
to count for anything and it makes the implementation easier if they
are not present in weight table.

I'll change that last comment so it reads as follows:

	For existentially typed data items the compiler may insert some
	type-info related arguments into the functor.  We ignore these
	arguments when calculating the weight of a functor and we do not
	include them in the list of counted arguments.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list