create_tco_handler

Attribute Macro create_tco_handler 

Source
#[create_tco_handler]
Expand description

An attribute procedural macro for creating TCO (Tail Call Optimization) handlers.

This macro generates a handler function that wraps an execute implementation with tail call optimization using the become keyword. It extracts the generics and where clauses from the original function.

§Usage

Place this attribute above a function definition:

#[create_tco_handler]
unsafe fn execute_e1_impl<F: PrimeField32, CTX, const B_IS_IMM: bool>(
    pre_compute: &[u8],
    state: &mut VmExecState<F, GuestMemory, CTX>,
) where
    CTX: ExecutionCtxTrait,
{
    // function body
}

This will generate a TCO handler function with the same generics and where clauses.

§Safety

Do not use this macro if your function wants to terminate execution without error with a specific error code. The handler generated by this macro assumes that execution should continue unless the execute_impl returns an error. This is done for performance to skip an exit code check.