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[codegen]: fix some hardcoded references to STORAGE location #4015

Merged
merged 20 commits into from
May 21, 2024

Conversation

cyberthirst
Copy link
Collaborator

@cyberthirst cyberthirst commented May 13, 2024

What I did

How to verify it

  • check coverage that the new updates are tripped

Commit message

fix some hardcoded references to `STORAGE` when `TRANSIENT` is also
possible. these are not breaking changes semantically, but should enable
the correct optimization codepath for transient storage. this commit
also results in better codepaths taken for the IMMUTABLES location
(`iload`/`istore`), resulting in smaller bytecode sometimes for
constructors.

Description for the changelog

Cute Animal Picture

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

EDIT: added references to the issues

@cyberthirst
Copy link
Collaborator Author

cyberthirst commented May 13, 2024

these i didn't update yet, but atleast the part for key is sus

EDIT:
also, maps are now instantiable in transient, so we should atleast update that

@cyberthirst cyberthirst added this to the v0.4.0 milestone May 13, 2024
@charles-cooper charles-cooper marked this pull request as ready for review May 13, 2024 15:54
@charles-cooper
Copy link
Member

why isn't the codecov bot running?

@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

Attention: Patch coverage is 93.54839% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 88.51%. Comparing base (0ba1c62) to head (daa8444).

Current head daa8444 differs from pull request most recent head da66218

Please upload reports for the commit da66218 to get more accurate results.

Files Patch % Lines
vyper/codegen/core.py 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4015      +/-   ##
==========================================
- Coverage   91.04%   88.51%   -2.53%     
==========================================
  Files         106      106              
  Lines       15309    15302       -7     
  Branches     3369     3369              
==========================================
- Hits        13938    13545     -393     
- Misses        933     1247     +314     
- Partials      438      510      +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charles-cooper charles-cooper changed the title fix[lang]: fix hardcoded references to storage to account for transient fix[lang]: fix some hardcoded references to storage location May 17, 2024
@charles-cooper charles-cooper changed the title fix[lang]: fix some hardcoded references to storage location fix[lang]: fix some hardcoded references to STORAGE location May 17, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) May 17, 2024 16:31
@charles-cooper
Copy link
Member

i tested several large contracts i have (CurveCryptoMathOptimized3-0.4.0.vy, VaultV3-0.4.0.vy, CurveStableSwapNG-0.4.0.vy) as well as everything in the examples/ directory and compared the sha256sum of runtime bytecode to master, and found no change.

there were some changes (improvements) to initcode, because after this commit, some more optimized codepaths for iload/istore are taken.

@charles-cooper charles-cooper changed the title fix[lang]: fix some hardcoded references to STORAGE location fix[codegen]: fix some hardcoded references to STORAGE location May 17, 2024
@cyberthirst
Copy link
Collaborator Author

feel hesitant to merge before we properly review coverage.

like do we hit all combinations in all paths where copy_opcode_available is used (esp. here return left.location == MEMORY and right.location.has_copy_opcode)?

@@ -27,11 +27,16 @@ class AddrSpace:
load_op: str
# TODO maybe make positional instead of defaulting to None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'd prefer positional here

@charles-cooper
Copy link
Member

feel hesitant to merge before we properly review coverage.

like do we hit all combinations in all paths where copy_opcode_available is used (esp. here return left.location == MEMORY and right.location.has_copy_opcode)?

i think we do. but codecov is not really aggregating the coverage reports properly. i think we should just double check the logic and not worry about it, i think those branches are actually getting hit (just not getting reported by codecov)

@charles-cooper charles-cooper enabled auto-merge (squash) May 20, 2024 23:45
@charles-cooper charles-cooper merged commit a0d9b1f into vyperlang:master May 21, 2024
155 checks passed
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.

3 participants