I wonder how I can debug the Moarvm bytecode. Is there a document that describes for instance howto convert raku to moarvm and howto dump the generated bytecode. If i try to i.e. run:
rakudo-m --target=mbc c.p6
===SORRY!===
Cannot dump this object; no dump method
Somewhere I read about a "--dump" switch but that doesnt seem avaiable. I custom compile rakudo/nqp/moarvm from github.
The
targetargument to the rakudo compiler requires an--output=filenamefor some of the values.parse,ast, andoptimizewill all happily output to a console, though.The
moarbinary is what has the--dumpflag, but I would perhaps suggest using the debug output from the spesh subsystem of moarvm, which is the dynamic bytecode specializer and jit.You can get at it by setting the environment variable
MVM_SPESH_LOGto a filename. If the code in question doesn't run often enough to appear in the spesh log, you can setMVM_SPESH_NODELAYsomoarwill consider routines "hot" much earlier. There will be less information for the optimizer to work with, but if you're after seeing the compilation result only, it should be just fine.