-
-
Notifications
You must be signed in to change notification settings - Fork 478
Refactor environment, exception handling and jumping in VM #3059
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
Conversation
bcb7631 to
fed05d7
Compare
7a50cc6 to
3ea7f1a
Compare
3ea7f1a to
b5b2a5a
Compare
a087128 to
ab575f7
Compare
Test262 conformance changes
Fixed tests (8): |
ab575f7 to
ec4d598
Compare
Codecov Report
@@ Coverage Diff @@
## main #3059 +/- ##
==========================================
- Coverage 50.50% 50.41% -0.09%
==========================================
Files 443 436 -7
Lines 42712 42340 -372
==========================================
- Hits 21572 21347 -225
+ Misses 21140 20993 -147
|
79c290c to
8ab2742
Compare
2927ab4 to
e7c8330
Compare
1d255f4 to
a4c7b3b
Compare
|
Ran the quickjs benchmarks: MainPRThere is performance increase while greatly simplifying the execution :) There are still some to-dos left (updated in the PR comment) that I have to do, in the mean time making this ready for review :) |
e79a846 to
91986f1
Compare
|
I really like this change. The logic is much simpler than before. Amazing work in this refactor! As soon as all todos are done, I will give it a second review :) |
nekevss
left a comment
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.
Hey! This is all looking pretty amazing! Thought I'd provide some early feedback on a couple things.
Sort of an aside: I'm curious what you were thinking about regarding Yield and GeneratorResumeKind given the changes. The one's in this PR are fine, but I keep thinking that they could probably be cleaned up by adding something like an execution context stack to the vm. Maybe that's the wrong approach though.
|
This PR is now complete! Ready for review/merge :) |
nekevss
left a comment
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.
Great work on this! Just one question I wanted to double check 😄
95d3566 to
b653639
Compare
nekevss
left a comment
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.
One more small misspelling that I noticed in docs. 😄 But overall this looks great!
We always emit a `Return` opcode at the end of a function, so this should never be reached.
f673d03 to
ae13bb1
Compare
raskad
left a comment
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.
Amazing refactor!
Depends on #3053Fixes #2424
This PR refactors environment handling and jumping with break, continues, etc in the VM. Currently the opcodes are very complex, they dynamically search for the environments, for this we also need to keep a lot of state in the
CallFrame, this has a performance penalty as well as being hard to implement optimizers (since it has to mirror the state, so it does not change behaviour).Since this the bytecompiler has full knowledge of where it needs to jump, how many environments to pop, etc. This PR aims to move that opcode logic to bytecompiler, generating opcodes that are "dumber"/simple, hence easier to optimize ( using #3037 ).
This still needs a lot of work!It changes the following:
FinallyStart,FinallyEnd,Break,Continue,LoopStart,LoopEnd,LabelledStart,LabelledEnd,TryStart,TryEnd,IteratorLoopStart,GeneratorResumeReturn,GeneratorSetReturn,GeneratorJumpOnResumeKindReThrow,Exception,JumpTable,JumpIfNotResumeKind,IteratorNextWithoutPop,IteratorValueWithoutPopBreaks andContinues with simple unconditionalJump.EnvEntrytype and env entry stackabrupt_completionrecord fromCallFramegenerator_resume_kindfromCallFrameyieldfield fromCallFrame, addedCompletionType::YieldTODO:
fpon exception handlers