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 rerun bug #340

Merged
merged 2 commits into from
Sep 8, 2024
Merged

Fix rerun bug #340

merged 2 commits into from
Sep 8, 2024

Conversation

xypwn
Copy link
Contributor

@xypwn xypwn commented Sep 7, 2024

[Following text is same as commit message]

First found when using rye-ebitengine.

Under certain circumstances, this happens when a Rye program calls a native binding, which internally calls a Rye function as a callback.

I'm still not 100% sure how the bug came to be, but here's my theory: Calls to CallFunctionArgsN are nested, meaning we need to build something like a "call stack" to keep track of the "program counter" (here ps.Ser.pos). It is the job of psX to act as the "inner stack frame". Previously, ps was used, which would just override the "outer stack frame's" program counter, causing it to set to position 0, i.e. re-running the program from the start.

First found when using rye-ebitengine.

Under certain circumstances, this happens when a Rye program calls a native binding, which internally calls a Rye function as a callback.

I'm still not 100% sure how the bug came to be, but here's my theory: Calls to CallFunctionArgsN are nested, meaning we need to build something like a "call stack" to keep track of the "program counter" (here ps.Ser.pos). It is the job of psX to act as the "inner stack frame". Previously, ps was used, which would just override the "outer stack frame's" program counter, causing it to set to position 0, i.e. re-running the program from the start.
@refaktor
Copy link
Owner

refaktor commented Sep 8, 2024

Uh, wow ... good for you for spotting that ... it's looks hard to notice! That is certainly a bug. We created psX in which function is evaluated, and there is no sense on setting the position of parent program state to zero yes!

And it would make sense that this would result in an ususual behaviour of starting again on end ... thanks for this fix!

@refaktor refaktor merged commit 816bc14 into refaktor:main Sep 8, 2024
8 checks passed
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