From b6f304e91a7e0e7079e620964aa27c85f2b5c745 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 3 Apr 2026 20:29:27 +0000 Subject: [PATCH] Step 5.5 phase 4 (partial): add OP_PERFORM to vm.sx spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds opcode 112 (OP_PERFORM / IO suspension) to lib/vm.sx's vm-step dispatch. The native sx_vm.ml already has this opcode — this brings the SX spec into alignment. Full VM transpilation deferred to Step 6 (define-record-type): the dict-based state in vm.sx maps to get_val/sx_dict_set_b calls which are ~5x slower than native record/array access in the hot loop. define-record-type will let vm.sx use typed records that the transpiler maps to OCaml records natively. 2598/2598 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/vm.sx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vm.sx b/lib/vm.sx index 5af86bc8..af314ad2 100644 --- a/lib/vm.sx +++ b/lib/vm.sx @@ -516,6 +516,10 @@ (vm-push vm (inc (vm-pop vm))) (= op 175) (vm-push vm (dec (vm-pop vm))) + (= op 112) + (let + ((request (vm-pop vm))) + (error (str "VM: IO suspension (OP_PERFORM) — request: " request))) :else (error (str "VM: unknown opcode " op)))))) (define