Skip to content

Instantly share code, notes, and snippets.

@bdw
Created March 21, 2014 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdw/9682548 to your computer and use it in GitHub Desktop.
Save bdw/9682548 to your computer and use it in GitHub Desktop.
<h3>What is your e-mail address and IRC nick?</h3>
<p>bartwiegmans@gmail.com, brrt on freenode</p>
<h3>What is your web page, blog, or microblog?</h3>
<p><a href="https://plus.google.com/u/0/+BartWiegmans/posts">I have a google+ page</a> - although I don't actually post a lot of things there.</p>
<h3>What is your academic background?</h3>
<p>I'm studying for a bachelor's degree in biology at the university of Groningen in the Netherlands.</p>
<h3>Who is a possible mentor for the project you are proposing?</h3>
<p>Jonathan Worthington (jnthn)</p>
<h3>What is the ultimate goal of your proposal?</h3>p
<p>To create an optimising JIT compiler for the MoarVM virtual machine.</p>
<h3>What components/modules will the proposed work modify or create?</h3>
<p>I will make substantial modifications and additions to the interpreter
core of MoarVM.</p>p
<h3>What benefits does your proposed work have for Perl and its community?</h3>
<p> It will allow us to run NQP and perl6 code much faster. And faster code
is more useful code, because it then becomes feasible to use perl6 on
larger projects.</p>
<h3>Why are you the right person to work on this project?</h3>
<p>Nobody else was crazy enough. Also, starting this year I've been
programming for 10 years, starting with C and working my way through a
variety of programming languages (including perl). I actually have some
experience in working on interpreters and virtual machines: I created a
scheme interpreter in high school and worked on the parrot project in
2012. I'm also motivated, I like the perl6 community, and I'd love to
learn more about compilers and virtual machines.</p>
<h3>How do you plan to achieve completion of your project?</h3>
<p>Although a JIT compilter from scratch is quite an ambitious project,
certainly for a single student in a single summer, I think it is also
doable. The first reason is that there are many open-source
implementations, such as LuaJIT, Dalvik VM, and v8, from which ideas can
be stolen. The second reason is that there are also open source
libraries available (such as dynasm) that take over many difficult and
architecture-dependent parts of JIT compilation. Also, I plan to work
together with my suggested mentor to create certain parts that require
in-depth knowledge, such as forming a control flow graph out of MoarVM
bytecode.</p>
<p>I will work in public using github to publish all code and merge back to
the MoarVM project repository using pull requests when appropriate.</p>
<h3>Please provide a schedule with dates and important milestones/deliverables (preferably in two week increments).</h3>
<p>During the first two weeks, I'd like to take the time to research the
structure of the MoarVM opcode set in further detail, as well as the
functioning of the dynasm library. If dynasm turns out to be unsuitable,
I hope to find out quickly.</p>
<p>In the second two weeks (from June 2 to June 15) I will work on creating
a bytecode-to-graph converter in MoarVM. I will probably also make a
pretty-printer for this bytecode graph, perhaps as a part of the gdb
support script. If possible, I'd also like to add (type) tracing
operations and tables to the VM. This information will then be usable
for optimisation routines.</p>
<p>In the third two weeks I want work on compiling the code graph to a
intermediate format that is suitable for just-in-time compilation (the
'MoarVM low-level bytecode'. The v8 javascript interpreter does a very
similar thing, I believe. If it is practical, I'd like that intermediate
format to be to the 'regular' MoarVM bytecode restricted to a set of
'core' operations. (MoarVM already defines a 'core' set of operations
informally. However, the full set of operations is rather large, which
is why I don't think it is suitable for 'direct' JIT compilation).</p>
<p>During the fourth two weeks (June 30 to July 13) I plan to implement the
'MoarVM low-level bytecode' in the form of JIT-able fragments using
dynasm. When this is completed the next step is to JIT-compile these
fragments using the dynasm library and implement an 'atomic code update'
routine that replaces the old interpreted code with new JIT-compiled
code. I'm least certain about the time this phase will take compared to
others.</p>
<p>In the next two weeks (July 14 to July 28) I think it is time to create
explicit tests for the JIT system. Testing is obviously a continuous
part of software development but taking two weeks 'off' for it will help
find the weak spots and bugs that have been introduced while working. It
will also give time to document the design and implementation and create
an API for optimisation routines.</p>
<p>In the last two 'real' weeks of the summer I will work on creating a
'deoptimisation routine'. The function of a deoptimisation routines is
to transfer the state from a running compiled routine to the state of
the 'source' interpreted routine so that execution can continue
there. It can be called when an assumption that was used to create
optimised bytecode is no longer valid and is therefore required for the
implementation of speculative type feedback optimisation.</p>
<h3>What will be showable two months into the project [1]?</h3>
<p>The three important things I'd like to have by then are:</p>
<ul>
<li>An infrastructure for type and usage tracing in the interpreter.</li>
<li>A (simplistic) JIT compiler.</li>
<li>An API for bytecode optimisation routines</li>
</ul>
<p>Also, I'd like to have merged the work into the public MoarVM repository
master branch by then.</p>
<h3>What are your past experiences with the open source world as a user and as a contributor?</h3>
<p>I use many open source products (this proposal faithfully written in
emacs :-)) and have in some occasions have had the chance to report bugs and
submit fixes. (Notably in the django world were everything is always
broken, but that is a digression).</p>
<h4>If available, please include links to any other code you wrote for Perl or other open source projects.</h4>
<p>I've written mod_parrot, which embeds parrot into the apache httpd
server. See https://github.com/bdw/mod_parrot. This hasn't been updated
for quite some time, though, because I couldn't keep up with parrot code
churn. I've also published some interesting solutions to problems I've
encountered in https://github.com/bdw/lab.</p>
<h3>What other relevant projects have you worked on previously and what knowledge you gained from working on them?</h3>
<p>I've created a scheme interpreter in C. And even though scheme is
relatively simple it taught me many things about parsing, evaluation and
garbage collection, which I think are still relevant skills.. More
recently I've worked with the parrot virtual machine and learned a lot
about the structure of (bytecode) virtual machines with more flexible
object representations.</p>
<h3>What other time commitments, such as school work, another job, planned vacation, etc., will you have between May 19 and August 18?</h3>
<p>The last course I'll be taking this year will end somewhere arround the end
of may (not an exact date because no schedule is set). I have no other
obligations or vacations planned.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment