makepad/libs/stitch/src
ymote 71c9ddcbb9
stitch: a host call no longer leaves its handler's frame on the native stack (#1294)
call_host and the host branch of call_indirect got the trampoline's
Result<StackGuard, Error> back through a stack slot in the handler's own
frame. That slot's address escapes into the call, so LLVM could not turn
the handler's final call to the next instruction into a sibling call, and
every host call left a frame behind, roughly 150-200 bytes each (Apple
M5 Max). A module that calls a host function in a loop overflowed an
8 MiB thread after 40,000-60,000 calls and aborted the process; calls
between wasm functions were not affected.

The host call now happens in an out-of-line helper, so the slot lives in
the helper's frame. A million host calls run on a 1 MiB stack, and a host
call is faster: about 22 ns before, 10 ns after, in a release build.

tests/host_calls.rs loops a million direct and indirect host calls on a
1 MiB thread. Without the fix both abort with a stack overflow, in debug
and release builds.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 23:00:33 +02:00
..
aliasable_box.rs Initial commit 2025-05-06 10:11:37 +02:00
code.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
compile.rs engine libs: render and sim for a strategy round, the per-unit decision hook, the mp4 sample index, stitch and xatlas quieted, example refresh 2026-09-01 16:46:35 +02:00
config.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
const_expr.rs Initial commit 2025-05-06 10:11:37 +02:00
data.rs Initial commit 2025-05-06 10:11:37 +02:00
decode.rs Initial commit 2025-05-06 10:11:37 +02:00
downcast.rs Initial commit 2025-05-06 10:11:37 +02:00
elem.rs Initial commit 2025-05-06 10:11:37 +02:00
engine.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
error.rs Initial commit 2025-05-06 10:11:37 +02:00
exec.rs stitch: a host call no longer leaves its handler's frame on the native stack (#1294) 2026-10-12 23:00:33 +02:00
extern_.rs Initial commit 2025-05-06 10:11:37 +02:00
extern_ref.rs Initial commit 2025-05-06 10:11:37 +02:00
extern_val.rs Initial commit 2025-05-06 10:11:37 +02:00
func.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
func_ref.rs Initial commit 2025-05-06 10:11:37 +02:00
global.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
instance.rs Initial commit 2025-05-06 10:11:37 +02:00
into_host_func.rs Initial commit 2025-05-06 10:11:37 +02:00
lib.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
limits.rs Initial commit 2025-05-06 10:11:37 +02:00
linker.rs Initial commit 2025-05-06 10:11:37 +02:00
main.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
mem.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
module.rs Initial commit 2025-05-06 10:11:37 +02:00
ops.rs engine libs: render and sim for a strategy round, the per-unit decision hook, the mp4 sample index, stitch and xatlas quieted, example refresh 2026-09-01 16:46:35 +02:00
ref_.rs Initial commit 2025-05-06 10:11:37 +02:00
simd.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
stack.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
store.rs platform: GPU passes store top-left rows on every backend, hosted apps get software frames as textures, the Android desk renders at 120 Hz, and the platform builds warning-free on every CI target 2026-09-26 20:08:13 +02:00
table.rs Initial commit 2025-05-06 10:11:37 +02:00
trap.rs Initial commit 2025-05-06 10:11:37 +02:00
val.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00
validate.rs engine libs: csg document, stitch simd, sim providers, teamtalk LAN voice, gltf writer, render, route and maps, bench hygiene 2026-08-29 09:26:27 +02:00