-
Notifications
You must be signed in to change notification settings - Fork 0
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
Serializable VMs #3
Comments
This is the first commit in the serializable VMs project, which is biggish project to support making the Texcraft VM serializable. The main reason why this isn't trivial in the usual Rust way is because the VM contains function pointers (of primitives) and thus you can't trivially serde the VM. This commit adds (or fixes) some of the initial infrastructure that was added (e.g., the command key type) and adds support for serializing primitives only. Support for other commands will come later. One of the main additions here is a unit testing utility for easy unit testing serding stuff.
This is to make the dynamic memory allocation system work with serializable VMs.
One bug with this (de)serializer is that the registers array overflows the stack, I'm guessing becuase the call stack gets bigger than with serde_json. I put the array behind a Box which is unfortunate because there's a small runtime cost to that. Maybe in the future there will be a better solution. I also put all VMs behind boxes. I thought this may have solved the stack overflow but it didn't. Nonetheless it's worth doing because the VM can be big. After this commit all serde unit tests run both with json and message pack.
This sneaked in in the previous commit.
For benchmarking, it would be awesome to time (de)serializing a VM that has loaded the Plain TeX format. It may take a lot of work though before Texlang can read the Plain TeX format. |
To do this we need to support (de)serializing the save stack. This is a bit of a pain as the save stack contains function pointers that need to be cross-referenced with what's in the command map. In the end the code touches the commands map, the variables API, and the serde module, so there are more pub(crate)s than I would like. I tried to refactor things to minimize cross module deps. But it works!
Some perf improvement ideas I had:
|
Task list for making the serializable VMs feature complete:
\countdef
)\dump
primitiveThe text was updated successfully, but these errors were encountered: