[Vm-dev] Question about process preemption during longJump

Igor Stasenko siguctua at gmail.com
Tue Apr 16 15:47:51 UTC 2013

I don't know the answer to your question, Guille, but i'd like to
propose a practice for all VM developers:
- every time the question like that arises, the code should be
factored out into separate method
and commented with corresponding comment, to make clear the intent and
serve as a documentation.

Like in this case:

localSP < stackLimit

could be

self checkThatLocalSPIsXYZ

On 16 April 2013 17:27, Guillermo Polito <guillermopolito at gmail.com> wrote:
> Hi! I'm looking at some code from StackInterpreter, and the given piece of code raised a question I cannot fully answer:
> longUnconditionalJump
> | offset |
> offset := (((currentBytecode bitAnd: 7) - 4) * 256) + self fetchByte.
> localIP := localIP + offset.
> (offset < 0 "backward jump means we're in a loop; check for possible interrupts"
> and: [localSP < stackLimit]) ifTrue:
> [self externalizeIPandSP.
> self checkForEventsMayContextSwitch: true.
> self browserPluginReturnIfNeeded.
> self internalizeIPandSP].
> self fetchNextBytecode
> What does the (localSP < stackLimit) condition stand for? What is its intention when deciding to make (or not) a context switch?
> Tx,
> Guille

Best regards,
Igor Stasenko.

More information about the Vm-dev mailing list