Skip to content
  • Damien George's avatar
    py: Reluctantly add an extra pass to bytecode compiler. · 1e1779ea
    Damien George authored
    Bytecode also needs a pass to compute the stack size.  This is because
    the state size of the bytecode function is encoded as a variable uint,
    so we must know the value of this uint before we encode it (otherwise
    the size of the generated code changes from one pass to the next).
    
    Having an entire pass for this seems wasteful (in time).  Alternative is
    to allocate fixed space for the state size (would need 3-4 bytes to be
    general, when 1 byte is usually sufficient) which uses a bit of extra
    RAM per bytecode function, and makes the code less elegant in places
    where this uint is encoded/decoded.
    
    So, for now, opt for an extra pass.
    1e1779ea