Skip to content
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

VM refactoring #351

Merged
merged 9 commits into from
Jul 5, 2024
Merged

VM refactoring #351

merged 9 commits into from
Jul 5, 2024

Conversation

rdaum
Copy link
Owner

@rdaum rdaum commented Jul 5, 2024

This is a series of commits which are part of some long overdue reworking of the verb dispatch and execution happens for both the MOO virtual machine and for builtins.

One part of this is about making things more consistent in interface for builtins vs MOO execution, and cleaning up the builtin execution so they happen in their own frame type.

Another part is moving the bulk of execution logic off of the MOO "VM" and onto the VMExecState, and then isolating the MOO specific portions to their own routine, which operates on MooFrames only.

All of this has the eventual goal of making it easier to support other language runtimes inside the moor system.

rdaum added 9 commits July 5, 2024 08:58
The idea here being that we will have different kinds of activation
frames. MOO verb frames, builtin frames, and in the future, frames
from other languages.

"Frame" here being the language/runtime-specific portion of a given
activation record.
In this way "builtin" frames become our first "non-MOO"
frame. Reflecting _roughly_ how we'll do non-MOO interpreters in the
future.

More work on stack unwinding and error handling needs to be done here,
but this is a start.
* Move builtins off of "VM" and up onto their own BuiltinRegistry
  which is owned by the Scheduler and passed around.
* Begin dispatch into the "right" kind of "VM" (builtin func or MOO)
  inside the VMHost instead of inside the MOO VM.
Dispatch of MOO stack frames is done through a simple function call.
Make decode and preparation of activation frames aware of the binary
type though only MOO is supported at this time.
- Some renames to better reflect what's going on inside vm/
- Remove an unnecessary Arc for each builtin function, and use Box instead.
- Formatting and stuff
* These came over from LambdaMOO opcodes list, but aren't even really
  used there.
* They're redundant and just the same as PUT/PUSH
* At some point we'll introduce more sophisticated scoping constructs
  and these will just get in the way
@rdaum rdaum merged commit 119cb60 into main Jul 5, 2024
13 checks passed
@rdaum rdaum deleted the rd/vm-refactor branch July 6, 2024 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant