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

Add metering to the VM #49

Merged
merged 6 commits into from
Jun 15, 2024
Merged

Conversation

Southporter
Copy link
Contributor

Add support for metering the virtual machine. The meter can be set when you invoke or resume the VM. In the preamble it will decrease the meter and if it runs out, return an error and save state so that the VM can resume from where it was interrupted.

It currently compiles and the tests pass. Wanted to get a draft pr up to get your initial thoughts. I want to revisit some of the places where we have both debug state and meter state and make sure the interactions between the two are good. I'll also add some tests with metering state with and without debug as well. It's not a trivial interaction between the two so I want to make sure we have it tested.

Copy link
Owner

@rdunnington rdunnington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Overall this looks really solid. Adding some tests to the test-unit suite sounds great to keep the feature stable. I wouldn't worry too much about making sure the debug functionality is tested unless you really want to - it's still an untested experimental feature, so you may be breaking new ground there and finding bugs with it. 😅

src/vm_stack.zig Outdated Show resolved Hide resolved
src/vm_stack.zig Outdated Show resolved Hide resolved
src/vm_stack.zig Outdated Show resolved Hide resolved
@Southporter Southporter marked this pull request as ready for review June 14, 2024 13:47
@rdunnington rdunnington merged commit 3cc31c0 into rdunnington:main Jun 15, 2024
3 checks passed
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.

2 participants