Skip to content

Conversation

harkal
Copy link
Collaborator

@harkal harkal commented Jul 18, 2025

What I did

How I did it

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

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

@harkal harkal changed the title refactor[venom]: Refactor assembler and *more* refactor[venom]: Refactor assembler and more Jul 18, 2025
@harkal harkal changed the title refactor[venom]: Refactor assembler and more refactor[venom]: refactor assembler and *more* Jul 18, 2025
class DATA_ITEM:
data: bytes | Label

def __repr__(self) -> str:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.


# a string (assembly instruction) but with additional metadata from the source code
class TaggedInstruction(str):

Check warning

Code scanning / CodeQL

`__eq__` not overridden when adding attributes Warning

The class 'TaggedInstruction' does not override
'__eq__'
, but adds the new attribute
error_msg
.
The class 'TaggedInstruction' does not override
'__eq__'
, but adds the new attribute
pc_debugger
.
The class 'TaggedInstruction' does not override
'__eq__'
, but adds the new attribute
ast_source
.
"""Generate a unique label name for an unresolved constant."""
global _const_label_counter
label = f"__const_{_const_label_counter}"
_const_label_counter += 1

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable '_const_label_counter' is not used.
from vyper.evm.address_space import MEMORY, STORAGE, TRANSIENT, AddrSpace
from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable
from vyper.venom.basicblock import ConstRef, IRLabel, IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'ConstRef' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of ConstRef occurs after the cyclic
import
of vyper.venom.memory_location.
from vyper.evm.address_space import MEMORY, STORAGE, TRANSIENT, AddrSpace
from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable
from vyper.venom.basicblock import ConstRef, IRLabel, IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRLabel' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of IRLabel occurs after the cyclic
import
of vyper.venom.memory_location.
from vyper.evm.address_space import MEMORY, STORAGE, TRANSIENT, AddrSpace
from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable
from vyper.venom.basicblock import ConstRef, IRLabel, IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRLiteral' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of IRLiteral occurs after the cyclic
import
of vyper.venom.memory_location.
from vyper.evm.address_space import MEMORY, STORAGE, TRANSIENT, AddrSpace
from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable
from vyper.venom.basicblock import ConstRef, IRLabel, IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IROperand' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of IROperand occurs after the cyclic
import
of vyper.venom.memory_location.
from vyper.evm.address_space import MEMORY, STORAGE, TRANSIENT, AddrSpace
from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable
from vyper.venom.basicblock import ConstRef, IRLabel, IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRVariable' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of IRVariable occurs after the cyclic
import
of vyper.venom.memory_location.
empty db

constructor jump error test

add PC_RESET instruction

pc reset stuff

cleanup basicblock

parser tag handling

enhance unresolved constant check in VenomCompiler

add CFG normalization check

refactor stack handling

refactor VenomCompiler to differentiate between constant references and labels in assembly generation

import PC_RESET

handle PC_RESET in resolve_symbols

runtime actual position handling

fix symbol map updates

implement _resolve_push_ofst_value function for PUSH_OFST offset resolution
# Process global label expressions that were stored separately
for name, expr in list(self.ctx.const_expressions.items()):
if name.startswith("_global_label_"):
label_name = name[len("_global_label_") :]
Copy link
Member

Choose a reason for hiding this comment

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

maybe str.remove_prefix

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