*** Welcome to piglix ***

Threaded code


In computer science, the term threaded code refers to a programming technique where the code has a form that essentially consists entirely of calls to subroutines. It is often, but not only, found in compiler implementations that generate code in that form and/or are implemented in that form themselves. The code may be processed by an interpreter, or may simply be a sequence of machine code call instructions.

Threaded code has better code density than code generated by alternative code generation techniques and alternative calling conventions, sometimes at the expense of slightly slower execution speed. However, a program small enough to fit fully in a computer processor's cache may run faster than a larger program that suffers many cache misses. Small programs may also run faster, when other programs fill the cache, when switching threads.

Threaded code is best known as the implementation technique commonly used in some programming languages, such as Forth, many implementations of BASIC, some implementations of COBOL, early versions of B, and other languages for small minicomputers and amateur radio satellites.

The common way to make computer programs is to 'translate' a computer program written in some symbolic language to machine code using a compiler.The code is typically fast but nonportable since the binary code is designed for a specific computer hardware platform. A different approach uses a virtual machine instruction set, which has no particular target hardware. An interpreter executes it on each new target hardware.


...
Wikipedia

...