Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new, statically typed, JIT IR. #943

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Commits on Jan 30, 2024

  1. A new, statically typed, JIT IR.

    This reworks the JIT IR, incorporating the wisdom we've absorbed through
    studying PyPy and LuaJIT's JIT IRs.
    
    The JIT IR is now a vector of word-sized instructions that can be
    matched and destructured using Rust's type system. This differs slightly
    from PyPy and LuaJIT, which use bytestreams, but we want static
    type-safety.
    
    Any information that can't fit inline in the instruction word (e.g.
    operands and their types) are referenced using indices into an auxiliary
    vector containing the overflow information. This idea was borrowed from
    LuaJIT.
    
    Some of the auxiliary vectors are stored in the AOT module, thus sharing
    constructs with the AOT IR, for example, functions and types. Indices
    for these vectors are 24-bit. Indices for the other auxiliary vectors
    are 16-bit and for these there is (currently) no sharing with the AOT
    module.
    
    Obviously the reduced-size indices mean that we can only represent a
    limited number of vector elements. This is fine, as we don't expect
    traces to be so large that the indices overflow and if they do we can
    just abort the trace and remain sound.
    
    A note on mutability: you may mutate the instruction stream so long as
    you don't cause any index skew. It's OK to replace/mutate an
    instruction, but you must NOT remove instructions.
    
    The AOT IR remains immutable.
    
    The IR is not finished and has a lot of dead code, hence we mark the
    whole module `#![allow(dead_code)]`. This will eventually be deleted.
    
    Co-authored-by: Edd Barrett <[email protected]>
    ptersilie and vext01 committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    875cc02 View commit details
    Browse the repository at this point in the history