I had put off proper register allocation until now, and somehow the 100 commits it took verifies that i wasn’t completely wrong. I think there are quite a few differences to the normal problem and solution, to warrant an explanation, so here it goes: How RubyX does Static Single Assignment and Register Allocation in a ruby compiler.
To understand the problem, i’ll explain the previous, much simpler, approach and it’s problems. Then i’ll explain the new way, with reference to what i read the “normal” way is and the differences i think we have.
Simple register allocation is quite simply hard-coding at least some register names into the generation of assembler-like code, and having very simple ways to deal with the rest. In RubyX the assembler-like layer of the code is called Risc, and that is basically a simplified ARM. ARM has registers from r0 through to r15. …
Ok, maybe that is too dramatic. It’s not that i have been that silent, nor do i really have earthshaking things to say. But i have been thinking about writing for a while and now is the time to start. We’ll see.
When i started with spirituality, i remember there were some entry books. Rather vague writings for people like me, with vague feelings that there has to be more to this.
In hindsight i went through that phase quite quickly, started searching, quite intensely, and soon found my master. …
As rubyx will eventually need to parse and compile itself, i am very happy to report success on the first steps towards that goal. Also better design, benchmarks, and another conference are on the list.
As a recap, Parfait is that part of the core library that we need already during compilation. Ie the compiler creates Parfait objects during compilation and uses Parfait code to do this. This off course is a conundrum, which is solved by using the Parfait Code as is in the compiler (and some ruby module magic to avoid name clashes)
Naturally any meaningful program that the compiler generates will use Parfait and so Parfait must be available at run-time, ie parsed and compiled. Since i have been busy doing the basics, this has been on the ToDo for a long while. …