|No such thing as a small change|
Perl 5 Optimizing Compiler, Part 4: LLVM Backend?by Will_the_Chill (Pilgrim)
|on Aug 27, 2012 at 08:18 UTC||Need Help??|
I just e-mailed this to Nick Clark, let's see what Perl Monks thinks...
Are you familiar with LLVM? Here's a technical link about how to incrementally port Perl 5 to use LLVM as an optimizing backend. Apparently this approach can be done by incrementally converting the pp_*() Perl 5 guts functions into some theorized r_*() format to emit LLVM assembly code, while maintaining 100% backward compatibility with all existing Perl 5 code and XS too! (In other words, NOT a subset of Perl 5 like Perlito and C'Dent/Perl5i, but the whole of Perl 5.)
Some choice quotes from the link:
"I was guessing 1-2 months until we can have certainty whether or not it'll work at all, that is having a functional proof of concept with no real performance goals yet, but which has all the right pieces in place.I think a more realistic time frame for this whole project is something like 6 months to get a first version out with the various pains dealt with, and then another endless potential for incremental performance improvements by tweaking the emitted LLVM assembly code."
"I suspect the main benefit would actually be in marketing (look how excited we're getting about python being '5x faster'), and in demonstrating that the runtime is able to adapt and be modernized, perhaps paving the path to more ambitious language and runtime improvements."
"Advantages of this plan compared to other approaches of jitting perl 5:
1. No code changes, the same intricate definitions of all of perl's opcodes are reused. this means that all the accumilated wisdom is not lost, the data structures are the same, and in theory the system is still binary compatible with compiled XS modules.
2. This means a lot less work than developing a real vm backend for perl 5 llvm's C interoperability features are key to this.
3. llvm is backed by many organizations, it's stable, well funded and has a lively community so it is unlikely to die off. This provides us with a real, feature complete jit system with very advanced optimizations that can target many platforms, without any maintenance burden on the p5 developers."
I eagerly await your interpretation of this potential project.