Skip to content

Thread hot Smi BitAnd successors - #90

Merged
chicoxyzzy merged 2 commits into
mainfrom
perf/smi-bitwise-threading
Jul 31, 2026
Merged

Thread hot Smi BitAnd successors#90
chicoxyzzy merged 2 commits into
mainfrom
perf/smi-bitwise-threading

Conversation

@chicoxyzzy

Copy link
Copy Markdown
Owner

Summary

  • Thread full-width and i16 Smi BitAnd successors through Lantern's existing Int32 fast path.
  • Preserve the ordinary bytecode and both JIT tiers; non-Int32 operands still use the canonical coercion/BigInt/throw path.
  • Deliberately exclude LdaSmi8 to avoid charging Splay's 2.08 million nonmatching compact loads.
  • Add direct-transfer, exclusion, Double, coercion, and caught-throw coverage plus benchmark and conformance history.

Why

Crypto executes 3,158,688 LdaSmi16 -> BitAnd pairs and 1,488,595 full-width LdaSmi -> BitAnd pairs. The retained implementation bypasses 4,646,882 indirect successor dispatches while keeping all logical bytecode telemetry unchanged.

Broader opcode and split-handler prototypes were rejected because they regressed zero-hit workloads or caused a whole-function LLVM layout phase change. The retained in-arm hybrid adds only 96 native bytes and uses an unlikely side edge so the dominant ordinary decode path remains favored.

Performance

Pinned x86_64, CPU 3, 40+40 paired physical roles:

  • six-macro neutral geometric mean: 0.9795x (2.05% faster)
  • targeted Crypto 60+60: 0.9710x
  • zero-hit arith_loop 60+60: 0.9895x
  • worst macro: Splay 1.0055x
  • 60+60 confirmations: DeltaBlue 0.9881x, Splay 1.0095x

No workload crossed the 2% regression ceiling.

Validation

  • Focused bytecode-stats/coercion tests: 4/4 pass
  • Full ReleaseSafe units: 3,184 pass, 464 intentional skips
  • Exact-main/candidate bitwise-and test262 pass lists: identical at 29 pass / 1 known fail
  • ReleaseSafe gc-threshold=1 bitwise-and sweep: identical 29/1 result
  • Full non-cached test262: 48,653 pass / 1,324 fail, no change
  • ShadowRealm sweep: 63 pass / 1 fail, no change
  • Complete Crypto stats reports are byte-identical after normalizing only direct-transfers

@chicoxyzzy

Copy link
Copy Markdown
Owner Author

Multi-agent review completed across three independent tracks:

  • runtime semantics: instruction-pointer movement, operand order, Int32 fast path, coercion/BigInt/throw fallbacks, GC/rooting, telemetry, and JIT interaction
  • tests and telemetry: logical opcode accounting, duplicate-execution detection, eligible-width slow paths, GC re-entry, and BigInt/Number behavior
  • performance and documentation: A/B arithmetic, neutral ratios, transfer counts, native-size claims, prior-art citation, and test262 provenance

The reviewers found no production semantic defect. Their test/reporting findings were addressed in 4963dded, the focused ReleaseSafe bytecode-stats tests pass, and both affected reviewers re-reviewed the follow-up with no remaining actionable findings.

This is an independent subagent review summary, not a formal GitHub approval.

@chicoxyzzy
chicoxyzzy marked this pull request as ready for review July 31, 2026 10:42
@chicoxyzzy
chicoxyzzy merged commit 2758c53 into main Jul 31, 2026
34 checks passed
@chicoxyzzy
chicoxyzzy deleted the perf/smi-bitwise-threading branch July 31, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant