Root cause of for-each failure: CALL_PRIM checked globals before primitives. Globals had ho_via_cek wrappers that routed for-each through the CEK machine — which couldn't call VM closures correctly. Fix: check Sx_primitives.get_primitive FIRST (native call_any that handles NativeFn directly), fall back to globals for env-specific bindings like set-render-active!. Result: (for-each (fn (x) (+ x 1)) (list 1 2 3)) on VM → 42 ✓ Full adapter aser chain executing: aser → aser-list → aser-call → for-each callback Fails at UPVALUE_GET idx=6 (have 6) — compiler upvalue count off by one. Next fix: compiler scope analysis. Also: floor(0)=-1 bug found and fixed (was round(x-0.5), now uses OCaml's native floor). This was causing all compile failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
13 KiB
13 KiB