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

WIP: Move interpreter state to the stack #201

Closed rwy7 closed 1 year ago

rwy7 commented 6 years ago
  1. Move interpreter state to the execution context, from the interpret frame.
  2. Allow bytecode handlers to directly manipulate interpreter state.
  3. Save caller state in call-function
  4. Restore caller state return
  5. Stop passing immediates to bytecode handlers. Handlers have direct access to the ip_, and can decode themselves.

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

rwy7 commented 6 years ago

very wip, just want people to be aware of the changes. /cc @nbhuiyan @youngar

dnakamura commented 6 years ago

Any reason you changed from functionIndex -> target? functionIndex seems clearer to me

rwy7 commented 6 years ago

target was shorter, and we were using both.

dnakamura commented 6 years ago

Now that interpreter state is on the vm stack. you really need to add protection to pops/storing to local vars. Ie it should not be possible to corrupt the interpreter state from inside the vm (you may or may not want to allow read access)