Skip to content

fix(aot): support tagged operands for Shl and Ceq - #47

Open
fffonion wants to merge 1 commit into
subagent/es51-core-checked-master169-256167f4from
aot-tagged-shl-ceq
Open

fffonion wants to merge 1 commit into
subagent/es51-core-checked-master169-256167f4from
aot-tagged-shl-ceq

Conversation

@fffonion

@fffonion fffonion commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Adds two AOT SSA representation arms missing on the pinned revision:

  • Shl: accepts a tagged integer on either side, takes the full 64-bit payload, and shifts. Shift counts are checked with UnsignedLessThanOrEqual 63 (rejects -1 and >= 64), with the same check order as bridge.rs OP_SHL (rhs to int, range, lhs to int). Illegal inputs deopt through the existing materialize-and-trace-exit path, resuming at the shl bytecode with operands already on stack, so operands are evaluated once.
  • Ceq: adds Tagged × F64 and its reverse by boxing the scalar with its original tag and calling the existing TaggedCmpEq helper, preserving Value::eq semantics (Int != Float, +0.0 == -0.0, NaN != NaN).

No opcode, helper ABI, or VMBC format changes.

Tests: cargo test --test aot_tagged_number_tests 21 passed; cargo test --lib vm::aot 40 passed.

Read the full 64-bit payload of tagged Shl operands. Match interpreter error order for the RHS tag, shift range, and LHS tag, restoring the pre-instruction state at the guard exit.

Keep the specialized Ceq comparisons and use Value equality for tagged/scalar pairs, boxing the scalar without changing its tag. Differently typed scalar pairs are unequal. Preserve exact integers, signed-zero equality, and NaN inequality without changing the opcode or helper ABI.

Cover full-width shifts, validation order, and both operand orders for tagged/scalar and mixed-scalar equality. Assert native SSA completion without an interpreter boundary on valid inputs.
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