-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
Optimization fast local variables #3194
Conversation
Test262 conformance changes
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3194 +/- ##
==========================================
+ Coverage 49.53% 49.60% +0.06%
==========================================
Files 446 446
Lines 43722 44070 +348
==========================================
+ Hits 21659 21861 +202
- Misses 22063 22209 +146 ☔ View full report in Codecov by Sentry. |
8f055b5
to
2d454cb
Compare
933900d
to
fedf269
Compare
8fa5cb8
to
b7c9230
Compare
b7c9230
to
e23ec27
Compare
Blocked on #3490 |
@HalidOdat I would like to take a look at continuing development on local variables. We talked about having environment aware bytecode generation for this with analyzed variable scopes. Do you have any more work or ideas on this or should I just start from the current state of this PR? Also, should I keep anything in mind regarding #3798? |
The issue I have with the current implementation is that it does not account for many cases (and it's very hacked together). My idea for a more proper solution would be to move the compile time environment logic to the parser and have the AST nodes like The second idea was to perform a second pass after the AST generation this would generate a data structure that contains all the scope data that is passed to the compiler, and add a ID to the AST nodes that is I began working on this but didn't make much progress, you can find the code on my fork (hope it helps): https://github.com/HalidOdat/boa/tree/scope-analysis
Hmmm.. The logic on how to allocate register/local variables in the compiler will be shared, besides that I think both tasks can be worked on simultaneously. I'll create a PR and extract that logic so we can merge it into |
Quick update on this. I have a working version with scope analysis at parse time. All tests pass and local variables work. I'm now in the process of cleaning up the implementation and removing some hacks. I ran into the issue, of needing to track uninitialized variables, since we cannot track if a variable in initialized just with the stack value. Right now I'm just using a call frame local map to track this, but I think I can reduce that to an array to get some better performance. |
Superseded by #3988 |
Depends on #3185
This PR is a WIP, it implements an optimization on function local variables, functions that do not call
eval
directly or variables that are not escaped, we can keep then on the stack after frame pointer and use and offset to index them (index = fp + offset
). This allows us to eliminate the creation of some of the gc collected environments. Which gives us huge performance improvements!Benchmarks
Main
PR
Almost 2x improvment on NavierStokes :)