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

Fix unused storage slots #2439

Merged
merged 3 commits into from
Oct 25, 2021

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Aug 27, 2021

What I did

fix: don't alloc slots for nonreentrant keys which appear multiple times.

this is not a semantic bug but an optimization bug since we allocate
more slots than we actually need, leading to "holes" in the slot
allocator -- slots which are allocated but unused.

How I did it

How to verify it

Description for the changelog

fix: don't allocate slots for nonreentrant keys which appear multiple times.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2021

Codecov Report

Merging #2439 (b5b6705) into master (cec2c53) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2439   +/-   ##
=======================================
  Coverage   84.63%   84.63%           
=======================================
  Files          94       94           
  Lines        9273     9276    +3     
  Branches     2093     2094    +1     
=======================================
+ Hits         7848     7851    +3     
  Misses        940      940           
  Partials      485      485           
Impacted Files Coverage Δ
vyper/semantics/validation/data_positions.py 93.10% <100.00%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cec2c53...b5b6705. Read the comment docs.

@fubuloubu
Copy link
Member

Can you rebase on master to incorporate #2433?

@charles-cooper
Copy link
Member Author

charles-cooper commented Sep 1, 2021

Sure. I'm not so sure anymore this is such a useful optimization tho. It only helps if there are more than 255 (storage variables + nonreentrant keys)

this is not a semantic bug but an optimization bug since we allocate
more slots than we actually need, leading to "holes" in the slot
allocator -- slots which are allocated but unused.
@charles-cooper
Copy link
Member Author

related: #2436

@charles-cooper
Copy link
Member Author

Alright, along with b5b6705 I feel pretty confident about this PR.

@charles-cooper charles-cooper merged commit eae0eaf into vyperlang:master Oct 25, 2021
@charles-cooper charles-cooper deleted the fix/dup_storage_slots branch October 25, 2021 14:59
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.

4 participants