<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
threaded	B-Application
code	I-Application
is	O
a	O
programming	O
technique	O
where	O
the	O
code	O
has	O
a	O
form	O
that	O
essentially	O
consists	O
entirely	O
of	O
calls	O
to	O
subroutines	O
.	O
</s>
<s>
It	O
is	O
often	O
used	O
in	O
compilers	B-Language
,	O
which	O
may	O
generate	O
code	O
in	O
that	O
form	O
or	O
be	O
implemented	O
in	O
that	O
form	O
themselves	O
.	O
</s>
<s>
The	O
code	O
may	O
be	O
processed	O
by	O
an	O
interpreter	B-Application
or	O
it	O
may	O
simply	O
be	O
a	O
sequence	O
of	O
machine	B-Language
code	I-Language
call	O
instructions	B-General_Concept
.	O
</s>
<s>
Threaded	B-Application
code	I-Application
has	O
better	O
density	O
than	O
code	O
generated	O
by	O
alternative	O
generation	O
techniques	O
and	O
by	O
alternative	O
calling	O
conventions	O
.	O
</s>
<s>
In	O
cached	B-General_Concept
architectures	O
,	O
it	O
may	O
execute	B-General_Concept
slightly	O
slower	O
.	O
</s>
<s>
However	O
,	O
a	O
program	O
that	O
is	O
small	O
enough	O
to	O
fit	O
in	O
a	O
computer	O
processor	O
's	O
cache	B-General_Concept
may	O
run	O
faster	O
than	O
a	O
larger	O
program	O
that	O
suffers	O
many	O
cache	B-General_Concept
misses	O
.	O
</s>
<s>
Small	O
programs	O
may	O
also	O
be	O
faster	O
at	O
thread	O
switching	O
,	O
when	O
other	O
programs	O
have	O
filled	O
the	O
cache	B-General_Concept
.	O
</s>
<s>
Threaded	B-Application
code	I-Application
is	O
best	O
known	O
for	O
its	O
use	O
in	O
many	O
compilers	B-Language
of	O
programming	O
languages	O
,	O
such	O
as	O
Forth	B-Application
,	O
many	O
implementations	O
of	O
BASIC	O
,	O
some	O
implementations	O
of	O
COBOL	B-Application
,	O
early	O
versions	O
of	O
B	B-Language
,	O
and	O
other	O
languages	O
for	O
small	O
minicomputers	B-Architecture
and	O
for	O
amateur	O
radio	O
satellites	O
.	O
</s>
<s>
The	O
common	O
way	O
to	O
make	O
computer	O
programs	O
is	O
to	O
use	O
a	O
compiler	B-Language
to	O
translate	O
source	O
code	O
(	O
written	O
in	O
some	O
symbolic	O
language	O
)	O
to	O
machine	B-Language
code	I-Language
.	O
</s>
<s>
The	O
resulting	O
executable	B-Application
is	O
typically	O
fast	O
but	O
,	O
because	O
it	O
is	O
specific	O
to	O
a	O
hardware	B-Architecture
platform	O
,	O
it	O
is	O
n't	O
portable	O
.	O
</s>
<s>
A	O
different	O
approach	O
is	O
to	O
generate	O
instructions	B-General_Concept
for	O
a	O
virtual	B-Architecture
machine	I-Architecture
and	O
to	O
use	O
an	O
interpreter	B-Application
on	O
each	O
hardware	B-Architecture
platform	O
.	O
</s>
<s>
The	O
interpreter	B-Application
instantiates	O
the	O
virtual	B-Architecture
machine	I-Architecture
environment	O
and	O
executes	O
the	O
instructions	B-General_Concept
.	O
</s>
<s>
Thus	O
,	O
only	O
the	O
interpreter	B-Application
must	O
be	O
compiled	B-Language
.	O
</s>
<s>
For	O
example	O
,	O
most	O
Data	B-Device
General	I-Device
Nova	I-Device
,	O
IBM	B-Device
1130	I-Device
,	O
and	O
many	O
of	O
the	O
first	O
microcomputers	B-Architecture
had	O
only	O
4kB	O
of	O
RAM	O
installed	O
.	O
</s>
<s>
One	O
solution	O
is	O
to	O
use	O
an	O
interpreter	B-Application
which	O
reads	O
the	O
symbolic	O
language	O
a	O
bit	O
at	O
a	O
time	O
,	O
and	O
calls	O
functions	O
to	O
perform	O
the	O
actions	O
.	O
</s>
<s>
As	O
the	O
source	O
code	O
is	O
typically	O
much	O
denser	O
than	O
the	O
resulting	O
machine	B-Language
code	I-Language
,	O
this	O
can	O
reduce	O
overall	O
memory	O
use	O
.	O
</s>
<s>
This	O
was	O
the	O
reason	O
Microsoft	B-Language
BASIC	I-Language
is	O
an	O
interpreter	B-Application
:	O
its	O
own	O
code	O
had	O
to	O
share	O
the	O
4kB	O
memory	O
of	O
machines	O
like	O
the	O
Altair	B-Architecture
8800	I-Architecture
with	O
the	O
user	O
's	O
source	O
code	O
.	O
</s>
<s>
A	O
compiler	B-Language
translates	O
from	O
a	O
source	O
language	O
to	O
machine	B-Language
code	I-Language
,	O
so	O
the	O
compiler	B-Language
,	O
source	O
,	O
and	O
output	O
must	O
all	O
be	O
in	O
memory	O
at	O
the	O
same	O
time	O
.	O
</s>
<s>
In	O
an	O
interpreter	B-Application
,	O
there	O
is	O
no	O
output	O
.	O
</s>
<s>
Threaded	B-Application
code	I-Application
is	O
a	O
formatting	O
style	O
for	O
compiled	B-Language
code	O
that	O
minimizes	O
memory	O
use	O
.	O
</s>
<s>
Instead	O
of	O
writing	O
out	O
every	O
step	O
of	O
an	O
operation	O
at	O
its	O
every	O
occurrence	O
in	O
the	O
program	O
,	O
as	O
was	O
common	O
in	O
macro	B-Language
assemblers	I-Language
for	O
instance	O
,	O
the	O
compiler	B-Language
writes	O
each	O
common	O
bit	O
of	O
code	O
into	O
a	O
subroutine	O
.	O
</s>
<s>
Mainframes	O
and	O
some	O
early	O
microprocessors	O
such	O
as	O
the	O
RCA	B-General_Concept
1802	I-General_Concept
required	O
several	O
instructions	B-General_Concept
to	O
call	O
a	O
subroutine	O
.	O
</s>
<s>
To	O
address	O
this	O
,	O
threaded	B-Application
code	I-Application
systems	O
used	O
pseudo-code	O
to	O
represent	O
function	O
calls	O
in	O
a	O
single	O
operator	O
.	O
</s>
<s>
At	O
run	O
time	O
,	O
a	O
tiny	O
"	O
interpreter	B-Application
"	O
would	O
scan	O
over	O
the	O
top-level	O
code	O
,	O
extract	O
the	O
subroutine	O
's	O
address	O
in	O
memory	O
,	O
and	O
call	O
it	O
.	O
</s>
<s>
In	O
other	O
systems	O
,	O
this	O
same	O
basic	O
concept	O
is	O
implemented	O
as	O
a	O
branch	O
table	O
,	O
dispatch	O
table	O
,	O
or	O
virtual	B-Language
method	I-Language
table	I-Language
,	O
all	O
of	O
which	O
consist	O
of	O
a	O
table	O
of	O
subroutine	O
addresses	O
.	O
</s>
<s>
During	O
the	O
1970s	O
,	O
hardware	B-Architecture
designers	O
spent	O
considerable	O
effort	O
to	O
make	O
subroutine	O
calls	O
faster	O
and	O
simpler	O
.	O
</s>
<s>
Threaded	B-Application
code	I-Application
systems	O
save	O
room	O
by	O
replacing	O
that	O
list	O
of	O
function	O
calls	O
,	O
where	O
only	O
the	O
subroutine	O
address	O
changes	O
from	O
one	O
call	O
to	O
the	O
next	O
,	O
with	O
a	O
list	O
of	O
execution	O
tokens	O
,	O
which	O
are	O
essentially	O
function	O
calls	O
with	O
the	O
call	O
opcode(s )	O
stripped	O
off	O
,	O
leaving	O
behind	O
only	O
a	O
list	O
of	O
addresses	O
.	O
</s>
<s>
Over	O
the	O
years	O
,	O
programmers	O
have	O
created	O
many	O
variations	O
on	O
that	O
"	O
interpreter	B-Application
"	O
or	O
"	O
small	O
selector	O
"	O
.	O
</s>
<s>
The	O
addresses	O
may	O
be	O
direct	O
or	O
indirect	O
,	O
contiguous	O
or	O
non-contiguous	O
(	O
linked	O
by	O
pointers	O
)	O
,	O
relative	O
or	O
absolute	O
,	O
resolved	O
at	O
compile	B-Language
time	O
or	O
dynamically	O
built	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
following	O
pseudocode	O
uses	O
this	O
technique	O
to	O
add	O
two	O
numbers	O
A	O
and	O
B	B-Language
.	O
</s>
<s>
In	O
the	O
example	O
,	O
the	O
list	O
is	O
labeled	O
thread	O
and	O
a	O
variable	O
ip	O
(	O
Instruction	B-General_Concept
Pointer	I-General_Concept
)	O
tracks	O
our	O
place	O
within	O
the	O
list	O
.	O
</s>
<s>
Another	O
variable	O
sp	O
(	O
Stack	B-Application
Pointer	O
)	O
contains	O
an	O
address	O
elsewhere	O
in	O
memory	O
that	O
is	O
available	O
to	O
hold	O
a	O
value	O
temporarily	O
.	O
</s>
<s>
This	O
is	O
called	O
direct	O
threaded	B-Application
code	I-Application
(	O
DTC	O
)	O
.	O
</s>
<s>
Although	O
the	O
technique	O
is	O
older	O
,	O
the	O
first	O
widely	O
circulated	O
use	O
of	O
the	O
term	O
"	O
threaded	B-Application
code	I-Application
"	O
is	O
probably	O
James	O
R	O
.	O
Bell	O
's	O
1973	O
article	O
"	O
Threaded	B-Application
Code	I-Application
"	O
.	O
</s>
<s>
In	O
1970	O
,	O
Charles	O
H	O
.	O
Moore	O
invented	O
a	O
more	O
compact	O
arrangement	O
,	O
indirect	O
threaded	B-Application
code	I-Application
(	O
ITC	O
)	O
,	O
for	O
his	O
Forth	B-Application
virtual	I-Application
machine	I-Application
.	O
</s>
<s>
Moore	O
arrived	O
at	O
this	O
arrangement	O
because	O
Nova	B-Device
minicomputers	B-Architecture
had	O
an	O
indirection	O
bit	O
in	O
every	O
address	O
,	O
which	O
made	O
ITC	O
easy	O
and	O
fast	O
.	O
</s>
<s>
Later	O
,	O
he	O
said	O
that	O
he	O
found	O
it	O
so	O
convenient	O
that	O
he	O
propagated	O
it	O
into	O
all	O
later	O
Forth	B-Application
designs	O
.	O
</s>
<s>
Today	O
,	O
some	O
Forth	B-Application
compilers	B-Language
generate	O
direct-threaded	O
code	O
while	O
others	O
generate	O
indirect-threaded	O
code	O
.	O
</s>
<s>
The	O
executables	B-Application
act	O
the	O
same	O
either	O
way	O
.	O
</s>
<s>
Practically	O
all	O
executable	B-Application
threaded	B-Application
code	I-Application
uses	O
one	O
or	O
another	O
of	O
these	O
methods	O
for	O
invoking	O
subroutines	O
(	O
each	O
method	O
is	O
called	O
a	O
"	O
threading	B-Application
model	I-Application
"	O
)	O
.	O
</s>
<s>
Addresses	O
in	O
the	O
thread	O
are	O
the	O
addresses	O
of	O
machine	B-Language
language	I-Language
.	O
</s>
<s>
Some	O
Forth	B-Application
systems	O
produce	O
direct-threaded	O
code	O
.	O
</s>
<s>
An	O
example	O
of	O
a	O
stack	B-Application
machine	I-Application
might	O
execute	B-General_Concept
the	O
sequence	O
"	O
push	O
A	O
,	O
push	O
B	B-Language
,	O
add	O
"	O
.	O
</s>
<s>
Indirect	O
threading	O
uses	O
pointers	O
to	O
locations	O
that	O
in	O
turn	O
point	O
to	O
machine	B-Language
code	I-Language
.	O
</s>
<s>
The	O
indirection	O
typically	O
makes	O
it	O
slower	O
,	O
though	O
usually	O
still	O
faster	O
than	O
bytecode	O
interpreters	B-Application
.	O
</s>
<s>
Older	O
FORTH	B-Application
systems	O
typically	O
produce	O
indirect-threaded	O
code	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
the	O
goal	O
is	O
to	O
execute	B-General_Concept
"	O
push	O
A	O
,	O
push	O
B	B-Language
,	O
add	O
"	O
,	O
the	O
following	O
might	O
be	O
used	O
.	O
</s>
<s>
So-called	O
"	O
subroutine-threaded	O
code	O
"	O
(	O
also	O
"	O
call-threaded	O
code	O
"	O
)	O
consists	O
of	O
a	O
series	O
of	O
machine-language	O
"	O
call	O
"	O
instructions	B-General_Concept
(	O
or	O
addresses	O
of	O
functions	O
to	O
"	O
call	O
"	O
,	O
as	O
opposed	O
to	O
direct	B-Application
threading	I-Application
's	O
use	O
of	O
"	O
jump	O
"	O
)	O
.	O
</s>
<s>
Early	O
compilers	B-Language
for	O
ALGOL	B-Language
,	O
Fortran	O
,	O
Cobol	B-Application
and	O
some	O
Forth	B-Application
systems	O
often	O
produced	O
subroutine-threaded	O
code	O
.	O
</s>
<s>
The	O
code	O
in	O
many	O
of	O
these	O
systems	O
operated	O
on	O
a	O
last-in-first-out	O
(	O
LIFO	B-Application
)	O
stack	B-Application
of	O
operands	O
,	O
for	O
which	O
compiler	B-Language
theory	O
was	O
well-developed	O
.	O
</s>
<s>
Most	O
modern	O
processors	O
have	O
special	O
hardware	B-Architecture
support	O
for	O
subroutine	O
"	O
call	O
"	O
and	O
"	O
return	O
"	O
instructions	B-General_Concept
,	O
so	O
the	O
overhead	O
of	O
one	O
extra	O
machine	B-Language
instruction	I-Language
per	O
dispatch	O
is	O
somewhat	O
diminished	O
.	O
</s>
<s>
Anton	O
Ertl	O
,	O
the	O
Gforth	B-Language
compiler	B-Language
's	O
co-creator	O
,	O
stated	O
that	O
"	O
in	O
contrast	O
to	O
popular	O
myths	O
,	O
subroutine	O
threading	O
is	O
usually	O
slower	O
than	O
direct	B-Application
threading	I-Application
"	O
.	O
</s>
<s>
However	O
,	O
Ertl	O
's	O
most	O
recent	O
tests	O
show	O
that	O
subroutine	O
threading	O
is	O
faster	O
than	O
direct	B-Application
threading	I-Application
in	O
15	O
out	O
of	O
25	O
test	O
cases	O
.	O
</s>
<s>
More	O
specifically	O
,	O
he	O
found	O
that	O
direct	B-Application
threading	I-Application
is	O
the	O
fastest	O
threading	B-Application
model	I-Application
on	O
Xeon	O
,	O
Opteron	O
,	O
and	O
Athlon	O
processors	O
,	O
indirect	O
threading	O
is	O
fastest	O
on	O
Pentium	O
M	O
processors	O
,	O
and	O
subroutine	O
threading	O
is	O
fastest	O
on	O
Pentium	O
4	O
,	O
Pentium	O
III	O
,	O
and	O
PPC	O
processors	O
.	O
</s>
<s>
As	O
an	O
example	O
of	O
call	O
threading	O
for	O
"	O
push	O
A	O
,	O
push	O
B	B-Language
,	O
add	O
"	O
:	O
</s>
<s>
Some	O
Forth	B-Application
compilers	B-Language
produce	O
token-threaded	O
code	O
.	O
</s>
<s>
Some	O
programmers	O
consider	O
the	O
"	O
p-code	B-Language
"	O
generated	O
by	O
some	O
Pascal	B-Application
compilers	B-Language
,	O
as	O
well	O
as	O
the	O
bytecodes	O
used	O
by	O
.NET	B-Application
,	O
Java	B-Language
,	O
BASIC	O
and	O
some	O
C	B-Language
compilers	B-Language
,	O
to	O
be	O
token-threading	O
.	O
</s>
<s>
A	O
common	O
approach	O
,	O
historically	O
,	O
is	O
bytecode	O
,	O
which	O
typically	O
uses	O
8-bit	O
opcodes	O
with	O
a	O
stack-based	O
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
The	O
archetypal	O
bytecode	O
interpreter	B-Application
is	O
known	O
as	O
a	O
"	O
decode	O
and	O
dispatch	O
interpreter	B-Application
"	O
and	O
follows	O
the	O
form	O
:	O
</s>
<s>
If	O
the	O
virtual	B-Architecture
machine	I-Architecture
uses	O
only	O
byte-size	O
instructions	B-General_Concept
,	O
decode( )	O
is	O
simply	O
a	O
fetch	O
from	O
thread	O
,	O
but	O
often	O
there	O
are	O
commonly	O
used	O
1-byte	O
instructions	B-General_Concept
plus	O
some	O
less-common	O
multibyte	O
instructions	B-General_Concept
(	O
see	O
complex	B-Architecture
instruction	I-Architecture
set	I-Architecture
computer	I-Architecture
)	O
,	O
in	O
which	O
case	O
decode( )	O
is	O
more	O
complex	O
.	O
</s>
<s>
For	O
instructions	B-General_Concept
where	O
the	O
individual	O
operations	O
are	O
simple	O
,	O
such	O
as	O
"	O
push	O
"	O
and	O
"	O
add	O
"	O
,	O
the	O
overhead	O
involved	O
in	O
deciding	O
what	O
to	O
execute	B-General_Concept
is	O
larger	O
than	O
the	O
cost	O
of	O
actually	O
executing	O
it	O
,	O
so	O
such	O
interpreters	B-Application
are	O
often	O
much	O
slower	O
than	O
machine	B-Language
code	I-Language
.	O
</s>
<s>
However	O
,	O
for	O
more	O
complex	O
(	O
"	O
compound	O
"	O
)	O
instructions	B-General_Concept
,	O
the	O
overhead	O
percentage	O
is	O
proportionally	O
less	O
significant	O
.	O
</s>
<s>
There	O
are	O
times	O
when	O
token-threaded	O
code	O
can	O
sometimes	O
run	O
faster	O
than	O
the	O
equivalent	O
machine	B-Language
code	I-Language
when	O
that	O
machine	B-Language
code	I-Language
ends	O
up	O
being	O
too	O
large	O
to	O
fit	O
in	O
the	O
physical	O
CPU	O
's	O
L1	O
instruction	O
cache	B-General_Concept
.	O
</s>
<s>
The	O
higher	O
code	O
density	O
of	O
threaded	B-Application
code	I-Application
,	O
especially	O
token-threaded	O
code	O
,	O
can	O
allow	O
it	O
to	O
fit	O
entirely	O
in	O
the	O
L1	O
cache	B-General_Concept
when	O
it	O
otherwise	O
would	O
not	O
have	O
,	O
thereby	O
avoiding	O
cache	B-General_Concept
thrashing	O
.	O
</s>
<s>
However	O
,	O
threaded	B-Application
code	I-Application
consumes	O
both	O
instruction	O
cache	B-General_Concept
(	O
for	O
the	O
implementation	O
of	O
each	O
operation	O
)	O
as	O
well	O
as	O
data	B-General_Concept
cache	I-General_Concept
(	O
for	O
the	O
bytecode	O
and	O
tables	O
)	O
unlike	O
machine	B-Language
code	I-Language
which	O
only	O
consumes	O
instruction	O
cache	B-General_Concept
;	O
this	O
means	O
threaded	B-Application
code	I-Application
will	O
eat	O
into	O
the	O
budget	O
for	O
the	O
amount	O
of	O
data	O
that	O
can	O
be	O
held	O
for	O
processing	O
by	O
the	O
CPU	O
at	O
any	O
given	O
time	O
.	O
</s>
<s>
In	O
any	O
case	O
,	O
if	O
the	O
problem	O
being	O
computed	O
involves	O
applying	O
a	O
large	O
number	O
of	O
operations	O
to	O
a	O
small	O
amount	O
of	O
data	O
then	O
using	O
threaded	B-Application
code	I-Application
may	O
be	O
an	O
ideal	O
optimization	O
.	O
</s>
<s>
Huffman	O
threaded	B-Application
code	I-Application
consists	O
of	O
lists	O
of	O
tokens	O
stored	O
as	O
Huffman	B-General_Concept
codes	I-General_Concept
.	O
</s>
<s>
A	O
Huffman	B-General_Concept
code	I-General_Concept
is	O
a	O
variable-length	O
string	O
of	O
bits	O
that	O
identifies	O
a	O
unique	O
token	O
.	O
</s>
<s>
A	O
Huffman-threaded	O
interpreter	O
locates	O
subroutines	O
using	O
an	O
index	O
table	O
or	O
a	O
tree	O
of	O
pointers	O
that	O
can	O
be	O
navigated	O
by	O
the	O
Huffman	B-General_Concept
code	I-General_Concept
.	O
</s>
<s>
Most	O
Huffman-threaded	O
systems	O
have	O
been	O
implemented	O
as	O
direct-threaded	O
Forth	B-Application
systems	O
,	O
and	O
used	O
to	O
pack	O
large	O
amounts	O
of	O
slow-running	O
code	O
into	O
small	O
,	O
cheap	O
microcontrollers	B-Architecture
.	O
</s>
<s>
The	O
bit-oriented	O
tokenized	O
code	O
used	O
in	O
PBASIC	B-Language
can	O
be	O
seen	O
as	O
a	O
kind	O
of	O
Huffman-threaded	O
code	O
.	O
</s>
<s>
This	O
was	O
used	O
in	O
Charles	O
H	O
.	O
Moore	O
's	O
earliest	O
Forth	B-Application
implementations	O
and	O
in	O
the	O
University	O
of	O
Illinois	O
's	O
experimental	O
hardware-interpreted	O
computer	O
language	O
.	O
</s>
<s>
HP	O
's	O
RPL	B-Device
,	O
first	O
introduced	O
in	O
the	O
HP-18C	B-Device
calculator	O
in	O
1986	O
,	O
is	O
a	O
type	O
of	O
proprietary	O
hybrid	O
direct-threaded	O
and	O
indirect-threaded	O
threaded-interpreted	O
language	O
that	O
,	O
unlike	O
others	O
TILs	O
,	O
allows	O
embedding	O
of	O
RPL	B-Device
"	O
objects	O
"	O
into	O
the	O
"	O
runstream	O
"	O
ie	O
.	O
</s>
<s>
The	O
stream	O
of	O
addresses	O
through	O
which	O
the	O
interpreter	B-Application
pointer	O
advances	O
.	O
</s>
<s>
An	O
RPL	B-Device
"	O
object	O
"	O
can	O
be	O
thought	O
of	O
as	O
a	O
special	O
data	O
type	O
whose	O
in-memory	O
structure	O
contains	O
an	O
address	O
to	O
an	O
"	O
object	O
prolog	O
"	O
at	O
the	O
start	O
of	O
the	O
object	O
,	O
and	O
then	O
data	O
or	O
executable	B-Application
code	I-Application
follows	O
.	O
</s>
<s>
Using	O
the	O
"	O
RPL	B-Device
inner	O
loop	O
"	O
,	O
which	O
was	O
invented	O
and	O
published	O
(	O
and	O
patented	O
)	O
by	O
William	O
C	B-Language
.	O
Wickes	O
in	O
1986	O
and	O
published	O
in	O
"	O
Programming	O
Environments	O
"	O
,	O
Institute	O
for	O
Applied	O
Forth	B-Application
Research	O
,	O
Inc.	O
,	O
1988	O
,	O
execution	O
follows	O
like	O
so	O
:	O
</s>
<s>
Where	O
above	O
,	O
O	O
is	O
the	O
current	O
object	O
pointer	O
,	O
I	O
is	O
the	O
interpreter	B-Application
pointer	O
,	O
Δ	O
is	O
the	O
length	O
of	O
one	O
address	O
word	O
and	O
the	O
"[]"	O
operator	O
stands	O
for	O
"	O
dereference	O
"	O
.	O
</s>
<s>
On	O
HP	O
's	O
Saturn	B-Application
microprocessors	O
that	O
use	O
RPL	B-Device
,	O
there	O
is	O
a	O
third	O
level	O
of	O
indirection	O
made	O
possible	O
by	O
an	O
architectural	O
/	O
programming	O
trick	O
which	O
allows	O
faster	O
execution	O
.	O
</s>
<s>
In	O
all	O
interpreters	B-Application
,	O
a	O
branch	O
simply	O
changes	O
the	O
thread	O
pointer	O
(	O
ip	O
)	O
to	O
a	O
different	O
address	O
in	O
the	O
thread	O
.	O
</s>
<s>
A	O
conditional	O
jump-if-zero	O
branch	O
that	O
jumps	O
only	O
if	O
the	O
top-of-stack	O
value	O
is	O
zero	O
could	O
be	O
implemented	O
as	O
shown	O
below	O
.	O
</s>
<s>
This	O
example	O
uses	O
the	O
embedded	O
parameter	O
version	O
of	O
direct	B-Application
threading	I-Application
so	O
the	O
&thread[123]	O
line	O
is	O
the	O
destination	O
of	O
where	O
to	O
jump	O
if	O
the	O
condition	O
is	O
true	O
,	O
so	O
it	O
must	O
be	O
skipped	O
(	O
ip++	O
)	O
over	O
if	O
the	O
branch	O
is	O
not	O
taken	O
.	O
</s>
<s>
Separating	O
the	O
data	O
and	O
return	O
stacks	B-Application
in	O
a	O
machine	O
eliminates	O
a	O
great	O
deal	O
of	O
stack	B-Application
management	O
code	O
,	O
substantially	O
reducing	O
the	O
size	O
of	O
the	O
threaded	B-Application
code	I-Application
.	O
</s>
<s>
The	O
dual-stack	O
principle	O
originated	O
three	O
times	O
independently	O
:	O
for	O
Burroughs	B-Device
large	I-Device
systems	I-Device
,	O
Forth	B-Application
,	O
and	O
PostScript	B-Language
.	O
</s>
<s>
It	O
is	O
used	O
in	O
some	O
Java	B-Language
virtual	I-Language
machines	I-Language
.	O
</s>
<s>
Three	O
registers	B-General_Concept
are	O
often	O
present	O
in	O
a	O
threaded	O
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
Often	O
,	O
threaded	O
virtual	B-Architecture
machines	I-Architecture
,	O
such	O
as	O
implementations	O
of	O
Forth	B-Application
,	O
have	O
a	O
simple	O
virtual	B-Architecture
machine	I-Architecture
at	O
heart	O
,	O
consisting	O
of	O
three	O
primitives	O
.	O
</s>
<s>
In	O
an	O
indirect-threaded	O
virtual	B-Architecture
machine	I-Architecture
,	O
the	O
one	O
given	O
here	O
,	O
the	O
operations	O
are	O
:	O
</s>
