Refactoring Interpreter.cpp to reduce its size and improve maintainability.
Create a new directory src/core/instructions/ to house opcode implementations.
src/core/instructions/Instructions_Constants.cppsrc/core/instructions/Instructions_Loads.cppsrc/core/instructions/Instructions_Stores.cppsrc/core/instructions/Instructions_Stack.cppsrc/core/instructions/Instructions_Math.cppsrc/core/instructions/Instructions_Conversions.cppsrc/core/instructions/Instructions_Comparisons.cppsrc/core/instructions/Instructions_Control.cppsrc/core/instructions/Instructions_References.cppsrc/core/instructions/Instructions_Extended.cpp
- Add private helper methods to
Interpreterclass to initialize groups of instructions:void initConstants(); void initLoads(); void initStores(); // ...
- These methods will be called by
initInstructionTable.
- Move the lambda implementations from
Interpreter.cpp'sinitInstructionTableinto the respective new.cppfiles. - Each new file will implement one of the
initXmethods (e.g.,void Interpreter::initConstants() { ... }). - This keeps the logic within the
Interpreterclass scope (accessinginstructionTable,resolveClass, etc.) but physically separates the code.
- Move
resolveClassand its large mocking logic to a new filesrc/core/Interpreter_ClassLoader.cpp.
- Update
CMakeLists.txtto include the new.cppfiles in the build target.
- Compile the project to ensure no linking errors.
- Run tests (if available) to ensure functionality remains the same.