forth: TCO at colon-def endings (no extra frame on tail-call ops)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -99,13 +99,23 @@ Representation:
|
||||
|
||||
### Phase 6 — speed
|
||||
- [x] Inline primitive calls during compile (skip dict lookup)
|
||||
- [ ] Tail-call optimise colon-def endings
|
||||
- [x] Tail-call optimise colon-def endings
|
||||
- [ ] JIT cooperation: mark compiled colon-defs as VM-eligible
|
||||
|
||||
## Progress log
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **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
|
||||
pc-increment and no recursive `forth-run-body` call. This means
|
||||
the SX CEK can collapse the continuation frame, so chains like
|
||||
`: A ... B ; : B ... C ; …` and `RECURSE` deep-recursion test
|
||||
cases run without piling up frames at each colon-def boundary.
|
||||
All 306 internal tests still green; verified 5000-deep
|
||||
`COUNTDOWN RECURSE` still terminates fine.
|
||||
|
||||
- **Phase 6 — inline primitive calls (Hayes unchanged at 618/638).**
|
||||
`forth-compile-call` now appends the looked-up word's body fn
|
||||
directly to the colon-def body instead of wrapping it in
|
||||
|
||||
Reference in New Issue
Block a user