-
Notifications
You must be signed in to change notification settings - Fork 191
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
Interpreter Refactor #3233
Interpreter Refactor #3233
Conversation
Nice refactor / cleanup! Besides |
@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
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... |
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.)