Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
MCOPY is now limited by frequency + Interruptible instruction framework #38
MCOPY is now limited by frequency + Interruptible instruction framework #38
Changes from all commits
1b4c785
b3a4a2f
004a0c5
6ec4fd7
9c820a7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 60 in lua/wire/zvm/zvm_features.lua
GitHub Actions / lint
"Whitespace style"
Check warning on line 60 in lua/wire/zvm/zvm_features.lua
GitHub Actions / lint
"Whitespace style"
Check warning on line 373 in lua/wire/zvm/zvm_features.lua
GitHub Actions / lint
"Whitespace style"
Check warning on line 401 in lua/wire/zvm/zvm_features.lua
GitHub Actions / lint
"Whitespace style"
Check warning on line 461 in lua/wire/zvm/zvm_opcodes.lua
GitHub Actions / lint
"Unnecessary parentheses"
Check warning on line 462 in lua/wire/zvm/zvm_opcodes.lua
GitHub Actions / lint
"Unnecessary parentheses"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dyn_QuotaOnlyCode details
QuotaOnlyCode will wrap the emits between the start and end with code that will allow it to check if it's going to exit, similar to the Interrupt, but this will allow you to set up things ahead of time that will be needed by the quota interrupt function
On line 551-553 it sets up the variable VM.MCOPYWrapUpCount
On line 565-569 it will emit the state of the CPU, subtract the indexes copied during this execution from the stored variable, and then exit early without changing the quota interrupt func
Dyn_QuotaInterrupt details
If quota is enabled, and the TIMER goes past the QUOTA, which is defined by the context before starting the step as TIMER+CPU Cycles, it will place a function containing all of this code from the dyn_emits between StartQuotaInterrupt and EndQuotaInterrupt in VM.QuotaOverrunFunc, it will also add the size of the current instruction to the instruction pointer, so when it wakes up and starts running VM:Step again it will start from the next instruction, it will also end a block like it's a branching(JMP/CALL/etc.) instruction, so precompile should end on "quota" instructions.
When the CPU sees that VM:QuotaOverrunFunc is not nil, it will run it instead of the regular VM:Step, until VM:QuotaOverrunFunc is nil again.
The function wrapped inside behaves like MCOPY, the diffs are:
Tracks variable VM.MCOPYWrapUpCount to access and store the amount of indexes left to copy.
If it's completed the amount of indexes, it will remove itself as function, and remove the variable it used to track, next tick will return to execution at the next instruction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intended this to actually point to a wider set of lines than this in the file with my one comment but idk how to correct that.
Check warning on line 718 in lua/wire/zvm/zvm_opcodes.lua
GitHub Actions / lint
"Unnecessary parentheses"
Check warning on line 1077 in lua/wire/zvm/zvm_opcodes.lua
GitHub Actions / lint
"Unnecessary parentheses"
Check warning on line 1219 in lua/wire/zvm/zvm_opcodes.lua
GitHub Actions / lint
"Whitespace style"
Check warning on line 1681 in lua/wire/zvm/zvm_opcodes.lua
GitHub Actions / lint
"Unused variable"