forth: JIT cooperation hooks (vm-eligible flag + call-count + forth-hot-words)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 11s

This commit is contained in:
2026-04-25 04:57:49 +00:00
parent 0d6d0bf439
commit 55f3024743
5 changed files with 56 additions and 4 deletions

View File

@@ -193,6 +193,12 @@
forth-emit-str
(fn (state s) (dict-set! state "output" (str (get state "output") s))))
;; The body is always a plain SX lambda — primitives and colon-def
;; bodies alike — which means the SX VM's JIT-on-first-call can lift
;; the body directly into bytecode. We tag every word `:vm-eligible?
;; true` so downstream JIT cooperation (a tracing layer, a hot-call
;; counter) can pick out the JIT-friendly entries by metadata rather
;; than by inspecting the body shape.
(define
forth-make-word
(fn
@@ -202,6 +208,8 @@
(dict-set! w "kind" kind)
(dict-set! w "body" body)
(dict-set! w "immediate?" immediate?)
(dict-set! w "vm-eligible?" true)
(dict-set! w "call-count" 0)
w)))
(define