[squeak-dev] Context >> #quickStep broken on non-local returns?

cmfcmf cmfcmf.flach at gmail.com
Wed Oct 21 12:21:08 UTC 2020


Hi,

I am playing around with the simulator (e.g., Context class >> #trace:). To
make the simulation faster, I'd like to quick-step some message sends.
However, I noticed that quick-stepping doesn't work as intended if a
quick-stepped send executes a non-local return. 

Given the following method:



Running this method in the simulator using repeated calls to Context >>
#step for all non-send-bytecodes and Context >> #quickStep for all send
bytecodes works fine except when quick-stepping the send of at:ifPresent:
The context returned by quickstepping this send has an empty stack, whereas
I would expect the return value of 84 on top of the stack.

The root cause, as far as I can see, is Context >>
#quickSend:to:with:lookupIn:, which seems to make assumptions in its
ifCurtailed: block that appear to not (or no longer) hold true. [1]

I have attached a ContextTest class that includes the example method shown
above and a failing test. 

Note that the debugger does _not_ appear to use the Context >> #quickStep
mechanism when using the "over" button (in fact, the quickStep method does
not appear to be used at all). The debugger uses a different technique,
namely Context >> #runUntilErrorOrReturnFrom: (Debugger >> #doStep ->
Process >> #completeStep: -> Process >> #complete: -> Context >>
#runUntilErrorOrReturnFrom:).

I observed the behavior in a fresh Squeak 5.3 image.

Best
Christian

ContextTest.st <http://forum.world.st/file/t372201/ContextTest.st>  

[1] Below, I have annotated the ifCurtailed: block of Context >>
#quickSend:to:with:lookupIn: with my understanding of what it is trying to
do and where it goes wrong:


------

I have already tried some things to fix the ifCurtailed: block in Context >>
#quickSend:to:with:lookupIn:, but I'm not sure if that's entirely correct
either. However, it at least passes the test.





--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list