Simon Cozens wrote: > ... Mono's work on JIT compilation ... they've got some pretty > interesting x86 code generation stuff going on.
Mono is doing some very cool stuff, but it's kind of hard to understand at this time. The x86 code generation macros are easy to use, but the instruction selection is based on a re-implementation (?) of BURG and it will take some time to dig through the way that code works. BURG is a code-generator generator in the style of yacc. (More trips to the library...) I also poked around the Lightning project which is documented a bit better. It's also more widely ported (although I'm sure Mono is going to catch up soon -- those guys code like maniacs.) Here's a quote from Lightning that worries me a bit: from doc/body.texi: | @lightning{} has been useful in practice; however, it does have | at least four drawbacks: it has limited registers ... | | The low number of available registers (six) is also an important | limitation. However, let's take the primary application of dynamic | code generation, that is, bytecode translators. The underlying | virtual machines tend to have very few general purpose registers | (usually 0 to 2) and the translators seldom rely on sophisticated | graph-coloring algorithms to allocate registers to temporary | variables. ... If all the current JIT work is focused on JVM and CIL, then Parrot's JIT is going to break new ground. There's a more fundamental issue though. After spending time looking at the benefits of a JIT and thinking about the "yet another switch/goto implementation" conversation, I'm starting to think that a JIT will be almost useless for Parrot. JITs help when the VM is focused on lots of small instructions with well-known, static semantics. Perl's use of Parrot is going to be focused almost completely on PMC vtable ops. A JIT has no advantage over a threaded interpreter. About the only place where a JIT might really win big is in regexps. Have other people come to the same conclusion? Is there any interest in a less dynamic dialect of Perl that can take advantage of a JIT? Should we feed a request to p6-language to think about this? - Ken