b9org / b9

An educational JS virtual machine based on Eclipse OMR
http://www.base9.xyz
Apache License 2.0
45 stars 24 forks source link

Split the State into a modeling and active State #205

Closed rwy7 closed 6 years ago

rwy7 commented 6 years ago

This patch starts to move any operation on the execution context into the VM state, for potential modeling.

The b9::VirtualMachineState has been renamed to State, and it's functionality has been expanded with new push / pop operations.

This patch introduces two new State variants: Active and Model. The ActiveState will always write out the state. For example, a push really will write out a value to the operand stack. The Model state will track the push, and only write out to the stack when we force a commit.

Now, we use the state unconditionally, instead of checking for the lazy vm state everywhere. Which state we use depends on the flag.

This PR also removes the QSTACK, QRELOAD, and QRELOAD_DROP macros, in favor of inline functions and virtual function calls.

Signed-off-by: Robert Young rwy0717@gmail.com