[m-rev.] diff: reset contains_trace_goal if necessary

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Nov 9 15:45:24 AEDT 2006


On Thu, 9 Nov 2006, Peter Schachte wrote:

> On Thu, Nov 09, 2006 at 01:36:39PM +1100, Julien Fischer wrote:
>> The problem is that if q(X) is inlined we get:
>>
>> 	p(X) :-
>> 		trace(...),
>> 		r(X),
>> 		s(X).
>>
>> If r(X) is then determined to be unecessary we are then left with:
>>
>> 	p(X) :-
>> 		trace(...),
>> 		s(X).
>
> This might work better if trace goals were "wrapped around" the
> declarative code they refer to.  Something like
>
> 	trace Params Before Declarative After
>
> would be equivalent to what would currently be written
>
> 	trace Params Before,
> 	Declarative,
> 	trace Params After
>
> except that if Declarative is optimised away, then the trace goals are
> removed, too.
>
> This might be too much of a pain to implement, though, because trace/4
> couldn't just be a higher order predicate, it would have to be
> explicitly handled by all passes over the HLDS.

It's already handled by explicitly all over the HLDS.  trace goals are
a type of scope, they're not implemented as higher-order predicates.

Julien.


More information about the reviews mailing list