VM: closure env chain for GLOBAL_GET/SET + remove JIT skip
vm_closure now stores the original closure env (vm_closure_env). GLOBAL_GET walks the closure env chain when the variable isn't in vm.globals. GLOBAL_SET writes to the correct env in the chain. This enables JIT compilation of all named functions regardless of closure depth. No more closure skip check needed. Pre-compile time back to ~7s (was 37s with closure skip). Note: sx-parse sibling list parsing still has issues — the root cause is in how the JIT-compiled letrec + OP_CLOSURE interacts with the upvalue cell mechanism. Investigation ongoing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -913,9 +913,6 @@ let register_jit_hook env =
|
||||
| Some _ -> None (* compile failed — CEK handles *)
|
||||
| None ->
|
||||
if !_jit_compiling then None
|
||||
else if l.l_closure.bindings != env.bindings then
|
||||
(* Skip JIT for inner functions — closure != globals *)
|
||||
None
|
||||
else begin
|
||||
let fn_name = match l.l_name with Some n -> n | None -> "?" in
|
||||
_jit_compiling := true;
|
||||
@@ -1300,7 +1297,7 @@ let rec dispatch env cmd =
|
||||
try
|
||||
Sx_vm.call_closure
|
||||
{ vm_code = code; vm_upvalues = [||]; vm_name = lam.l_name;
|
||||
vm_env_ref = live_env }
|
||||
vm_env_ref = live_env; vm_closure_env = None }
|
||||
args live_env
|
||||
with
|
||||
| _ ->
|
||||
|
||||
Reference in New Issue
Block a user