as shown below. This example uses the embedded parameter version of direct threading so the &thread[123] line is the destination of where to jump if the condition is true, so it must be skipped (ip++) over if the branch is not taken. thread: ... &brz &thread[123] ... brz: when_true_ip = *ip++ // Get destination address for branch if (*--sp == 0) // Pop/Consume top of stack and check if it's zero ip = when_true_ip jump *ip++ Common amenities Separating the data and return stacks in a machine eliminates a great deal of stack management code, substantially reducing the size of the threaded code. The dual-stack principle originated three times independently: for Burroughs large systems, Forth, and PostScript. It is used in some Java virtual machines. Three registers are often present in a threaded virtual machine. Another one exists for passing data between subroutines ('words'). These are: ip or i (instruction pointer) of the virtual machine (not to be confused with the program counter of the underlying hardware implementing the VM) w (work pointer) rp or r (return stack pointer) sp or s (parameter stack pointer for passing parameters between words) Often, threaded virtual machines, such as implementations of Forth, have a simple virtual machine at heart, consisting of three primitives. Those are: nest, also called docol unnest, or semi_s (;s) next In an indirect-threaded virtual machine, the one given here, the operations are: next: *ip++ -> w jump **w++ nest: ip -> *rp++ w -> ip next unnest: *--rp -> ip next See also Continuation-passing style, which replaces the global variable ip with a function parameter Just-in-time compilation Return-oriented programming: the rediscovery of threaded code in order to exploit remote vulnerable systems. Tail recursion Notes References External links Anton Ertl's explanatory page What is Threaded Code? describes different threading techniques and provides further references. The Development of the C Language by Dennis M. Ritchie describes B (a precursor of C) as implemented using "threaded code". Thinking Forth Project includes the seminal (but out of print) book Thinking Forth by Leo Brodie published in 1984. Starting FORTH online version of the book Starting FORTH by Leo Brodie published in 1981. Brad Rodriguez's Moving FORTH: Part 1: Design Decisions in the Forth Kernel covers threading techniques in depth. History of general purpose CPUs GCC extensions. Labels as Values (NB. Brief overview on the threaded languages, System and User RPL, used on the