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

@@ -100,12 +100,24 @@ Representation:
### Phase 6 — speed
- [x] Inline primitive calls during compile (skip dict lookup)
- [x] Tail-call optimise colon-def endings
- [ ] JIT cooperation: mark compiled colon-defs as VM-eligible
- [x] JIT cooperation: mark compiled colon-defs as VM-eligible
## Progress log
_Newest first._
- **Phase 6 close — JIT cooperation hooks (Hayes unchanged at 618/638).**
Every word record now carries `:vm-eligible? true` and a
`:call-count` counter that `forth-execute-word` bumps on every
invocation. The flag is a hint for downstream JIT consumers — our
bodies are plain SX lambdas already, so the existing SX VM's
on-first-call JIT lifts them into bytecode automatically; the
metadata just makes that fact discoverable. Added
`forth-hot-words state threshold` returning `(name count)`
pairs above a threshold so a future tracing JIT can pick out
hot definitions to specialise. Phase 6 boxes all ticked.
All 306 internal tests green; Hayes Core stays at 618/638.
- **Phase 6 — TCO at colon-def endings (Hayes unchanged at 618/638).**
`forth-run-body` now special-cases the final op when it's a plain
function (not a branch dict): we call it in tail position with no