Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/jump_painc #433

Merged
merged 1 commit into from
Dec 5, 2023
Merged

fix/jump_painc #433

merged 1 commit into from
Dec 5, 2023

Conversation

wlxwlxwlx
Copy link
Contributor

[OpJumpFalse, OpAndJump, OpOrJump, OpJump], these four instructions have been changed to use 4 bytes to avoid precision loss and panic when the number of instructions exceeds the maximum of 16 bits (65535)

…ave been changed to use 4 bytes to avoid precision loss and panic when the number of instructions exceeds the maximum of 16 bits (65535)
Copy link
Collaborator

@geseq geseq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@geseq geseq merged commit 18424de into d5:master Dec 5, 2023
geseq added a commit that referenced this pull request Dec 5, 2023
…ctions have been changed to use 4 bytes to avoid precision loss and panic when the number of instructions exceeds the maximum of 16 bits (65535) (#433)"

This reverts commit 18424de.
@geseq
Copy link
Collaborator

geseq commented Dec 5, 2023

Tests don't seem to be passing. Reverting for now....

@wlxwlxwlx can you look into the cause please?

geseq added a commit that referenced this pull request Dec 5, 2023
…ctions have been changed to use 4 bytes to avoid precision loss and panic when the number of instructions exceeds the maximum of 16 bits (65535) (#433)" (#436)

This reverts commit 18424de.
@wlxwlxwlx
Copy link
Contributor Author

Can you send me the test cases that failed? Let me see what the problem is.

@geseq
Copy link
Collaborator

geseq commented Dec 18, 2023

@wlxwlxwlx
Copy link
Contributor Author

If true {10}; 3333 An error was reported while executing this test case, and I tracked the code. On line 269 of compiler.go.

When [OpJumpFalse, OpAndJump, OpOrJump, OpJump] is changed to int32, each instruction becomes 4 bits (previously 2 bits), so when executing curPos:=len (c. currentInstructions()), curPos becomes 10 instead of 8. All subsequent test cases, as long as these 4 instructions are used, the value of curPos will be larger than before (the difference between the values of curPos in the fix/jump and master branches must be a multiple of 2). Therefore, if this pr is merged, the test cases need to be updated. I submitted an updated PR, please take a look.
#438

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.

2 participants