www.delorie.com/gnu/docs/gforth/gforth_256.html   search  
Buy GNU books!

Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

14.2.2 Direct or Indirect Threaded?

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 (-DDIRECT_THREADED) and 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 5.24 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. Therefore, even porting direct threading to a new machine requires little effort.

The default threading method is machine-dependent. You can enforce a specific threading method when building Gforth with the configuration flag --enable-direct-threaded or --enable-indirect-threaded. Note that direct threading is not supported on all machines.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003