[squeak-dev] Bug in Process>>#terminate | Returning from unwind contexts
Jaromir Matas
m at jaromir.net
Tue Mar 9 09:54:02 UTC 2021
Hi Christopher,
I've just been wondering what that part of #terminate was for... Thanks for
the answer :)
I tried a recursive version of your example and it behaves even worse:
[self error: 'x1'] ensure: [[self error: 'x2'] ensure: [[[[self error:
'x3'] ensure: [^2]] ensure: [^2]] ensure: [^2]]]
And this one's bad too - hit Abandon and you get the unwind error right
away:
[self error] ensure: [1/0]
After your fix/workaround they miraculously seem to behave again :)
A question: why not simply `ctxt restart`? Without assigning to
suspendedContext. Like this:
#terminate
"... lots of code"
ctxt := self popTo: suspendedContext bottomContext.
ctxt == suspendedContext bottomContext ifFalse:
>>> [ctxt restart.
"self debug: ctxt title: 'Unwind error during termination'"].
"Set the context to its endPC for the benefit of isTerminated."
ctxt pc: ctxt endPC]
And finally, I noticed #valueUninterruptably uses return from an unwind
context as well and it doesn't seem to function properly due to the bug (ok
after your fix):
[1/0] valueUninterruptably
First doit generates ZeroDivide, hit Abandon and the next doit shows unwind
error but Proceed will just end the process (I'd expect another ZeroDivide -
am I right?)
#valueUninterruptably
"Prevent remote returns from escaping the sender. Even attempts to
terminate (unwind) this process will be halted and the process will resume
here. A terminate message is needed for every one of these in the sender
chain to get the entire process unwound."
^ self ifCurtailed: [^ self]
Besides #isTerminated I've been trying to refactor #terminate and
#newProcess to avoid 'cannot return' errors and unify different kinds of
termination (active process termination and suspended process termination).
I've sent it to the Inbox for discussion - see here:
http://forum.world.st/The-Inbox-Kernel-jar-1380-mcz-td5127524.html
Thanks,
-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html
More information about the Squeak-dev
mailing list
|