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

chore[venom]: expand venom docs #4314

Merged
merged 12 commits into from
Oct 25, 2024
Merged

Conversation

sandbubbles
Copy link
Collaborator

@sandbubbles sandbubbles commented Oct 18, 2024

What I did

Documents venom IR instructions.

How I did it

How to verify it

Commit message

expand venom docs. document venom instructions and structure of a venom
program.

Description for the changelog

Cute Animal Picture

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


- `jmp`
- Unconditional jump to code denoted by given `label`.
- Changes the program counter.
Copy link
Member

Choose a reason for hiding this comment

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

i don't think we actually need to say this. it depends on the architecture, or it could be optimized out (if the jumpdest is immediately following the jump)

- db
- db stores into the data segment some label? hmm
- dloadbytes
- aparently the same `codecopy`-everything handled the same way. Maybe historical reasons?
Copy link
Member

Choose a reason for hiding this comment

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

it's handled differently in the legacy IR pipeline, but in venom they are handled the same

- Describe the architecture of analyses and passes a bit more. mention the distiction between analysis and pass (optimisation or transformation).
- mention how to compile into it , bb(deploy), bb_runtime
- perhaps add some flag to skip the store expansion pass? for readers of the code
- some of the evm opcodes are from older versions - should comment on that? instructions like difficulty that changed into prevrandao
Copy link
Member

Choose a reason for hiding this comment

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

it's not really necessary, DIFFICULTY is known to be an alias for PREVRANDAO

- pass - run_pass

Perhaps mention that functions:
- each function starts as if with empty stack
Copy link
Member

Choose a reason for hiding this comment

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

not exactly -- they take (optional) output buffer and return pc

ret op
```
- `exit`
- Similar to `stop`, but used for constructor exit. The assembler is expected to jump to a special initcode sequence which returns the runtime code.
Copy link
Collaborator Author

@sandbubbles sandbubbles Oct 18, 2024

Choose a reason for hiding this comment

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

Do you know why it may be in fallback? there is the revert before it anyway, but it confused me as it doesn't seem to do much with constructor exit.

fallback:  IN=[__main_entry, 47_if_exit] OUT=[] => {}
    revert 0, 0
    exit
    ```

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it should be in runtime code...

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 think it is: --experimental-codegen -f bb_runtime on

totalShares: public(uint256)

# Set up the company.
@deploy
def __init__(_total_shares: uint256):
    pass

Copy link
Member

Choose a reason for hiding this comment

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

yeah i see what you mean. dead code! but it shouldn't be there, i would consider that a bug in our venom generation.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.18%. Comparing base (b3ea663) to head (7c9bcf6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4314      +/-   ##
==========================================
- Coverage   91.40%   89.18%   -2.22%     
==========================================
  Files         112      112              
  Lines       15927    15927              
  Branches     2694     2694              
==========================================
- Hits        14558    14205     -353     
- Misses        935     1218     +283     
- Partials      434      504      +70     

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

Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

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

lgtm. thank you!

@charles-cooper charles-cooper changed the title Docs/venom docs[venom]: expand venom docs Oct 25, 2024
@charles-cooper charles-cooper marked this pull request as ready for review October 25, 2024 22:05
@charles-cooper charles-cooper enabled auto-merge (squash) October 25, 2024 22:14
@charles-cooper charles-cooper changed the title docs[venom]: expand venom docs chore[venom]: expand venom docs Oct 25, 2024
@charles-cooper charles-cooper merged commit 063f190 into vyperlang:master Oct 25, 2024
155 of 156 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.

2 participants