Skip to main content

builtin_function_gen

Function builtin_function_gen 

Source
pub fn builtin_function_gen<'a>(
    evm_version: &EVMVersion,
    contract: &'a Contract,
    macro_def: &MacroDefinition,
    scope_mgr: &mut ScopeManager<'a>,
    offset: &mut usize,
    table_instances: &mut Jumps,
    utilized_tables: &mut Vec<TableDefinition>,
    embedded_tables: &mut BTreeMap<String, usize>,
    starting_offset: usize,
    bytes: &mut BytecodeSegments,
    bf: &BuiltinFunctionCall,
    relax_jumps: bool,
) -> Result<(), CodegenError>
Expand description

Generates bytecode for all builtin function calls

This is the main dispatcher that handles all builtin function types:

  • __codesize, __tablesize, __tablestart - Size and location utilities
  • __FUNC_SIG, __EVENT_HASH, __ERROR - ABI encoding helpers
  • __RIGHTPAD, __LEFTPAD - Byte padding (code tables only)
  • __BYTES - Raw bytes insertion
  • __VERBATIM - Direct hex injection
  • __argsstart - Offset of the constructor arguments in the deployment bytecode
  • __ASSERT_PC - Compile-time program counter assertions

TODO: First step to refactor and split the function into smaller functions