<s>
The	O
Perl	B-Language
virtual	I-Language
machine	I-Language
is	O
a	O
stack-based	B-Application
process	O
virtual	O
machine	O
implemented	O
as	O
an	O
opcodes	B-Language
interpreter	B-Application
which	O
runs	O
previously	O
compiled	B-Language
programs	O
written	O
in	O
the	O
Perl	B-Language
language	I-Language
.	O
</s>
<s>
The	O
opcodes	B-Language
interpreter	B-Application
is	O
a	O
part	O
of	O
the	O
Perl	B-Language
interpreter	I-Language
,	O
which	O
also	O
contains	O
a	O
compiler	B-Language
(	O
lexer	B-Application
,	O
parser	B-Language
and	O
optimizer	B-Application
)	O
in	O
one	O
executable	O
file	O
,	O
commonly	O
/usr/bin/perl	O
on	O
various	O
Unix-like	B-Operating_System
systems	I-Operating_System
or	O
perl.exe	O
on	O
Microsoft	B-Application
Windows	I-Application
systems	O
.	O
</s>
<s>
The	O
Perl	B-Language
compiler	B-Language
outputs	O
a	O
compiled	B-Language
program	O
into	O
memory	O
as	O
an	O
internal	O
structure	O
which	O
can	O
be	O
represented	O
as	O
a	O
tree	O
graph	O
in	O
which	O
each	O
node	O
represents	O
an	O
opcode	B-Language
.	O
</s>
<s>
Opcodes	B-Language
are	O
represented	O
internally	O
by	O
typedefs	B-Language
.	O
</s>
<s>
Each	O
opcode	B-Language
has	O
next	O
/	O
other	O
and	O
first	O
/	O
sibling	O
pointers	O
,	O
so	O
the	O
opcode	B-Language
tree	O
can	O
be	O
drawn	O
as	O
a	O
basic	O
OP	O
tree	O
starting	O
from	O
root	O
node	O
or	O
as	O
flat	O
OP	O
list	O
in	O
the	O
order	O
they	O
would	O
normally	O
execute	O
from	O
start	O
node	O
.	O
</s>
<s>
Opcodes	B-Language
tree	O
can	O
be	O
mapped	O
to	O
the	O
source	O
code	O
,	O
so	O
it	O
is	O
possible	O
to	O
decompile	B-Application
to	O
high-level	O
source	O
code	O
.	O
</s>
<s>
Perl	B-Language
's	O
opcodes	B-Language
interpreter	B-Application
is	O
implemented	O
as	O
a	O
tree	O
walker	O
which	O
travels	O
the	O
opcode	B-Language
tree	O
in	O
execution	O
order	O
from	O
the	O
start	O
node	O
,	O
following	O
the	O
next	O
or	O
other	O
pointers	O
.	O
</s>
<s>
Each	O
opcode	B-Language
has	O
a	O
function	O
pointer	O
to	O
a	O
pp_opname	O
function	O
,	O
i.e.	O
</s>
<s>
the	O
say	O
opcode	B-Language
calls	O
the	O
pp_say	O
function	O
of	O
internal	O
Perl	B-Language
API	O
.	O
</s>
<s>
The	O
phase	O
of	O
compiling	B-Language
a	O
Perl	B-Language
program	O
is	O
hidden	O
from	O
the	O
end	O
user	O
,	O
but	O
it	O
can	O
be	O
exposed	O
with	O
the	O
B	O
Perl	B-Language
module	O
or	O
other	O
specialized	O
modules	O
,	O
as	O
the	O
B::Concise	O
Perl	B-Language
module	O
.	O
</s>
<s>
An	O
example	O
of	O
a	O
simple	O
compiled	B-Language
Hello	O
world	O
program	O
dumped	O
in	O
execute	O
order	O
(	O
with	O
the	O
B::Concise	O
Perl	B-Language
module	O
)	O
:	O
</s>
<s>
Some	O
opcodes	B-Language
(	O
entereval	O
,	O
dofile	O
,	O
require	O
)	O
call	O
Perl	B-Language
compiler	B-Language
functions	O
which	O
in	O
turn	O
generate	O
other	O
opcodes	B-Language
in	O
the	O
same	O
Perl	B-Language
virtual	I-Language
machine	I-Language
.	O
</s>
<s>
Perl	B-Language
variables	O
can	O
be	O
global	O
,	O
dynamic	O
(	O
local	O
keyword	O
)	O
,	O
or	O
lexical	O
(	O
my	O
and	O
our	O
keywords	O
)	O
.	O
</s>
<s>
Local	O
variables	O
are	O
the	O
same	O
as	O
global	O
variables	O
but	O
a	O
special	O
opcode	B-Language
is	O
generated	O
to	O
save	O
its	O
value	O
on	O
the	O
savestack	O
and	O
restore	O
it	O
later	O
.	O
</s>
<s>
Perl	B-Language
VM	O
data	O
structures	O
are	O
represented	O
internally	O
by	O
typedefs	B-Language
.	O
</s>
<s>
The	O
internal	O
data	O
structures	O
can	O
be	O
examined	O
with	O
the	O
B	O
Perl	B-Language
module	O
or	O
other	O
specialized	O
tools	O
like	O
the	O
Devel::Peek	O
Perl	B-Language
module	O
.	O
</s>
<s>
Perl	B-Language
has	O
three	O
typedefs	B-Language
that	O
handle	O
Perl	B-Language
's	O
three	O
main	O
data	O
types	O
:	O
Scalar	O
Value	O
(	O
SV	O
)	O
,	O
Array	O
Value	O
(	O
AV	O
)	O
,	O
Hash	O
Value	O
(	O
HV	O
)	O
.	O
</s>
<s>
Perl	B-Language
uses	O
a	O
special	O
typedef	B-Language
for	O
the	O
simple	O
signed	O
integer	O
type	O
(	O
IV	O
)	O
,	O
unsigned	O
integers	O
(	O
UV	O
)	O
,	O
floating	O
point	O
numbers	O
(	O
NV	O
)	O
and	O
strings	O
(	O
PV	O
)	O
.	O
</s>
<s>
Perl	B-Language
uses	O
a	O
reference	O
count-driven	O
garbage	O
collection	O
mechanism	O
.	O
</s>
<s>
SVs	O
,	O
AVs	O
,	O
or	O
HVs	O
start	O
their	O
life	O
with	O
a	O
reference	B-General_Concept
count	I-General_Concept
of	O
1	O
.	O
</s>
<s>
If	O
the	O
reference	B-General_Concept
count	I-General_Concept
of	O
a	O
data	O
value	O
drops	O
to	O
0	O
,	O
then	O
it	O
will	O
be	O
destroyed	O
and	O
its	O
memory	O
is	O
made	O
available	O
for	O
reuse	O
.	O
</s>
<s>
Other	O
typedefs	B-Language
are	O
Glob	O
Value	O
(	O
GV	O
)	O
which	O
contain	O
named	O
references	O
to	O
various	O
objects	O
,	O
Code	O
Value	O
(	O
CV	O
)	O
which	O
contain	O
a	O
reference	O
to	O
a	O
Perl	B-Language
subroutine	O
,	O
I/O	O
Handler	O
(	O
IO	O
)	O
,	O
a	O
reference	O
to	O
regular	B-Language
expression	I-Language
(	O
REGEXP	B-Language
;	O
RV	O
in	O
Perl	B-Language
before	O
5.11	O
)	O
,	O
reference	O
to	O
compiled	B-Language
format	O
for	O
output	O
record	O
(	O
FM	O
)	O
and	O
simple	O
reference	O
which	O
is	O
a	O
special	O
type	O
of	O
scalar	O
that	O
point	O
to	O
other	O
data	O
types	O
(	O
RV	O
)	O
.	O
</s>
<s>
Perl	B-Language
has	O
a	O
number	O
of	O
stacks	O
to	O
store	O
things	O
it	O
is	O
working	O
on	O
.	O
</s>
<s>
Arguments	O
are	O
passed	O
to	O
opcode	B-Language
and	O
returned	O
from	O
opcode	B-Language
using	O
the	O
argument	O
stack	O
.	O
</s>
<s>
This	O
stack	O
is	O
used	O
for	O
saving	O
and	O
restoring	O
values	O
of	O
dynamically	B-Language
scoped	I-Language
local	O
variables	O
.	O
</s>
<s>
There	O
is	O
no	O
standardization	O
for	O
the	O
Perl	B-Language
language	I-Language
and	O
Perl	B-Language
virtual	I-Language
machine	I-Language
.	O
</s>
<s>
The	O
Perl	B-Language
virtual	I-Language
machine	I-Language
is	O
tied	O
closely	O
to	O
the	O
compiler	B-Language
.	O
</s>
<s>
The	O
most	O
known	O
and	O
most	O
stable	O
implementation	O
is	O
the	O
B::C	O
Perl	B-Language
module	O
which	O
translates	O
opcodes	B-Language
tree	O
to	O
a	O
representation	O
in	O
the	O
C	O
programming	O
language	O
and	O
adds	O
its	O
own	O
tree	O
walker	O
.	O
</s>
<s>
Another	O
implementation	O
is	O
an	O
Acme::Perl::VM	O
Perl	B-Language
module	O
which	O
is	O
an	O
implementation	O
coded	O
in	O
Perl	B-Language
language	I-Language
only	O
but	O
it	O
is	O
still	O
tied	O
with	O
original	O
Perl	B-Language
virtual	I-Language
machine	I-Language
via	O
B::	O
modules	O
.	O
</s>
