<s>
Tracing	B-Application
just-in-time	I-Application
compilation	I-Application
is	O
a	O
technique	O
used	O
by	O
virtual	B-Architecture
machines	I-Architecture
to	O
optimize	O
the	O
execution	O
of	O
a	O
program	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
This	O
is	O
done	O
by	O
recording	O
a	O
linear	O
sequence	O
of	O
frequently	O
executed	O
operations	O
,	O
compiling	B-Language
them	O
to	O
native	B-Language
machine	B-Language
code	I-Language
and	O
executing	O
them	O
.	O
</s>
<s>
This	O
is	O
opposed	O
to	O
traditional	O
just-in-time	O
(	O
JIT	O
)	O
compilers	B-Language
that	O
work	O
on	O
a	O
per-method	O
basis	O
.	O
</s>
<s>
Just-in-time	O
compilation	B-Language
is	O
a	O
technique	O
to	O
increase	O
execution	O
speed	O
of	O
programs	O
by	O
compiling	B-Language
parts	O
of	O
a	O
program	O
to	O
machine	B-Language
code	I-Language
at	B-Library
runtime	I-Library
.	O
</s>
<s>
One	O
way	O
to	O
categorize	O
different	O
JIT	O
compilers	B-Language
is	O
by	O
their	O
compilation	B-Language
scope	O
.	O
</s>
<s>
Whereas	O
method-based	O
JIT	O
compilers	B-Language
translate	O
one	O
method	O
at	O
a	O
time	O
to	O
machine	B-Language
code	I-Language
,	O
tracing	B-Application
JITs	I-Application
use	O
frequently	O
executed	O
loops	O
as	O
their	O
unit	O
of	O
compilation	B-Language
.	O
</s>
<s>
Virtual	B-Architecture
machines	I-Architecture
that	O
have	O
a	O
tracing	B-Application
JIT	I-Application
are	O
often	O
mixed-mode	O
execution	O
environments	O
,	O
meaning	O
that	O
they	O
have	O
either	O
an	O
interpreter	B-Application
or	O
a	O
method	O
compiler	B-Language
in	O
addition	O
to	O
the	O
tracing	B-Application
JIT	I-Application
.	O
</s>
<s>
A	O
tracing	B-Application
JIT	I-Application
compiler	B-Language
goes	O
through	O
various	O
phases	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
The	O
trace	O
is	O
then	O
optimized	O
and	O
compiled	B-Language
to	O
machine	B-Language
code	I-Language
(	O
trace	O
)	O
.	O
</s>
<s>
When	O
this	O
loop	O
is	O
executed	O
again	O
,	O
the	O
compiled	B-Language
trace	O
is	O
called	O
instead	O
of	O
the	O
program	O
counterpart	O
.	O
</s>
<s>
The	O
recorded	O
operations	O
are	O
typically	O
stored	O
in	O
trace	B-Application
tree	I-Application
,	O
often	O
in	O
an	O
intermediate	B-Application
representation	I-Application
(	O
IR	B-Application
)	O
.	O
</s>
<s>
To	O
identify	O
the	O
places	O
where	O
that	O
can	O
happen	O
,	O
special	O
guard	B-Language
instructions	O
are	O
inserted	O
into	O
the	O
trace	O
.	O
</s>
<s>
The	O
guard	B-Language
is	O
a	O
quick	O
check	O
to	O
determine	O
whether	O
the	O
original	O
condition	O
is	O
still	O
true	O
.	O
</s>
<s>
If	O
a	O
guard	B-Language
fails	O
,	O
the	O
execution	O
of	O
the	O
trace	O
is	O
aborted	O
.	O
</s>
<s>
Since	O
tracing	O
is	O
done	O
during	O
execution	O
,	O
the	O
trace	O
can	O
be	O
made	O
to	O
contain	O
runtime	B-Library
information	I-Library
(	O
e.g.	O
</s>
<s>
type	B-Application
information	I-Application
)	O
.	O
</s>
<s>
After	O
the	O
optimization	O
,	O
the	O
trace	O
is	O
turned	O
into	O
machine	B-Language
code	I-Language
.	O
</s>
<s>
After	O
the	O
trace	O
has	O
been	O
compiled	B-Language
to	O
machine	B-Language
code	I-Language
,	O
it	O
can	O
be	O
executed	O
in	O
subsequent	O
iterations	O
of	O
the	O
loop	O
.	O
</s>
<s>
Trace	O
execution	O
continues	O
until	O
a	O
guard	B-Language
fails	O
.	O
</s>
<s>
Whereas	O
the	O
idea	O
of	O
JITs	O
reaches	O
back	O
to	O
the	O
1960s	O
,	O
tracing	B-Application
JITs	I-Application
have	O
become	O
used	O
more	O
often	O
only	O
recently	O
.	O
</s>
<s>
The	O
first	O
mention	O
of	O
an	O
idea	O
that	O
is	O
similar	O
to	O
today	O
's	O
idea	O
of	O
tracing	B-Application
JITs	I-Application
was	O
in	O
1970	O
.	O
</s>
<s>
It	O
was	O
observed	O
that	O
compiled	B-Language
code	O
could	O
be	O
derived	O
from	O
an	O
interpreter	B-Application
at	O
run-time	O
by	O
simply	O
storing	O
the	O
actions	O
performed	O
during	O
interpretation	O
.	O
</s>
<s>
The	O
first	O
implementation	O
of	O
tracing	O
is	O
Dynamo	O
,	O
"	O
a	O
software	O
dynamic	O
optimization	O
system	O
that	O
is	O
capable	O
of	O
transparently	O
improving	O
the	O
performance	O
of	O
a	O
native	B-Language
instruction	O
stream	O
as	O
it	O
executes	O
on	O
the	O
processor	O
"	O
.	O
</s>
<s>
To	O
do	O
this	O
,	O
the	O
native	B-Language
instruction	O
stream	O
is	O
interpreted	O
until	O
a	O
"	O
hot	O
"	O
instruction	O
sequence	O
is	O
found	O
.	O
</s>
<s>
Dynamo	O
was	O
later	O
extended	O
to	O
DynamoRIO	B-Application
.	O
</s>
<s>
One	O
DynamoRIO-based	O
project	O
was	O
a	O
framework	O
for	O
interpreter	B-Application
construction	O
that	O
combines	O
tracing	O
and	O
partial	O
evaluation	O
.	O
</s>
<s>
It	O
was	O
used	O
to	O
"	O
dynamically	O
remove	O
interpreter	B-Application
overhead	O
from	O
language	O
implementations	O
"	O
.	O
</s>
<s>
In	O
2006	O
,	O
HotpathVM	O
,	O
the	O
first	O
tracing	B-Application
JIT	I-Application
compiler	B-Language
for	O
a	O
high-level	O
language	O
was	O
developed	O
.	O
</s>
<s>
This	O
VM	O
was	O
capable	O
of	O
dynamically	O
identifying	O
frequently	O
executed	O
bytecode	O
instructions	O
,	O
which	O
are	O
traced	O
and	O
then	O
compiled	B-Language
to	O
machine	B-Language
code	I-Language
using	O
static	O
single	O
assignment	O
(	O
SSA	O
)	O
construction	O
.	O
</s>
<s>
Another	O
example	O
of	O
a	O
tracing	B-Application
JIT	I-Application
is	O
TraceMonkey	O
,	O
one	O
of	O
Mozilla	B-Operating_System
’s	O
JavaScript	O
implementations	O
for	O
Firefox	B-Application
(	O
2009	O
)	O
.	O
</s>
<s>
TraceMonkey	O
compiles	B-Language
frequently	O
executed	O
loop	O
traces	O
in	O
the	O
dynamic	O
language	O
JavaScript	O
at	O
run-time	O
and	O
specializes	O
the	O
generated	O
code	O
for	O
the	O
actual	O
dynamic	O
types	O
occurring	O
on	O
each	O
path	O
.	O
</s>
<s>
Another	O
project	O
that	O
utilizes	O
tracing	B-Application
JITs	I-Application
is	O
PyPy	B-Language
.	O
</s>
<s>
It	O
enables	O
the	O
use	O
of	O
tracing	B-Application
JITs	I-Application
for	O
language	O
implementations	O
that	O
were	O
written	O
with	O
PyPy	B-Language
's	O
translation	O
toolchain	O
,	O
thus	O
improving	O
the	O
performance	O
of	O
any	O
program	O
that	O
is	O
executed	O
using	O
that	O
interpreter	B-Application
.	O
</s>
<s>
This	O
is	O
possible	O
by	O
tracing	O
the	O
interpreter	B-Application
itself	O
,	O
instead	O
of	O
the	O
program	O
that	O
is	O
executed	O
by	O
the	O
interpreter	B-Application
.	O
</s>
<s>
Tracing	B-Application
JITs	I-Application
have	O
also	O
been	O
explored	O
by	O
Microsoft	O
in	O
the	O
SPUR	O
project	O
for	O
their	O
Common	O
Intermediate	O
Language	O
(	O
CIL	O
)	O
.	O
</s>
