Aser adapter compiles + loads as VM module — first VM execution
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -744,13 +744,10 @@ let dispatch env cmd =
|
||||
| exn -> send_error (Printexc.to_string exn))
|
||||
|
||||
| List [Symbol "aser-slot"; String src] ->
|
||||
(* Like aser but expands ALL components server-side, not just
|
||||
server-affinity ones. Uses batch IO mode: batchable helper
|
||||
calls (highlight etc.) return placeholders during evaluation,
|
||||
then all IO is flushed concurrently after the aser completes. *)
|
||||
(* Expand ALL components server-side. Uses batch IO mode for
|
||||
concurrent highlight calls. Tries VM first, falls back to CEK. *)
|
||||
(try
|
||||
ignore (env_bind env "expand-components?" (NativeFn ("expand-components?", fun _args -> Bool true)));
|
||||
(* Enable batch IO mode *)
|
||||
io_batch_mode := true;
|
||||
io_queue := [];
|
||||
io_counter := 0;
|
||||
@@ -818,6 +815,21 @@ let dispatch env cmd =
|
||||
| Eval_error msg -> send_error msg
|
||||
| exn -> send_error (Printexc.to_string exn))
|
||||
|
||||
| List [Symbol "vm-load-module"; code_val] ->
|
||||
(* Execute a compiled module on the VM. The module's defines
|
||||
are stored in the kernel env, replacing Lambda values with
|
||||
NativeFn VM closures. This is how compiled code gets wired
|
||||
into the CEK dispatch — the CEK calls NativeFn directly. *)
|
||||
(try
|
||||
let code = Sx_vm.code_from_value code_val in
|
||||
(* VM uses the LIVE kernel env — defines go directly into it *)
|
||||
let _result = Sx_vm.execute_module code env.bindings in
|
||||
(* Count how many defines the module added *)
|
||||
send_ok ()
|
||||
with
|
||||
| Eval_error msg -> send_error msg
|
||||
| exn -> send_error (Printexc.to_string exn))
|
||||
|
||||
| List [Symbol "vm-compile"] ->
|
||||
(* Compile all named lambdas in env to bytecode.
|
||||
Called after all .sx files are loaded. *)
|
||||
|
||||
Reference in New Issue
Block a user