Registry Mirror
Skip to content

Conversation

@avrabe

@avrabe avrabe commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What #1568 left open

Under --native-pointer-abi, R11 is 0. v0.88 made positional constant addresses relocate or refuse, and left two shapes silently wrong:

  1. A constant pointer routed through a local: i32.const 0x1004 local.set 0 local.get 0 i32.load, plus the store, i64 and tee twins.
  2. A dynamic access whose memarg offset= lands in the static region of a module with no stack-pointer global.

Refuting command, run first (0161dee, executed against wasmtime, R11 = 0)

10 of 14 probe calls were wrong, and none were refused:

Probe Result
Shape 1, no stack-pointer global (load, byte load, 0x100, tee, store, reload, i64) 7 of 7 wrong
Shape 1 with a stack-pointer global 3 of 3 already correct (the #237 rule)
The stack-pointer sliver reached through a local wrong
Shape 2 2 of 2 wrong

Shape 1: fixed or refused

  • npa_local_const_plan covers every non-parameter local whose every definition stores an immediately preceding i32.const. It relocates those constants where they are defined (__synth_wasm_data + C, the rewrite a stack-pointer global already gives) only when all four conditions hold:
    • the module has no stack-pointer global;
    • bounds checking is off;
    • a set at block depth 0 precedes every read, so the zero initial value is never observed;
    • every read is the exact address (memarg offset 0) of a scalar load or store.
  • npa_const_addr_guard resolves local.get and local.tee operands through the plan. It refuses every other value that would bake, on every arm, including i32: the i32 fold matches only a positional i32.const.
  • Why a non-zero offset is refused rather than relocated: I tried relocating it. With offset 0x1000 the access read the zero reservation, 0x0 against wasmtime's 0x66. The mixed split retargets __synth_wasm_data + C by C alone.

Red to green: SYNTH=<bin> python3 scripts/repro/npa_const_addr_differential.py

Binary Exit Result
0161dee (= origin/main, built clean in this worktree before any edit) 1 7 BUG rows; all 5 new refusal rows compile
this branch 0 38/38 equal, 13 refusal rows

Mutations, each red:

  • dropping the address-only condition;
  • dropping the zero-initial-value condition;
  • allowing any offset;
  • not rewriting the definition (7 BUG).

New Rust tests are in crates/synth-cli/tests/npa_const_addr_never_baked.rs. cargo test -p synth-synthesis -p synth-cli gives 1497 passed, 0 failed.

Shape 2: a decision for the maintainer (not implemented)

Population re-derived. #1568's 184 is the 226 inputs compiled with --target cortex-m3 --relocatable --native-pointer-abi --all-exports at f982481. Its 62 is "no stack-pointer global and linmem > 0", reproduced exactly; with data segments as the definition of a static region the count is 8. At 0161dee the population is 58 of 180.

Newly refused out of 180, measured by real compiles:

Option Newly refused What it leaves open
A: any dynamic access, no SP global, memory 25 refuses the GI-NPA-001 host-pointer seam
B: offset > 0 in the static region 11 with no SP global, wasm_data_base = 0, so this is the blanket rule renamed
C: offset ≥ lowest data segment 0 BSS-only modules, offsets below the first segment, wasm-offset bases
D: offset inside a declared data segment 0 same as C; the likeliest pick
E: offset ≥ 0x1000 5 arbitrary threshold
F: offset ≥ 1024 7 arbitrary threshold
relocate the offset (#359 semantic) — refuted by execution: double relocation faults

The selector cannot tell a host-pointer base from an index base, so no option is sound. Shape 1 newly refuses 0 of 180.

NEW, pre-existing, not fixed: modules WITH a stack-pointer global (gale's shape)

A relocated pointer constant plus a non-zero offset that leaves the constant's region is silently wrong:

(module (memory (export "mem") 1)
  (global $sp (mut i32) (i32.const 0x800))
  (data (i32.const 0x900) "\aa\bb\cc\dd")
  (data (i32.const 0x2000) "\31\32\33\34\35\36\37\38")
  (func (export "anchor") (result i32) (i32.load (i32.const 0x900)))
  (func (export "x") (result i32) i32.const 0x900 i32.load offset=0x1704)   ;; faults: both parts relocated
  (func (export "y") (result i32) i32.const 0x1900 i32.load offset=0x704))  ;; 0x0 vs wasmtime 0x38373635

This PR does not change it. It is listed as NOT covered in the oracle header and in the lane record.

What moved

  • Byte identity: 1356 compiles (226 inputs × 6 configs: m3 reloc, m3 reloc npa, default, m4f reloc npa, m7dp reloc npa, m3 self-contained). 0 differ in bytes or exit code, with or without the flag.
  • island_offset_invariant_345.py: 307 clean objects, unchanged.
  • Emulation floor: 368110 → 368120 (+10, npa_const_addr_differential.py 28 → 38). Computed against origin/main 0161dee; sibling v0.89 lanes also move it, so re-derive at merge. ci.yml and claims.yaml were moved together; oracle_wiring_check.py --exact-emulation-floor 368120 exits 0.
  • Selector ratchet: selector_lines_code 20125 → 20384, with a waiver and a written reason. selector_lines_total 30718 → 30977 (track). No wildcard arm added. artifacts/status.json regenerated.
  • Mutation ledger re-anchored on the final tree: 6 sites moved, 0 lost.
  • Floor control: at this tree oracle_wiring_check.py --exact-emulation-floor 368120 exits 0 and 368110 exits 1. The control for the selector ratchet is claim_check, which was red before the ledger edit.

Sweep: every python3 scripts/... in ci.yml, run locally

300 invocations, run sequentially with bash -o pipefail and timeouts. mutation_survey.py ci and ci_mutants_gate.py were skipped; test_mutation_survey.py was run. Everything else exited 0 except the following.

  • Environmental baseline: oracle_evidence.py (11×), check_varve_shadow_pins, determinism_check, mcdc_gate, elf_static_check (5×), emit_vex (2×).

  • Also environmental:

    • arm64_linux_host_link_rq64 (2×): no qemu-aarch64. Byte-identical failure at the 0161dee binary.
    • wast_callgraph_closure_1168: needs the CI-built target-275probe binary.
    • fact_spec_*_494 (10×): need a --features verify build.
    • wcet_phase{2,6,7}_*: need --emit-wcet, which is feature-gated.

    None of the fact_spec or wcet scripts mention native-pointer, and the plan and the guard both return immediately without the flag. The 0-moved non-npa configs of the byte sweep confirm it. They were not run with feature builds.

  • Selector parity on the populated corpus: selector_parity_197 first failed because tests/spec-testsuite was empty. After git submodule update --init tests/spec-testsuite it gave rc=0: 261 modules, 17924/17924 assertions, 25308 emulations against a floor of 20000. The other spec-testsuite readers were re-run on the populated corpus and all exited 0: home_alias_audit_corpus_1189 (7307, 2008 compiles), invalid_accept_1207 (39), false_reject_1229 (12), ra003_join_1230 (8), aarch64_operand_class_1231 (3) and arm_corpus_sweep_973 (3490 emulations).

  • Lane record RQ-89-NPARESIDUE: implemented, issue-scope: outlives.

Refs #1568

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.34884% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-synthesis/src/instruction_selector.rs 95.23% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

t and others added 3 commits October 23, 2026 03:27
…ted or refused under --native-pointer-abi

fixes the first and measures the second.

Shape 1: a constant pointer routed through a local, as in
`i32.const 0x1004 local.set 0 local.get 0 i32.load`. At 0161dee all 7
no-stack-pointer probe calls were wrong: load, byte load, low 0x100,
tee, store, i64, and a store followed by a reload.
npa_local_const_plan relocates such a local's i32.const definitions
(__synth_wasm_data + C) when every read is the exact address of a
scalar access, the module has no stack-pointer global, bounds checking
is off, and a set at depth 0 precedes every read. npa_const_addr_guard
resolves local.get/local.tee operands through the plan and refuses
every other value that would bake, on every arm.

npa_const_addr_differential.py: 38 of 38 equal against wasmtime with
13 refusal rows. At 0161dee it exits 1 with 7 BUG rows, and all 5
new refusal rows compile there.

Corpus cost: 0 of the 180 inputs that compile under the flag newly
refuse. Byte sweep: 1356 compiles, 0 moved, with and without the flag.

Shape 2: a dynamic access whose memarg offset lands in the static
region of a module with no stack-pointer global. Not implemented. The
options and their measured costs are in RQ-89-NPARESIDUE for the
maintainer. Also recorded there: a new pre-existing class in modules
WITH a stack-pointer global, where a relocated constant plus a non-zero
offset leaves the constant's region.

Refs #1568

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@avrabe
avrabe merged commit 0b9fce7 into main Oct 23, 2026
78 of 79 checks passed
@avrabe
avrabe deleted the v089-npresidue branch October 23, 2026 02:38
avrabe pushed a commit that referenced this pull request Oct 23, 2026
…el at an unreachable block join, and lands a function-level br_table edge after the dispatch

RQ-89-BRVALUE (Refs #1215): DELIVERED. select_with_stack, the one
lowering every affected function takes on both legs (all are pre-gated
to it), had two defects:

- At a block whose fall-through is unreachable but which a branch
  targets, the simulated operand stack was never reset to the block's
  entry height. Values pushed by dead code after a br/br_table were
  consumed by the code after the block (br.wast
  nested-br_table-value-index returned 12; wasmtime returns 9).
  BlockLabel now records the entry height, the live prefix at the first
  unconditional transfer, and whether a branch targets the join. End
  resets the model, propagates unreachability out of a loop or an
  untargeted block, and loud-refuses if dead code reached below the
  entry height.
- A function-level br_table edge landed its carried value in R0 before
  the dispatch cascade, overwriting an index held in R0
  (func.wast break-br_table-nested-num(1) returned 52; wasmtime
  returns 50). The landing now follows the br_table_fnret label.

Evidence:
- New oracle brvalue_operand_1215_differential.py, run on the default,
  --no-optimize and --relocatable legs: 57/144 on v0.88.0, 144/144 on
  the fix.
- Parity oracle with its five #1215 pins removed: red on v0.88.0 with
  exactly those 11 assertions, green on the fix (17934/17934).
- Byte census: zero newly refused functions. Three VCR-RA-003 refusals
  pinned under #1230 now compile correctly, so that oracle's census
  moves from 3 to 0.

RQ-89-SELWRAP (Refs #1213): REFUTED. as-convert-operand and the issue's
distinguishing probe agree with wasmtime on every leg, because the
optimized path has declined the shape since v0.65.

Also in this commit, squashed from three follow-ups when it was rebased
onto 0b9fce7 (#1577/#1578/#1579):
- The ARM corpus sweep drops ra003_switch_1230.wat from
  EXPECTED_DECLINES. It now compiles, and its 12 vectors match wasmtime.
- The reach this moves is counted and pinned:
  - Spec compile census: labels.wast moves partial -> ok, so arm ok is
    16, partial 29 and MVP core 13.
  - Home-alias audit: the new fixture adds +60 functions, +48 homes and
    +916 attributed instructions.
  - Mutation replay: the liveness entry's changed set is 53 -> 56, the
    +3 being the new fixture.
- The exact emulation floor is re-derived on the merged tree, the
  mutation ledger is re-anchored, and the selector ratchets are chained
  over the INTALIAS and NPARESIDUE waivers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
avrabe added a commit that referenced this pull request Oct 23, 2026
…el at an unreachable block join, and lands a function-level br_table edge after the dispatch (#1583)

RQ-89-BRVALUE (Refs #1215): DELIVERED. select_with_stack, the one
lowering every affected function takes on both legs (all are pre-gated
to it), had two defects:

- At a block whose fall-through is unreachable but which a branch
  targets, the simulated operand stack was never reset to the block's
  entry height. Values pushed by dead code after a br/br_table were
  consumed by the code after the block (br.wast
  nested-br_table-value-index returned 12; wasmtime returns 9).
  BlockLabel now records the entry height, the live prefix at the first
  unconditional transfer, and whether a branch targets the join. End
  resets the model, propagates unreachability out of a loop or an
  untargeted block, and loud-refuses if dead code reached below the
  entry height.
- A function-level br_table edge landed its carried value in R0 before
  the dispatch cascade, overwriting an index held in R0
  (func.wast break-br_table-nested-num(1) returned 52; wasmtime
  returns 50). The landing now follows the br_table_fnret label.

Evidence:
- New oracle brvalue_operand_1215_differential.py, run on the default,
  --no-optimize and --relocatable legs: 57/144 on v0.88.0, 144/144 on
  the fix.
- Parity oracle with its five #1215 pins removed: red on v0.88.0 with
  exactly those 11 assertions, green on the fix (17934/17934).
- Byte census: zero newly refused functions. Three VCR-RA-003 refusals
  pinned under #1230 now compile correctly, so that oracle's census
  moves from 3 to 0.

RQ-89-SELWRAP (Refs #1213): REFUTED. as-convert-operand and the issue's
distinguishing probe agree with wasmtime on every leg, because the
optimized path has declined the shape since v0.65.

Also in this commit, squashed from three follow-ups when it was rebased
onto 0b9fce7 (#1577/#1578/#1579):
- The ARM corpus sweep drops ra003_switch_1230.wat from
  EXPECTED_DECLINES. It now compiles, and its 12 vectors match wasmtime.
- The reach this moves is counted and pinned:
  - Spec compile census: labels.wast moves partial -> ok, so arm ok is
    16, partial 29 and MVP core 13.
  - Home-alias audit: the new fixture adds +60 functions, +48 homes and
    +916 attributed instructions.
  - Mutation replay: the liveness entry's changed set is 53 -> 56, the
    +3 being the new fixture.
- The exact emulation floor is re-derived on the merged tree, the
  mutation ledger is re-anchored, and the selector ratchets are chained
  over the INTALIAS and NPARESIDUE waivers.


Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

Co-authored-by: t <t@t>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
avrabe pushed a commit that referenced this pull request Oct 23, 2026
Rebased onto bbda3f9 (#1577 RELOCSINGLE, #1578 INTALIAS,
#1579 NPARESIDUE, #1583 BRVALUE). The census conflict was resolved
by taking main's numbers and pinning the LIVE census of the rebuilt
binary: arm 16 ok / 27 partial / 92 all_declined / 103
module_decline, riscv 9/31/94/104, aarch64 21/21/78/118, and
at-least-one-export 43/40/42. Paired: main's binary passes main's
pins and fails ours 9 ways; ours passes ours and fails main's 9 ways.
The lane record now quotes the merged-tree figures: parity
17934/17934, 2736 modules, 828 byte-identical compiles.
mutation_survey.json reanchored: 7 sites moved +96 lines in main.rs;
no count changed.

Refs #1582
Refs #1209

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