Skip to content

Perf: add guarded integer specialization to the baseline JIT #56

Description

@chrisbbreuer

Problem

After block accounting, register-resident locals, compare/branch fusion, and hot-successor batching, the arithmetic kernel remains roughly 2.8x behind the accepted JSC direct result. Repeated A/B experiments show that removing FP moves or constant-divisor setup is neutral: the critical path is keeping integer loop state as f64, validating it, converting it to u32, dividing, and converting it back on every %.

Goal

Add a semantics-preserving guarded integer specialization that keeps proven integer locals and operands in GPRs and falls back before observable native work when entry assumptions fail.

Required work

  • Add per-parameter integer/range guards evaluated before native step accounting or slot mutation.
  • Extend numeric dataflow with integer provenance and conservative ranges across loops/merges.
  • Allocate integer locals/operand values to GPRs while retaining canonical Number publication at safepoints and returns.
  • Lower integer add/sub/mul/comparisons and constant remainder without repeated f64 round trips.
  • Define checked overflow handling: prove ranges, use an exact cold semantic path, or deopt at the precise bytecode IP without duplicating steps.
  • Preserve max-step+1 errors, 1,024-step GIL/GC/termination checkpoints, NaN/-0/fractional behavior through guarded fallback, and escaped-frame rejection.
  • Add focused guard/deopt/range tests plus order-balanced arithmetic A/B evidence.
  • Keep the accepted symmetric JSC report unchanged until the optimization batch is material.

Parent JIT: #52
Arithmetic target: #46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions