Summary
The Geyser VM executes top-level script statements once at load time. The official Graal client re-executes top-level statements on every script invocation (e.g. each onTimeout firing). This mismatch causes false passes in the harness.
Repro
//#CLIENTSIDE
mem = new[4];
function onCreated() {
mem[0] = 10;
setTimer(0.5);
}
function onTimeout() {
showtext(200, 10, 10, "Arial", "", "mem[0]=" @ mem[0]);
changeimgvis(200, 6);
mem[0] = mem[0] + 1;
setTimer(0.5);
}
Expected (official client)
Frame 1 shows mem[0]=10, then every frame shows mem[0]=0 (or blank) — top-level mem = new[4] re-runs before each invocation, wiping the array.
Actual (Geyser VM)
Frames show mem[0]=10, 11, 12, 13... — top-level ran once at load, the array persists.
Impact
This masked a real bug in wasm2gs2-generated code: the transpiler emitted mem = new[16] at top-level, which the official client wiped on every frame (ball/paddles stuck at 0,0). The harness showed it working because Geyser never re-ran the top-level reset. Moving the allocation into onCreated() (fires once) fixed it on official.
Suggested fix
Re-execute top-level statements before each event dispatch (onTimeout, onCreated, etc.), matching official client semantics.
Summary
The Geyser VM executes top-level script statements once at load time. The official Graal client re-executes top-level statements on every script invocation (e.g. each
onTimeoutfiring). This mismatch causes false passes in the harness.Repro
Expected (official client)
Frame 1 shows
mem[0]=10, then every frame showsmem[0]=0(or blank) — top-levelmem = new[4]re-runs before each invocation, wiping the array.Actual (Geyser VM)
Frames show
mem[0]=10,11,12,13... — top-level ran once at load, the array persists.Impact
This masked a real bug in wasm2gs2-generated code: the transpiler emitted
mem = new[16]at top-level, which the official client wiped on every frame (ball/paddles stuck at 0,0). The harness showed it working because Geyser never re-ran the top-level reset. Moving the allocation intoonCreated()(fires once) fixed it on official.Suggested fix
Re-execute top-level statements before each event dispatch (
onTimeout,onCreated, etc.), matching official client semantics.