Skip to content

arm backend cannot lower memory.copy/memory.fill — 19 sites, falcon's largest remaining on-target gap #374

Description

@avrabe

Summary

The arm (Cortex-M) backend cannot lower memory.copy / memory.fill — they fall through the same _ => None decoder path as the scalar floats and (formerly) i64.load/store. Since v0.11.46 (GI-FPU-001) they loud-skip (good — no silent miscompile), but with i64.load/store now fixed in v0.11.47 (thanks for #372!), bulk-memory is the largest remaining unlowered gap in the falcon flight-control core: 19 sites (11 memory.fill + 8 memory.copy).

Reproduction (synth v0.11.47, minimal)

(module
  (memory 1)
  (func (export "cpy") (param i32 i32 i32) local.get 0 local.get 1 local.get 2 memory.copy)
  (func (export "fil") (param i32 i32 i32) local.get 0 local.get 1 local.get 2 memory.fill)
  (func (export "ld32") (param i32) (result i32) local.get 0 i32.load))  ;; control
$ synth compile bm.wasm -o bm.elf --target cortex-m7dp
warning: skipping function 'cpy': contains an unsupported operator (MemoryCopy { ... }) ...
warning: skipping function 'fil': contains an unsupported operator (MemoryFill { ... }) ...
# objdump -t: ld32 compiles; cpy/fil absent

(Note: #180 and #185 are closed and about different things — the MemLoad ADD-register path and an encoder panic — so this lowering gap appears untracked.)

Impact on jess

On the falcon fused core (v1.80 → meld → loom → synth --target cortex-m7dp, v0.11.47): of 41 remaining loud-skips, 19 are bulk-mem and the other ~19 are the FP set (#369). So once hard-float (#369) lands, bulk-mem is the last gap before the falcon firmware ELF is structurally complete (alongside dispatch #275). The gale-nano substrate does not use bulk-mem (per a gale-side profile), so this is falcon-specific.

Suggested fix

Lower memory.copy/memory.fill to a bounded inline loop (or a call to a kiln-builtins/compiler_builtins-style __aeabi_memcpy/memset already linked), with the wasm trap semantics on OOB (length/bounds checked against the linear-memory limit, matching wasmtime). Same _ => None contract as the others — decode → lower, or keep the honest loud-skip until it's lowered.

Thanks — filing from jess release-watch; happy to test against falcon-v1.56.fused.wasm.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions