Posts

Showing posts from July, 2019

Flags and Syscalls and Modules, Oh My!

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, please let me know in the comments section. I have a couple of updates this week! I've gotten --compile working and have made progress on packaging the code for Modules inside the ELF (though I haven't quite coaxed things into using those packaged modules). Fair warning, this post is going to be a bit long. If you want to hear about the changes I made to NQP , jump to Adding the --compile functionality . If you want to hear about the changes I made to p6_linker , jump down to Altering the p6_linker.  If you want to hear about the progress towards module functionality, jump down to Module troubles. If you just want a brief summary of what I did, jump down to In summary. And as always, if you want to hear about

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 method looks at

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