[m-rev.] diff: reset contains_trace_goal if necessary
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Nov 9 13:36:39 AEDT 2006
On Thu, 9 Nov 2006, Mark Brown wrote:
> On 08-Nov-2006, Peter Ross <pro at missioncriticalit.com> wrote:
>> Imagine we have a program.
>>
>> p(X) :-
>> q(X),
>> s(X).
>>
>> q(X) :-
>> trace(..),
>> r(X).
>>
>> Now imagine the compiler determines q(X) and r(X) don't actually need
>> to be called.
>> The behaviour of the program with respect to the trace goals will
>> depend on whether or not inlining is done before or after unnecessary
>> code removal.
>
> According to the reference manual (last paragraph of sec 16) the call
> to q/1 can be optimized away. The presence of the trace goal in the
> clause for q/1 shouldn't hinder this optimization.
That's not what Peter is saying though is it? 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).
The problem is that we now have what is essentially a dangling trace goal,
e.g. it does not relate to any of the remaining code.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list