After going through couple of linksI came to know that Perl does the compilation and create an intermediate byte code and then interpret that byte code. My question is where does that byte code reside?
Like in other language like java, c we can see the machine executable object code after compilation. Though Perl doesn't create machine executable code, but there should be some location where it stores the byte code temporarily.
The result of the compilation is stored in memory as a tree of opcodes, or optree for short. This structure is being walked by perl's runtime to execute your program.
You will probably find the "Compiled Code" section of perlguts interesting. It explains many of the details of building an executing a perl optree.
It's also sort of possible to write that optree out to disk and load it again into another perl process, using the B::C
distribution and the ByteLoader
module contained in it. However, this technique doesn't work all that well on many programs, so it's not recommended in any way.
It stores it in memory as an AST.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With