Skip to main content

Return contexts

A return context marks an instruction associated with a successful function return. It extends the function identity schema with an optional pointer to the return data and, for external calls, the success status.

Loading ....

Return data

The data field contains a pointer to the value being returned. For internal calls this typically points to a stack location; for external calls it points into the returndata buffer.

data is optional. Omit it when no return value is observable at this instruction—see Field optionality below.

Internal return

An internal return marks the JUMP instruction that transfers control back to the caller within the same contract. The function leaves its return value on the stack, so data points to the relevant stack slot.

Internal returns do not use the success field—internal calls either return normally or revert, with no separate success flag.

External call return

An external call return marks an instruction after a CALL, DELEGATECALL, or STATICCALL that completed successfully. The EVM places a success flag on the stack (1 for success, 0 for failure), and the callee's output is accessible via the returndata buffer.

The success field is specific to external call returns. It contains a pointer to the boolean success value on the stack, letting the debugger distinguish successful returns from reverts at the EVM level.

Field optionality

All fields on a return context are optional. A bare return: {} is permitted when the compiler knows a return occurred but has no further detail to record.

The data pointer is omitted when no return value is observable at the marked instruction. This occurs in several legitimate cases:

  • Void functions. The function produces no return value, so there is nothing to point at.
  • Tail-call-optimized back-edges. When a tail call is rewritten to a back-edge JUMP, the intermediate return value is not materialized—it would have become the next iteration's argument, which the compiler has already folded into the new call's setup. A return semantically happens, but no pointer records where the value lives (it does not live anywhere).
  • Lost compiler precision. The compiler knows a return occurred but has dropped the location tracking for the value.

The success field is optional and only meaningful for external call returns, where it points to the boolean status placed on the stack by CALL/DELEGATECALL/STATICCALL.

Function identity fields (identifier, declaration, type) are all optional. A compiler may omit them when it cannot attribute the return to a specific named function, for instance when returning from a fallback function or an anonymous code path.