Registry Mirror
Skip to content

Conversation

@avrabe

@avrabe avrabe commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Refs #1785
Refs #929

What

#1791 passed i64 call arguments per AAPCS for direct calls only. It refused call_indirect with #929, because no per-type width table reached the selector. So a Rust-built component that calls through a vtable or a closure with an i64 parameter could not be compiled. This PR is that missing half.

Evidence

what main c0bd12a this branch
i64_call_indirect_args_hosted_1785 (new): 7 signatures × 5 steps on cortex-m4, cortex-m3 and cortex-m7 --relocatable, kiln vs unicorn RED: 21 of 21 modules refused with #929 105 steps agree
i64_call_indirect_args_self_contained_1785 (new): --cortex-m image on cortex-m4 RED: 7 of 7 refused with #929 35 steps agree
potency: swap an i64's register halves in call_arg_marshal 72 of 105 hosted + 24 of 35 self-contained steps red
potency: swap an i64's stack words 21 of 105 hosted + 7 of 35 self-contained steps red
spec_exec_1636_differential.py PASS, 35787 executed PASS, 35789 executed (+1 per leg: left-to-right i64_call_indirect, which passes)
selector_parity_197 PASS 17963/17963 PASS 17964/17964
reinterpret_pair_1603_differential.py PASS, 2548 emulations PASS, 2548
arm_corpus_sweep_973 PASS, compiled 197/225, executed 3843/3843 same
home_alias_audit_corpus_1189 PASS, 9435 homes, 0 hits same
wrong_code_census 34 rows: 0 LIVE-WRONG, 30 FIXED, 4 NOW-DECLINES same
spec_compile_census.py skipped functions m4f 1482, m7dp 1387, arm 1556 1481, 1386, 1555 (pins updated; no file bucket moves)
byte identity: 307 inputs (scripts/repro, tests/, examples/; .wat/.wasm/.wast) × 4 legs (m4 --relocatable, m4 --cortex-m, m7dp --relocatable, m3 --relocatable) 882 identical, 346 refused by both, 0 differing, 0 one-sided

The sweep corpus contains no i64-argument call_indirect, so it is identical everywhere. The new behaviour is covered by the oracle modules, which main refuses.

The signatures are (i64, i32), (i32, i64) with R1 skipped, (i64, i64, i64) with the third on the stack, four i32 then an i64 (stacked), an i64 then four i32 (two stacked), and two with an i32 result. Each module's table holds a decoy of the same type in slot 0. p_ind computes the table index at run time, so the index sits in a register while the arguments move. The two potency mutants were built from this tree with one line changed and run as SYNTH; the source was restored and checked by sha. Those steps stay green under a swap because both words are equal (all-ones or zero vectors) or because no i64 is passed in a register or on the stack in that signature.

Harness. The hosted harness used to refuse any module with a table. A new opt-in, HostConfig::funcref_tables, plays the embedder's table step: it writes the funcref tables at R11 + 0 in the #650 layout from docs/embedder-abi-relocatable-arm.md, as func_N | 1. It refuses imported tables, non-const offsets, entries that are not plain ref.func, and tables that mix types. value::funcref_table_image builds the image and has a unit test.

Gates (local, head dc750c4)

gate result
cargo fmt --check rc 0
cargo +1.100.0 clippy --workspace --all-targets -D warnings rc 0
clippy -p synth-oracle --features exec --all-targets -D warnings rc 0
cargo test -p synth-core / -p synth-synthesis / -p synth-backend 299 / 1093 / 613 passed, 0 failed
cargo test -p synth-cli --no-fail-fast 540 passed, 0 failed, 2 ignored (frozen_codegen_bytes 10 passed)
oracle-kiln.yml "kiln oracles" step, run block executed whole (CARGO_TERM_COLOR=always) rc 0
claim_check.py claims.yaml 82/82; --emit-status committed
workflow_strict_check.py rc 0

fmt, clippy, claims and the census ran on dc750c4. The other rows ran on 940a28a; dc750c4 changes only the census pin and its ledger line.

Ledger

  • claims.yaml: selector_lines_code 21566 -> 21620 (+54), with a waiver bound to 21620. That covers the per-type tables, the setter and indirect_call_arg_widths; no second lowering and no wildcard arm. selector_lines_total 32725 -> 32820 (+54 code, +41 for the new selector unit test). The census pin binding is updated too.
  • .github/workflows/oracle-kiln.yml: two new exact ORACLE pins. i64_call_args_1785 now reports 5 passed, so "5 passed" occurs 2 times and "3 passed" 8 times. The lib unit count goes 31 -> 32. The ordinal comments are renumbered.
  • scripts/spec_compile_census.py: an existing Python pin was edited (SKIPPED_FUNCTION_PINS). No new Python.
  • CLI decline fixtures: i64_call_arg_decline_929.rs, skipped_export_exit_952.rs and export_alias_symbols_1746.rs used the i64 call_indirect shape as a "still declines" fixture. That shape now compiles, so i64_call_arg_decline_929.rs asserts it is emitted and pins the remaining residual: f32 beside i64 on cortex-m4f gives [CRITICAL] thumb-2 silently miscompiles any call with an i64 parameter that is not last — args land in the wrong registers, exit 0, no warning #929. The other two use an f32 op on cortex-m3 instead.
  • artifacts/planning-v0.92-draft.yaml: RQ-92-I64ARGS records the indirect half and the remaining residual.

