Skip to content

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented May 26, 2025

What I did

remove recursion from assembly. continuation of #4629

How I did it

How to verify it

Commit message

this commit is a follow-on to 90c952c06ac31a. it removes recursion from
the assembler. previously, the assembly was structured with the runtime
code as a "subassembly", which is recursively compiled during lowering
to bytecode.

this commit instead pre-compiles the runtime code into a data blob in
the initcode before entering the assembler, decreasing the conceptual
overhead of the assembler. this can be seen by the simplification of
`venom_to_assembly.py`, for instance.

to handle some of the assembly-time constant folding specifically
related to initcode memory allocation, it also adds the CONSTREF data
structure, which represents constants which are inserted into the
assembly.

lastly, the main routine for compiling (legacy) IR to assembly has been
wrapped in an object, so that the recursion does not need to keep track
of so much state.

Description for the changelog

Cute Animal Picture

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

@charles-cooper charles-cooper marked this pull request as ready for review August 12, 2025 12:47
@cyberthirst
Copy link
Collaborator

we probably should do the same for PUSH_OFST?

# replace all instances of PUSHLABEL x with PUSHLABEL y

@cyberthirst
Copy link
Collaborator

we probably should do the same for PUSH_OFST?

# replace all instances of PUSHLABEL x with PUSHLABEL y

probably the same for this?

# replace all instances of PUSHLABEL x with PUSHLABEL y

@cyberthirst
Copy link
Collaborator

we probably should do the same for PUSH_OFST?

# replace all instances of PUSHLABEL x with PUSHLABEL y

and maybe even DATA_ITEM is affected here?

@charles-cooper
Copy link
Member Author

we probably should do the same for PUSH_OFST?

# replace all instances of PUSHLABEL x with PUSHLABEL y

it's not really a correctness issue, worst case there is a label that could have been removed but isn't (and is referenced by a push_ofst or data item)

@cyberthirst
Copy link
Collaborator

we probably should do the same for PUSH_OFST?

# replace all instances of PUSHLABEL x with PUSHLABEL y

it's not really a correctness issue, worst case there is a label that could have been removed but isn't (and is referenced by a push_ofst or data item)

yeah, i think this is correct. let's add a comment though, it's a bit confusing that they are missing

@charles-cooper charles-cooper enabled auto-merge (squash) September 2, 2025 11:13
@charles-cooper charles-cooper merged commit 2a56308 into vyperlang:master Sep 2, 2025
161 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