On 12/19/23 08:01, Waldek Hebisch wrote:

Well, original had:

   while savedTimerStack ^= $timedNameStack repeat
     stopTimingProcess peekTimedName()

'stopTimingProcess' calls 'updateTimedName' which was/is needed
to update counters.  IIUC without this statistics will be wrong
(time will be "charged" to different use).

'stopTimingProcess' will run only when exceptions are thrown and
catched.  In this case, stats are already messed up.

Waldek, what's your opinion on fixing this bug?

AFAICS loop here and in interpretTopLevel where right.  I am not
sure if the loop is really necessary, but we need to do proper
accounting and the loop is "obviously correct" way of doing this.
Another approach may easily get broken by changes.

IMO proper fix for this bug involves making sure that we always
have valid '$timedNameStack' and that it is in sync with other
variables.  One way to ensure this is doing "push" on init,
instead of assignment.


OK, to recap on this problem:

We need to make sure '$timedNameStack' is valid.

'$timedNameStack' can be messed up in two cases:

1. recursion
2. thrown and catch exceptions

For 1, correct way is to use dynamic bindings.
For 2, I believe simple assignment is enough.  Or keep current
code if we fix problem 1.

- Qian

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/28051a0b-501e-4502-bb2e-3a52a42a045a%40gmail.com.

Reply via email to