Thu Nov 30 20:16:56 EST 2006

on threading models

there are only 3 of any importance

(I) indirect threading
(D) direct threading
(S) subroutine threading

i'm getting quite fond of the last one, because it has genuine tail
calls: the compiler needs to decide between primitive / high level
word at compile time, so can immediately decide on compiling a tail
call to a highlevel word when required. for indirect threading, this
can be messed up.

alright. that's confusing. what i mean is: i can't have simple
(automatic) tail calls in pf. when i would use a 3 way interpreter
based on the already present type tags:

- execute primitive
- call highlevel word
- jmp  highlevel word

which would eliminate codefields. i need to think about this some
more.. can't really explain it well yet. one of the reasons for having
threaded code as lists of addresses is to save space: there is no
overhead for encoding meta-data inside the instruction stream, and the
interpreter is very simple. however, in PF, there is already a lot of
meta data in the instruction stream, so why not use it?