Not in this PR

  • Indirect AAPCS-VFP: a call_indirect whose type has f32/f64 params (GI-FPU-002 still declines it).
  • The single-function self-contained path (--func-name without --relocatable) does not get the per-type table, and it does not get func_params_i64 either. It makes no difference there: that path refuses any call before marshalling (a direct call because of its relocation, and call_indirect because there is no table image). This was probed on main and on this branch with the same refusal. --relocatable --func-name goes through the module path and compiles both shapes.
  • The #518/#837 callee-prologue residual from ARM: marshal i64 call arguments in AAPCS register pairs and on the stack #1791 is unchanged. The oracle's callees start with call $nop for the same reason.
  • Not run locally: Bazel, Renode, the spec-suite workflow's other jobs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

avrabe and others added 3 commits December 5, 2026 07:16
The indirect half of #1785. A call_indirect with a 64-bit argument was
refused (#929: "a call_indirect has no per-type width table"), so a
Rust-built component calling through a vtable or closure with an i64
parameter could not be compiled.

- The decoder's per-TYPE masks (type_params_i64, lumped i64/f64 like
  func_params_i64, plus type_params_f32/f64) reach DecodedModule,
  CompileConfig, the CLI's --all-exports path and the ARM backend, which
  hands them to the selector (set_callee_type_params).
- The call_indirect arm lays its core arguments out with the SAME plan as
  a direct call: pop_call_args, call_arg_marshal (aapcs_param_layout),
  call_nsaa_bytes for the outgoing area, one sequentialized parallel move,
  stack stores before preservation. Widths come from
  indirect_call_arg_widths(type).
- Caller/callee agreement: the decoder copies func_params_i64[f] from
  type_params_i64[type of f], the callee prologue homes params with
  aapcs_param_layout over that mask, and the table guard admits only a
  callee of the same structural type class.
- Still refused by name: a type with any f32/f64 param stays all-narrow
  (no indirect AAPCS-VFP), so its i64 is refused (#929) or the float op
  declines first; an absent table (hand-built streams, the .wast merge)
  refuses any 64-bit operand (#929).

Evidence: crates/synth-oracle/tests/i64_call_args_1785.rs gains two
call_indirect tests (105 hosted steps on 3 --relocatable legs, the hosted
harness now writing the funcref table at R11 per the embedder ABI; 35
self-contained --cortex-m steps). Every module refused with #929 on main
c0bd12a. Byte identity: 882 of 882 compiled outputs identical over 307
inputs x 4 legs.

claims.yaml: selector_lines_code 21566 -> 21620 waived, total 32725 ->
32820. oracle-kiln.yml: two new exact ORACLE pins, result-line counts.
Three CLI decline fixtures that used the now-compiling shape are moved
to a decline that stays.

Refs #1785
Refs #929

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
The census function pins move by exactly one export per ARM leg:
arm_m4f 1482 -> 1481, arm_m7dp 1387 -> 1386 (unpinned arm 1556 -> 1555).
left-to-right.wast `i64_call_indirect` makes a call_indirect with i64
arguments and is now marshalled from the per-type width table; its
f32/f64 twins stay skipped. spec_exec_1636 executes its assert_return on
both legs (35787 -> 35789 executed directives, both pass). No file bucket
moves. Base binary c0bd12a measures exactly the old pins.

Existing Python pin edited (SKIPPED_FUNCTION_PINS), and its claims.yaml
binding.

Refs #1785

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
`scripts/mutation_survey.py reanchor`: 19 sites moved, 0 not found (four
arm_backend.rs R1-routing sites the CI subset named, +7 lines each).
Line numbers only.

Refs #1785

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@avrabe
avrabe force-pushed the v092-callindirect-i64-1785 branch from f9372c2 to 175d03d Compare December 5, 2026 06:25
@codecov

codecov Bot commented Dec 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.22034% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-oracle/src/value.rs 86.36% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

The audit on this branch (run 47488868774) printed functions audited
7941 (was 7937) and attributed instructions 245570 (was 245462); homes
watched 9435 and hits 0 are unchanged, RESULT: PASS. The pins move
because more functions compile, not because the audit found anything.

Refs #1785

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
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