Merged
Conversation
I suspected we were mis-placing locations. We weren't. We were printing them incorrectly in the bytecode dump. Before/after of bytecode dump of a simple test program: ```diff ... 03 JUMP 13 -05 DUP_TOP +05 ykloc: DUP_TOP 06 STORE_FAST 1 07 LOAD_FAST 0 08 LOAD_FAST 1 09 BINARY_OP 14 __iadd__ 10 STORE_FAST 0 11 LOAD_CONST_SMALL_INT 1 -12 ykloc: BINARY_OP 14 __iadd__ +12 BINARY_OP 14 __iadd__ 13 DUP_TOP 14 LOAD_CONST_SMALL_INT 100000 18 BINARY_OP 0 __lt__ 19 POP_JUMP_IF_TRUE 5 ... ``` Note `POP_JUMP_IF_TRUE 5` means "jump to bytecode offset 5 if true". Although it appears as an absolute jump in the dump, in-memory is stored as an ip-relative back-jump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I suspected we were mis-placing locations. We weren't. We were printing them incorrectly in the bytecode dump.
Before/after of bytecode dump of a simple test program:
Note
POP_JUMP_IF_TRUE 5means "jump to bytecode offset 5 if true".Although it appears as an absolute jump in the dump, in-memory is stored as an ip-relative back-jump.