[m-dev.] for review: fix for a bug reported by Warwick

Warwick Harvey wharvey at cs.monash.edu.au
Thu Jan 27 17:10:23 AEDT 2000


Zoltan wrote:
> > Unfortunately, it doesn't quite work.  It appears (at least in some cases) 
> > to restore the stack pointer and before testing the saved value of 
> > `MR_trace_from_full', which means it's looking in the wrong part of the 
> > stack, and hence sometimes making the wrong choice.
> 
> Yes, you are right. However, it seems to me that the problems you point out
> in the rest of the review fully account for this behavior, and so the obvious
> fix "should" work. I am attaching the full modified diff for you to test.

Yes, this appears to have fixed that problem, and it appears to work, at 
least on the examples I've tried so far.  However, looking closer I think 
there're still problems.  :-(

Assuming that the save/restore of the ticket counter is so that the tracing 
code doesn't interfere with the "real" code, surely the restore should be 
immediately after the tracing code, not at the end of the predicate?  
Currently it seems to save it before the "call" tracing code is executed, 
and restore it after the "exit/fail/whatever" tracing code is executed.  
This means it could be wrong during the execution of the body of the 
predicate, right?

The counter also seems to be being incremented more often than necessary, 
but the above could easily account for (all of) that.

Also, in my struggle to understand all this tracing stuff, I am wondering 
why in shallow-traced code, when `MR_trace_from_full' is FALSE, MR_trace() 
is still called.  My understanding is no events should be generated in this 
case?  Or is the call to MR_trace() "harmless" here?  Presumably also one 
could optimise the code for predicates which aren't exported when using 
shallow tracing, because they can't possibly be called from deep-traced 
code?  (Or can they, through intermodule optimisation?)

Warwick

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