Interpreter Refactor#3233
Merged
Merged
Conversation
Member
|
Nice refactor / cleanup! Besides |
Member
|
@florianessl could you attempt to do a rebase? There is one conflict in game_interpreter. |
- Implemented template method "DecodeTargetEvaluationMode". (This logic is shared between ControlVariables, ControlSwitches & ControlStrings but the actual implementation for several special access modes differs between implementations. Support for these modes is evaluated at compile time.) - Moved some common helper functions into a new file "game_interpreter_shared.cpp" (CheckOperator, ValueOrVariable / CommandStringOrVariable & variants) - Refactored "ValueOrVariable" & "ValueOrVariableBitfield" into template methods - Moved some commonly used member function declarations which are needed for certain command argument evaluation methods from Game_Interpreter into a new abstract base class (namespace "Game_Interpreter_Shared" is agnostic to the actual implementation of the interpreter)
… Game_Interpreter_Shared
…d definition of "Game_BaseInterpreterContext" to the bottom of header file
…implicit instantiations here while GCC fails
bcf01e0 to
5e24434
Compare
Ghabry
approved these changes
Jul 31, 2024
Member
|
Would be good to get this one reviewed and in before the event commands because of conflicts. Will run our test game through this to find bugs... |
ghost
approved these changes
Aug 29, 2024
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.
New helper function: "DecodeTargetEvaluationMode"
This should be most of the easier-to-verify-and-merge changes, my "ScopedVars" depends on.
The current draft for ScopedVars also contains some more changes for the "ControlVariables" & "ConditionalBranch" commands, moving all of the operand switching logic into game_interpreter_control_variables.cpp. Basically I reinvented dispatching tables for this, to share this logic between the different new command spin-offs, but I have yet to confirm with benchmarks that this really a good solution. I don't want to slow any of the existing commands down by even a single cycle. :D
https://github.com/florianessl/Player/tree/ScopedVars
Best possible way to implement all this switching would likely be a mix of computed go-tos & tail recursion (see #1919 for the suggestion of implementing computed go-tos; but it´s debatable, if any of these changes would create any speed-ups in current-year & aren't already part of common compiler optimizations.)