Skip to content

Assembly-level optimizations#2304

Merged
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:optimize-assembly
Feb 15, 2021
Merged

Assembly-level optimizations#2304
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:optimize-assembly

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

  • find and remove unreachable instructions within the assembly
  • merge sequential jumpdests

How I did it

Added some logic in assembly_to_evm within compile_lll.py

Both of these situations occur as a result of LLL generation happening in small chunks that don't see the "bigger picture" around them. There is likely a more elegant solution here, but this is effective and simple to implement. I've left comments about what's happening, we can try to address this properly as we refactor out parser in the future and give ourselves more effective data structures to catch and fix this as it happens rather than after the fact.

How to verify it

Run tests, confirm that nothing broke. If this created any issues we'd see tests failing everywhere, especially within the e2e tests of the examples.

Cute Animal Picture

image
Notice me senpai!

@codecov-io

codecov-io commented Feb 15, 2021

Copy link
Copy Markdown

Codecov Report

Merging #2304 (ec4b289) into master (fbd6880) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2304      +/-   ##
==========================================
- Coverage   85.82%   85.81%   -0.02%     
==========================================
  Files          85       85              
  Lines        8546     8560      +14     
  Branches     2036     2042       +6     
==========================================
+ Hits         7335     7346      +11     
- Misses        728      730       +2     
- Partials      483      484       +1     
Impacted Files Coverage Δ
vyper/compile_lll.py 92.85% <100.00%> (+0.29%) ⬆️
vyper/functions/functions.py 89.25% <0.00%> (-0.40%) ⬇️

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 fbd6880...a6b4fab. Read the comment docs.

@fubuloubu fubuloubu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Big change, but if it passes the test suite, hopefully should work just fine.

@fubuloubu fubuloubu merged commit 39f7c59 into vyperlang:master Feb 15, 2021
@iamdefinitelyahuman iamdefinitelyahuman deleted the optimize-assembly branch April 20, 2021 18:16
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