Skip to content

Conversation

@adri09070
Copy link
Collaborator

Fixes #23
The old version of skipAssignment systematically popped the value that was going to be assigned, which is right. However, the assignments whose result are used in the next instruction, use a storeInto bytecode instead of a popInto bytecode. In this case, the assigned value is not popped from the stack. As a consequence, skip should push a value on the stack, as a replacement for the assignment result.

To detect if we have a storeInto buytecode, I check the number of the current bytecode, which is the first byte of the bytecode, and I compare it to those corresponding to storeInto bytecode (I looked them up in InstructionStream >> interpretXXX methods).

If the current bytecode is a storeInto, I push the value of the variable that was going to be assigned as a replacement, because it keeps the same value before and after the assignment is skipped.

I also added a test to cover these tricky situations that manipulate both popInto and storeInto bytecode

adri09070 added 2 commits June 2, 2022 15:51
…value is pushed on the top of the stack only when a storeInto bytecode is involved
@adri09070
Copy link
Collaborator Author

All 6 PRs can now be merged

@StevenCostiou StevenCostiou merged commit ac665c0 into pharo-spec:master Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip command causes a missing value on the stack, when storeInto bytecodes are involved

2 participants