mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
709349e24b
The previous implementation was a bare tail-jump to tinygo_scanstack without spilling any registers or passing an sp argument. On Xtensa windowed ABI, heap pointers held in physical registers were invisible to the conservative GC, causing it to collect live objects and leading to nil pointer dereferences under allocation pressure. Flush all register windows to the stack using recursive call4 (15 levels for NAREG=64), then pass the current sp to tinygo_scanstack so the GC scan from sp to stackTop covers every live value. Interrupts are briefly masked during the spill to prevent window-overflow exceptions from interfering. Fixes crashes on ESP32-S3 observed when serving concurrent HTTP requests. Signed-off-by: deadprogram <ron@hybridgroup.com>