Hacker News new | ask | show | jobs
by omaranto 3856 days ago
"Rakudo's had more testing since it's been around forever but MoarVM is where my hopes lie" is a little confusing to me. Rakudo and MoarVM are not the same type of thing. Rakudo is a Perl 6 compiler with multiple backends. I don't follow this very carefully, but I think it used to have a Parrot backend, and currently has two maintained backends: one for the JVM and one for MoarVM.

Is that wrong? If not, did you mean "Rakudo on Parrot" or "Rakudo on the JVM" when you wrote just "Rakudo"?

1 comments

Rakudo is an implementation of Perl 6 built on top of NQP (Not-Quite-Perl. a pseudo lang that implements the easier parts of Perl 6 that can be targeted and optimized by VMs), and MoarVM is a C-based NQP interpreter. There is also an NQP back-end for the JVM, which is now Rakudo runs on the JVM. Think of NQP as an intermediate language (kind of like java bytecode but much higher level).

It's like this: Rakudo -> NQP -> MoarVM

or like this: Rakudo -> NQP -> NQP-JVM implementation -> JVM

Want to get Perl 6 running on the .Net CLR? Implement an NQP interpreter (which is supposed to be fairly easy) and you're 99% done (at least that's my understanding).

Strictly speaking, MoarVM is not an NQP interpreter - it runs MoarVM bytecode.

Sure, MoarVM is by design semantically close to NQP, but if you look at

    $ nqp-m --stagestats -e ''
    Stage start      :   0.000
    Stage parse      :   0.003
    Stage ast        :   0.000
    Stage optimize   :   0.000
    Stage mast       :   0.005
    Stage mbc        :   0.000
    Stage moar       :   0.000
you get mostly the same steps as on the JVM

    $ nqp-j --stagestats -e ''
    Stage start      :   0.000
    Stage classname  :   0.045
    Stage parse      :   0.067
    Stage ast        :   0.000
    Stage optimize   :   0.009
    Stage jast       :   0.145
    Stage classfile  :   0.010
    Stage jar        :   0.000
    Stage jvm        :   0.003
except that MoarVM bytecode files do not get bundled into JARs and there's no need to do the extra processing that happens in the 'classname' stage.
Fair enough. MoarVM is just another interpreter targeted, but it just happens to have been designed with NQP and Perl 6 in mind, so it maps extremely well.