Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Dispatch extern method calls through the external symbol and C ABI lowering path

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

Method syntax for an extern function bypasses the dispatcher used for an ordinary extern call. Symbol aliases, aggregate ABI transport and variadic argument validation therefore diverge.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

extern(c,"abs") fun ext_abs(i32)->i32;fun main()->i32{var x:i32=-3;return x.ext_abs();}
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=check
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=ir --out-dir out

Observed: check exits 0; IR fails E9001, validated method must have a lowered function. With a three-i32 struct receiver and extern(c) take(S), check passes but IR reports an integer/struct ABI type mismatch. A printf-style variadic method also rejects extra arguments before lowering; these are grouped as one dispatch cause.

Scope

Reuse external symbol lookup, C ABI classification and variadic handling for the method receiver and remaining arguments. Preserve single evaluation/source order.

Starting points: llvm/src/expression/rvalue/calls.rs:181.

Completion criteria

  • [ ] Aliased extern methods match equivalent ordinary extern calls.
  • [ ] Add scalar, aggregate and variadic controls for the selected C ABI.
  • [ ] Keep internal Wave methods and default-argument receiver positions unchanged.

Related: #350, #736. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev