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

Allow reusing Scope temp variables #18

Merged
merged 3 commits into from
May 16, 2024

Conversation

pettyjamesm
Copy link
Contributor

@pettyjamesm pettyjamesm commented May 16, 2024

Allows temp variables to be reused within the same Scope instance after being released. This allows relatively smaller method bytecode sizes by using relatively fewer variable slots- which becomes significant since:

  • accessing variable slots 0 - 3 is a single bytecode operation: aload_0, aload_1, aload_2, aload_3
  • accessing variable slots 3 - 255 takes two bytes: aload <index>
  • accessing variable slots 256+ takes 4 bytes: wide aload <two byte index>

Similar overheads are incurred when storing values into a variable, and for other non-reference type load/store bytecode operations.

@pettyjamesm
Copy link
Contributor Author

@electrum / @dain PTAL

Copy link
Member

@dain dain left a comment

Choose a reason for hiding this comment

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

Nice. I was going to add this years ago and never got to it :)

@dain dain merged commit 8d0a634 into airlift:master May 16, 2024
1 check passed
@pettyjamesm pettyjamesm deleted the reusable-temp-variables branch May 16, 2024 21:29
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