[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] FW: Perl Compiler source file
The post I was talking about @ the meeting last night.
j
-----Original Message-----
From: Scott Walters [mailto:scott@illogics.org]
Sent: Thursday, March 17, 2005 10:52 AM
To: Sapna Jain
Cc: perl-porters@perl.org
Subject: Re: Perl Compiler source file
Sapna,
The "compiler" is written in Perl. It does no optimization, but there are comments
about possibile optiizations in the files. The "compiled" code still uses
the bytecode operation definitions - it just unrolls the inner loop, calling
each bytecode operation function in turn in a long series. This still requires
libperl.a. The output is C. Perl bytecode ops are very high-level -
this makes it both harder and less rewarding to compile Perl source. Each
bytecode does a lot of work, and an optimizing compiler can't comprehend
the details of this work, nor can they gain benefit from rearranging the
operations in most cases.
If you're just interested in optimizing the bytecode, there is some room
for unrolling loops and the like. Peephole optization could replace longer
sequences with shorter ones. See the types.pm module on CPAN for an
example use of the optimize:
http://search.cpan.org/~abergman/types-0.05/lib/types.pm
Then check out the modules it references - optimize, optimizer,
B::Generate, and so on. B::Generate is key - running Perl can inspect and
change it's own bytecode. In this way, optimization and compilation are similar.
Another benefit of playing with Ponie rather than Perl 5 is the code base is
much smaller and readability is being given priority.
I hope this helps.
-scott
On 0, Sapna Jain <sapna@cse.iitb.ac.in> wrote:
>
> Hello,
>
> I m working in optimizing compilers, So, i want to study the perl
> compiler, how it compiles the program, and generate c code, and nay
> opportunities to improve the compilation process.
>
> But i could not find the files of perl source code, that usually do the
> compilation part.
>
> So, if you know about the source files, used for compilation please let me
> know, also if you have any documentation related to it.
>
> Thanks,
>
> sapna
> -----------------------------------------------------------------------------
> Only when you believe in your dreams...
> you can make them come true !
> ------------------------------------------------------------------------------
> Sapna Jain
> Mtech 1 CSE
> IITB
> ------------------------------------------------------------------------------