[Cuis-dev] A bug in Context Part>>contextEnsure:

Jaromir Matas mail at jaromir.net
Tue Jan 24 08:01:56 PST 2023


Hi Juan,
Here’s a fix of a nasty bug in Context Part>>contextEnsure:

It shows while debugging or stepping; try this sequence that would get you right before the bug:

p _ [ContextPart contextEnsure: [42]] newProcess.
[p suspendedContext selectorToSendOrSelf = #jump] whileFalse: [p step].
[p suspendedContext selectorToSendOrSelf = #privSender:] whileFalse: [p step].
3 timesRepeat: [p stepToCallee].
p step.
p suspendedContext explore.
p suspendedContext method inspect.

Please notice that the suspendedContext only has stackp=2 and hence the next instruction will fail in the next step:

p step

The root cause is contextEnsure: mistakenly treats ctxt as a top context (i.e. one that has a return value already at the top of the stack); the fix is trivial: add a fake return value – see enclosed.

Best,

--

Jaromír Matas

mail at jaromir.net


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230124/340b031c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ContextPart class-contextEnsure.st
Type: application/octet-stream
Size: 601 bytes
Desc: ContextPart class-contextEnsure.st
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230124/340b031c/attachment-0001.obj>


More information about the Cuis-dev mailing list