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

Refactor Interpreter Stack Frame Completion #1884

Merged
merged 2 commits into from
Sep 17, 2019

Conversation

fmatthew5876
Copy link
Contributor

@fmatthew5876 fmatthew5876 commented Aug 29, 2019

Fix: #1871

This should also fix: #1764 once we solve #1883

Supercedes #1879 If we merge this we don't need that one.

  • Rename CommandEnd() to OnFinishStackFrame()

This name and it's nearby comment was very misleading. The
interpreter has actually always ignored CommandEnd commands.
This function was only called when the index ran past end of the stack
frame.

  • Do OnFinishStackFrame() before execution loop.

Call this in one place and handle multiple stack pops. Also,
don't hang on empty events.

  • Optimize parallel events

Reset the index and never pop the base stack frame. RPG_RT
does this and we avoid copying parallel event data every frame.

RPG_RT will always create a stack frame for parallel events,
even if they are empty.

@fdelapena fdelapena added this to the 0.6.2 milestone Aug 29, 2019
@fdelapena fdelapena added the Performance Related to improvements on memory, less CPU or disk usage, battery savings, etc. label Aug 29, 2019
@fmatthew5876 fmatthew5876 force-pushed the event_stack branch 3 times, most recently from 0ed1841 to 79b6ab0 Compare August 29, 2019 03:43
@fmatthew5876
Copy link
Contributor Author

Rebased and added a very minor optimization when we check if parallel event can execute.

* Rename CommandEnd() to OnFinishStackFrame()

This name and it's nearby comment was very misleading. The
interpreter has actually always ignored CommandEnd commands.
This function was only called when the index ran past end of the stack
frame.

* Do OnFinishStackFrame() before execution loop.

Call this in one place and handle multiple stack pops. Also,
don't hang on empty events.

* Optimize parallel events

Reset the index and never pop the base stack frame. RPG_RT
does this and we avoid copying parallel event data every frame.
RPG_RT save games always have an empty base stack frame allocated
for parallel map events and common events.

We add these to our saves to be compatible, however if we have empty
data, we won't create an interpreter object or load any data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Event/Interpreter Performance Related to improvements on memory, less CPU or disk usage, battery savings, etc. Refactor
Development

Successfully merging this pull request may close these issues.

Verify how stack is cleared on event finish Performance: Improve interpreter setup
3 participants