Threaded code: Difference between revisions

Content deleted Content added
BurntSky (talk | contribs)
m fixed ambiguous link
Benhoyt (talk | contribs)
m Charles Moore -> Charles H. Moore
Line 23:
To save even more space, programmers squeezed those lists of subroutine calls into simple lists of subroutine addresses (leaving out the "call" instruction on each one), and used a small interpreter (later called a [[virtual machine]]) to call each subroutine in turn. This is called ''DTC (Direct Threaded Code)''.
 
[[Chuck Moore|Charles H. Moore]] invented an even more compact notation in 1970 for his Forth virtual machine: ''ITC (indirect threaded code)''. Originally, Moore invented this because it was easy and fast on [[Data General Nova|NOVA]] minicomputers, which have an indirection bit in every address.
He said (in published remarks, Byte Magazine's Forth Issue) that he found it so convenient that he propagated it into all later Forth designs.
 
Line 46:
 
Less often used are
*String threading: In which operations are identified by strings, usually looked-up by a hash table. This was used in Charles H. Moore's earliest Forth implementations and in the [[University of Illinois]]'s experimental hardware-interpreted computer language. It is also used in [[Bashforth]].
*[[return threading]]
*Call Threaded Code uses a list of addresses that refers directly to machine language primitives, just like Direct Threaded code. However, the interpreter, instead of ''jumping'' to the primitive, ''calls'' it with a microprocessor subroutine call instruction instead. This system is slower than direct threading, and may even be slower than indirect threading on some systems. However, it is convenient because it allows for implementations written entirely in high-level languages, like C or Oberon. For example, here is an implementation written in both C and Oberon (untested):
Line 124:
*[http://cm.bell-labs.com/cm/cs/who/dmr/chist.html The Development of the C Language] by [[Dennis Ritchie|Dennis M. Ritchie]] also puts B in the context of BCPL and C.
*[http://thinking-forth.sourceforge.net/ Thinking Forth Project] includes the seminal (but out of print) book Thinking Forth by [http://home.earthlink.net/~lbrodie/ Leo Brodie] published in 1984.
*Anton Ertl's explanatory page [http://www.complang.tuwien.ac.at/forth/threaded-code.html "What is Threaded Code?"] describes different threading techniques and provides further references. "[[Chuck Moore|Charles Moore]] invented (indirect) threaded Code in 1970"
 
[[Category:Computer science]]