Both! After packaging the nasty details in macro definitions we
realized that we could switch between direct and indirect threading by
simply setting a compilation flag (
defining a few machine-specific macros for the direct-threading case.
On the Forth level we also offer access words that hide the
differences between the threading methods (see section Threading Words).
Indirect threading is implemented completely machine-independently. Direct threading needs routines for creating jumps to the executable code (e.g. to docol or dodoes). These routines are inherently machine-dependent, but they do not amount to many source lines. I.e., even porting direct threading to a new machine is a small effort.
The default threading method is machine-dependent. You can enforce a
specific threading method when building Gforth with the configuration
--enable-indirect-threaded. Note that direct threading is not
supported on all machines.
Go to the first, previous, next, last section, table of contents.