http://www.perlmonks.org?node_id=990576


in reply to Re^4: Perl 5 Optimizing Compiler, Part 4: LLVM Backend?
in thread Perl 5 Optimizing Compiler, Part 4: LLVM Backend?

bulk88,

Sorry for the delayed reply, the thread is getting long and twisty!

Imagine my edge cases are something like an entire operating system or some high-performance parallel code or an attempt at strong AI. There are many kinds of code that would benefit greatly from general-purpose runtime optimization. Yes, I have such code.

I can supply my own time, as well as the time of my modest Perl team. I can supply coordination efforts and put together funding for qualified coders. I can even code. I'm not sure what patents you think we would need?

I'm not looking for permission to do this, I'm looking for a WAY to do this. So far my options all seem to require some amount of speculation and collaboration with the most talented coders around. Fun!

Yes, the general idea is to put together funding to hire a few programmers and have them target various backends such as LLVM. I think LLVM may have a very bright future.

I looked at the stuff you linked from David Mertens about the Tiny C compiler, but I'm not sure how it relates to what we're doing?

Thanks,
~ Will
  • Comment on Re^5: Perl 5 Optimizing Compiler, Part 4: LLVM Backend?

Replies are listed 'Best First'.
Re^6: Perl 5 Optimizing Compiler, Part 4: LLVM Backend?
by bulk88 (Priest) on Aug 29, 2012 at 23:41 UTC
    Imagine my edge cases are something like an entire operating system or some high-performance parallel code or an attempt at strong AI. There are many kinds of code that would benefit greatly from general-purpose runtime optimization. Yes, I have such code.
    Auto-parallelization/auto-threading for cpu bound algorithms, thats a worthy idea and aslong as there are no evals or the lexicals never leave the sub, auto-parallization should be possible automatically. Since Perl optrees can almost always be converted back to their original source code (except for constant folding and dead code elimination from "const" value perl subs), try to convert a Perl sub that that takes 1 @_ SV, copies it to a lexical (loosing magic and tied I believe in the process) SV, does a series of math operations against it using const numbers, and returns the new value in scalar context (thats 1 line of code). The CV is converted from being Perl bytecode to being an XSUB in machine code, and the C function is a call to 1 C function that makes a call to the LLVM VM to run precompiled to LLVM Bytecode LLVM Bytecode, or to the JIT machine code produced by LLVM. In Perl I guess how you try to optimize a sub would be
    LLVM::compile(\&somePurePerlSub);
    I presume the BioPerl/Biological Science sector folks, might throw you some grants if your successful.
    I can supply my own time, as well as the time of my modest Perl team. I can supply coordination efforts and put together funding for qualified coders. I can even code. I'm not sure what patents you think we would need?
    I included the patents just as an example. If you are one guy with a dream, and no resources, you have to do it yourself or convince someone to give you $ so you can do your dream as a day job.

    I looked at the stuff you linked from David Mertens about the Tiny C compiler, but I'm not sure how it relates to what we're doing?

    Thanks,
    ~ Will

    It really doesn't, it just shows that others have had realistic ideas of plugging foreign code from "compilers" at runtime into perl.