links to this page:    
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Threaded Code
Last updated at 3:52 pm UTC on 14 January 2006
Threaded code is somewhat in the middle between native machine code and interpreted bytecodes such as the ones used by Squeak. An intro to various approaches to implementing threaded code is at http://www.complang.tuwien.ac.at/forth/threaded-code.html

Threaded code consists of lists of addresses, which are interpreted as entry points for functions which implement the behavior of one or a few bytecodes. In the current implementation, every byte of bytecode is translated into two 32-bits words of threaded code, of which the first is a function entry point and the second is a parameter to be used by that function.

The code used by Ian Piumarta in Squeak 1.31 is Direct Threaded Code which means there is no central dispatcher loop which fetches addresses and calls the appropriate functions, but each function includes the fetch code and jumps directly to the next function.