Posts

Showing posts with the label moarvm

Summer in Review

Image
Hello! My name is Elli Peacock and I have spent the past three months working on a GSoC project to enable the creation of single file, self contained executables for Perl 6. If you would like to look at the code for my contributions, you can check them out on the  self-contained-executable branch of NQP.   As the summer comes to an end, I thought it would be appropriate at this point to summarize what I have accomplished so far, and what additional capabilities I would like to add in the future. There were four major phases to this project: generating ELF files (May/June), handling bytecode directly (July), adding the --compile capabilities to NQP (July), and enabling the use of modules (August). In this post, I will start with the original premise of my project, go over the highlights from the four major phases of work, and then discuss what improvements that would be nice to make in the future. I will also touch on my general experience in the GSoC and my experience worki...

Trials and Tribulations with Modules: Part Two

Image
Hello! I am a CS student working on a GSoC proof of concept to modify perl6 to create executable binaries. This blog documents my journey and struggles. There are likely more correct and maintainable ways to do what I've done so far. If you know a better way, or if you see an inaccuracy, please let me know in the comments section. This post has been incoming for a while, and as a result, has grown to a massive size. To make it a bit easier to digest, and more useful for those of you reading this hoping to find information about a particular aspect on module loading, I have chopped this post up into multiple smaller posts focusing on each of the smaller aspects. In this particular post, I'm going to focus on how module loading works. What's a module? For a complete explanation of modules, please refer to the Perl 6 documentation . This tutorial is a short and sweet explanation of modules, and this one is a bit more in depth, so pick your poison :). In brief sum...

Trials and Tribulations with Modules: Part One

Image
Hello! I am a CS student working on a GSoC proof of concept to modify perl6 to create executable binaries. This blog documents my journey and struggles. There are likely more correct and maintainable ways to do what I've done so far. If you know a better way, or if you see an inaccuracy, please let me know in the comments section. This post has been incoming for a while, and as a result, has grown to a massive size. To make it a bit easier to digest, and more useful for those of you reading this hoping to find information about a particular aspect on module loading, I have chopped this post up into multiple smaller posts focusing on each of the smaller aspects. In this particular post, I'm going to focus on how the dependencies required by your Perl 6 program are identified and how the dependency tree works. Identifying the dependencies An interesting feature I was accidentally triggering when running perl6 --compile=foo foo.pl6  gave me a bit of a head start in figurin...

Modifying Perl 6 Executable to Run Bytecode

Image
Exciting news! I've successfully modified  perl6  to run bytecode! You can look through my changes on Github here . In this post, I'm going to briefly go over what happens when you run perl6 , what I added to get the additional functionality, a few issues I ran into along the way, and what I'm doing next. What does running perl6  do? Let's imagine you are using MoarVM as your backend, Rakudo as your compiler, and have just written the program foo.pl6  and want to run it. You call perl6 foo.pl6.  What happens next? main.nqp begins to execute. This is the very beginning of the initialization process necessary for your program to run. An instance of the compiler  is created and set up . The path to the various Perl6 and NQP libraries that you may need are determined and bound to environment variables. Several command line options are added . Then, the compiler is actually entered with a call to command_line . command_line begins to execute. This me...

And Now For Something Completely Different

Image
(Not really, just a different perspective.) Hello! It's been a hot minute. Over the past two weeks I've tried several approaches to try to figure out a way get bytecode that could be executed, with most of those approaches having fairly limited success. But! I think I've finally made some progress in a direction that I'm going to be able to use. If you want to read the highlights of the in-between steps, feel free to keep reading full steam ahead. If you'd like to go ahead and skip to the current approach and what I've managed to get working, jump down to Modifying  eval . The Simple[sic] Way I started off with working on isolating the chunk of code that the perl6  executable used to set up the system to run. One thing that was pretty useful in sorting this out was a chunk of code was a recommendation by timotimo to set the environment variable  MVM_COVERAGE_LOG=~/mvm.log. The output written to that log includes the line number and file name of every line ...

Hello World!

Image
News on the GSOC project! I've been able to get "Hello world!" working! Here are my notes on the process of getting it to this point. Figuring Out the Right Approach On Sunday, I had a discussion on #moarvm with mornfall , nine , and brrt about the path forward I suggested in last week's update. Mornfall pointed out that replacing _start would likely be way more headache than it was worth. They instead suggested using objcopy to convert a text file containing the MBC bytecode into a .o file (also called relocatable ELF file), and then writing a small C program which invokes MoarVM using the bytecode packaged in the .o file. This is essentially the approach I used for my first attempt, with a few tweaks. As pointed out by nine, it currently isn't possible to directly call moar and have it execute MBC. If you try, you'll be greeted with this error message: Nine mentioned  that there is good deal of necessary setup that is done when perl6 is calle...