Skip to main content

CODESIZE_MAX_ITERATIONS

Constant CODESIZE_MAX_ITERATIONS 

Source
pub(crate) const CODESIZE_MAX_ITERATIONS: usize = 10;
Expand description

Maximum number of codegen passes of MAIN or the constructor used to converge __codesize.

When MAIN (or a constant referenced by MAIN) uses __codesize(RUNTIME), the runtime size depends on the embedded value, which depends on the runtime size. Likewise, when MAIN and the constructor push each other’s size, each size depends on the width of the other’s push. Each pass recompiles with the previous pass’s measured sizes. PUSH widths only grow (never shrink) across passes, and the size limits cap the values at PUSH3, so convergence takes 2–3 passes.