[m-rev.] diff: reset contains_trace_goal if necessary
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Nov 9 15:19:47 AEDT 2006
On Thu, 9 Nov 2006, Mark Brown wrote:
> On 06-Nov-2006, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
>> @@ -2657,6 +2670,84 @@
>>
>> %-----------------------------------------------------------------------------%
>>
>> +:- pred goal_contains_trace(hlds_goal::in, hlds_goal::out,
>> + contains_trace_goal::out) is det.
>> +
>> +goal_contains_trace(GoalExpr0 - GoalInfo0, GoalExpr - GoalInfo,
>> + ContainsTrace) :-
>> + (
>
> ...
>
>> + ;
>> + GoalExpr0 = scope(Reason, SubGoal0),
>> + goal_contains_trace(SubGoal0, SubGoal, ContainsTrace),
>> + GoalExpr = scope(Reason, SubGoal)
>
> It appears that this goal feature propagates outside promise_pure scopes.
> I realise this behaviour follows what is in the reference manual, but is
> this really what we want?
>
> I think that a goal which is explicitly promised pure should be able to
> be optimised away even if it contains trace goals, in the same way that
> a pure call can be optimised away even if there are trace goals in its
> definition.
I assume you meant a goal that is promised pure, has no outputs,
terminates and cannot throw exceptions as opposed to just any old
goal that is promised pure? ;-)
> Any comments?
That's what I would have thought as well. Trace goals should not
affect optimizations ... (as much as possible, I realise that some
interactions are probably unavoidable.)
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