-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Register VM #3798
base: main
Are you sure you want to change the base?
Register VM #3798
Conversation
Test262 conformance changes
Fixed tests (2):
|
7351c87
to
039bd2b
Compare
f98cd87
to
1e0bf01
Compare
The failing test is due to #3907 , in any case I'll work on always returning i32 for increment. |
5fd2167
to
50e8339
Compare
@HalidOdat Do you have the time to work on this at the moment? If not, I can see if I can make some progress on the PR. |
I'm quite busy at the moment, but feel free to work on it! 😊 |
50e8339
to
2bab5ac
Compare
a2631ed
to
0cecbb6
Compare
- Add todo for storing fp in CallFrame - Start on moving to register VM - Add more binary ops - Add helpter transition methods - Register based logical ops - Register InPrivate - Register GetFunction - Some class opcodes - Register post and pre increment and decrement
0cecbb6
to
aeb2e2f
Compare
@jedel1043 @HalidOdat Could you give this a look? I was looking into making some some changes to some opcodes, but didn't want to rebase this all the time, so it would be nice if we could merge it soon. |
This PR transitions the current stack based VM to a register based VM.
There are a many changes in this, but I will try to highlight the most important ones.
Vm
struct into a dedicatedRegisters
struct that is passed to the vm execution functions together with theContext
. The reason for this is mostly to be able to get references to register values without borrowing theContext
. In some opcodes, theClone
rate ofJsObject
s significantly increased with the move to registers, because I had to clone all register values before operating on them, because the operation required a&mut Context
.Dup
,Swap
,RotateLeft
andRotateRight
are gone. Working with registers turns out to be way more intuitive than working on a stack.u8
,u16
andu32
sizes. I think we should probably look into reworking the opcode generation macros, to possibly add bothemit
andread_operands
functions. This should also make the code a lot safer, since right now we have to manually implement all operand reading and writing.Call
/New
opcodes use the stack for all arguments and the return values. Also the return value and returned resume kind for yielding opcodes (Await
, etc.) still use the stack. Currently I'm not sure how / if we want to change this. There are some significant challanges here, especially with how our function calls currently work.instruction_operands
print function for all opcodes. A significant amout of lines changed is just that.JsObject
s and the associated gc. Currently the object clone rate is still higher than with a the stack vm. I measured this on theEarleyBoyer
benchmark and last time I checked, the clone rate is ~1,35B vs ~1,42B. In my local benchmark runs the performance regression is between ~1% and ~3%.