Register allocation in a ruby compiler ( 2020-03-22 )
I had put off proper register allocation until now, and somehow the 100 commits it took verfies 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.
Parsing parfait and other goodies ( 2019-08-20 )
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 compil . . . .Read whole post
Class methods and a conference ( 2019-02-28 )
In short, class methods are working. Plus is some meta stuff that and gotchas that i will explain below. Also i was at presenting rubyx at the first international conference, and there are a couple of misc improvements.
Classes are Singleton objects
Class methods came up when parsing Parfait. To create objects we usually use n . . . .Read whole post
Implicit blocks are working ( 2018-08-20 )
Basic enumerator style blocks were not as bad as i though. Admittedly i thought they would be close to impossible, so compared to that a few hundred commits are really quite little.
Different kind of blocks
To start with let me lay the ground. In ruby code, i see blocks used in basically two kind of ways. I call the first one . . . .Read whole post
Understanding rubyx through historic decisions ( 2018-07-25 )
Off course the architecture gives a good overview of the system as it is. But it does not explain how we got there. And sometimes knowing the journey makes it easier to understand where one is. So i shall try to highlight the four or five main
Macbook + Ruby == Rasperry Pi
1000 tests and working binaries ( 2018-06-22 )
It was almost going to be working binaries and over 1000 tests. But i am coming more and more to the point where software is measured in number of tests, not lines of code.
It was shortly after t . . . .Read whole post
Four years and going strong ( 2018-04-22 )
After finishing the code, i updated all the docs too!
Doing anything for the first time is not so easy. I have taught enough by now to see
the experience of another, is to the process of learning.
I was so much thinking about Vm's in the . . . .Read whole post
A dynamic hello world ( 2018-04-09 )
Now that i have had time to write some more code (250 commits last month), here is the good news:
Sending is done
A dynamic language like ruby really has at it’s heart the dynamic method resolution. Without that we’d be writing C++. Not much can be done in ruby without looking up methods.
Its about self control ( 2017-11-11 )
Since i currently have no time to do actual work, i’ve been doing some research.
Reconsidering the madness
One needs to keep an open mind off course. “R . . . .Read whole post
More types will come but later ( 2017-09-05 )
While work on Mom (Minimal object machine) continues, i can see the futures a little clearer. Alas, for now the shortest route is best, so the future will have to wait. But here is what i’m thinking.
How not to interpret ( 2017-04-07 )
Method caching can be done at language level. Wow. But first some boring news:
Vool is ready, Mom is coming
The Virtual Object Oriented Language
Vool will not reflect some of ruby’s more advanced features, like splats or . . . .Read whole post
Layer summary ( 2017-03-03 )
Going on holiday without a computer was great. Forcing me to recap and write things down on paper.
One of the main results was that the current layers are a bit mixed up and that will have to be fixed. But first, some of the properties in which i think of the different layers.
Of slopes and chains and changes in the air ( 2017-02-03 )
As i said in the last post, a step back and forward, possibly two, was taken and understanding grows again. Especially when i think that some way is the way, it always changes and i turn out to be at least partially wrong. The way of life, of imperfect intelligence, to strive for that perfection that is forever out of reach. Here’s the next ins . . . .Read whole post
Integer unification ( 2017-01-10 )
I just read mri 2.4 “unifies” Fixnum and Integer. This, it turns out, is something quite different from what i though, mostly about which class names are returned. And that it is ok to have two implementations for the same class, Integer.
But even it wasn’t what i thought, it did spark an idea, and i hope a solution to a problem that i . . . .Read whole post
A new year a new name ( 2017-01-02 )
RubyX compiles ruby to binary
The previous name was from a time in ancient history, three years ago, in internet time over a decade (X years!). From when i thought i was going to build a virtual machine. It has been clear for a while that what i am really doing is building a compiler. A new thing need . . . .Read whole post
The road ahead ( 2016-07-26 )
So, the plan, in short:
- I need to work a little more on docs. Reading them i notice they are still not up to date
- The Type system needs work
- The Method-Function relationship needs to be created
- Ruby compiler needs to be written
- Parfait moves back completely into ruby land
- Soml parser shou . . . .Read whole post
Mixup of levels ( 2016-03-07 )
Writing Soml helped a lot to separate the levels, or phases of the ruby compilation process. Helped me that is, to plan the ruby compiler.
One compiler down one to go ( 2015-11-28 )
Ok, that was surprising: I just wrote a language in two months. Parser, compiler, working binaries and all.
So, the good news: it it works. . . .Read whole post
I like not playing computer ( 2015-07-25 )
It really is like Bret Victor says in his video: good programmers are the ones who play computer in their head well.
Why? Because you have to, to program. And off course that’s what i’m doing.
But when it got to debugging, it got a bit much. Using gdb for non C code, i . . . .Read whole post
A new language ( 2015-09-03 )
It is the one thing i said i wasn’t going to do: Write a language. There are too many languages out there already, and just because i want to write a vm, doesn’t mean i want to add to the language jungle. But …
As it happens in life, which is why they say never to say neve . . . .Read whole post
The static call chain ( 2015-06-20 )
Quite long ago i had already determined that return addresses and exceptional return addresses should be explicitly stored in the message.
It was also clear that Message would have to be a linked list. Just managing that list at run-time in Register Instructions (ie almost assembly) . . . .Read whole post
Hello world again ( 2015-07-01 )
After almost a year of rewrite: Hello World is back.
Working executables again
So much has changed in the last year it is almost impossible to recap. Still a little summary:
The whole layer of the . . . .Read whole post
Expression is slot ( 2015-05-20 )
Since i got the ideas of Slots and the associated instruction Set, i have been wondering how that fits in with the code generation.
I moved the patched AST compiler methods to a Compiler, ok. But still what do all those compile methods return.
In ruby, everything is an expression. To recap “ . . . .Read whole post
Review _2015 ( 2015-03-21 )
As before the original start of the project, i was 6 weeks on holiday. The distance and lack of computer really helps.
So i printed most of the code and the book and went over it. And apart from abismal spelling i found especially one mistake.
I had been going at the thing from the angle of producing bin . . . .Read whole post
A better register machine ( 2014-09-30 )
The register machine abstraction has been somewhat thin, and it is time to change that
When i started, i started from the assembler side, getting arm binaries working and off course learning the arm cpu instruction set in assembler memnonics.
Not having any experienc . . . .Read whole post
Register allocation reviewed ( 2014-09-12 )
The time of introspection is coming to an end and i am finally producing executables again. (hurrah)
Block and exception
Even neither ruby blocks or exceptions are implemented i have figured out how to do it, which is sort of good news. I’ll see off course when the day comes, but a plan is made and it is . . . .Read whole post
Object storage ( 2014-08-19 )
While trying to figure out what i am coding i had to attack this storage format before i wanted to. The immediate need is for code dumps, that are concise but readable. I started with yaml but that just takes too many lines, so it’s too difficult to see what is going on.
I just finished it, it’s a sort of condensed yaml i call sof (sal . . . .Read whole post
Framing ( 2014-07-17 )
In a picture, or when taking a picture, the frame is very important. It sets whatever is in the picture into context.
So it is a bit strange that having a frame had the same sort of effect for me in programming. I made the frame explicit, as an object, with functions and data, and immediately the whole message sending be . . . .Read whole post
An exceptional thought ( 2014-06-27 )
I was just reading my ruby book, wondering about functions and blocks and the like, as one does when implementing a vm. Actually the topic i was struggling with was receivers, the pesty self, when i got the exception.
And while they say two steps forward, one step back, this goes the other way around.
One step . . . .Read whole post
Name has been found ( 2014-08-01 )
It has been a bit of a journey, but now we have arrived: Salama is officially named.
Salama is a real word.
It is a word of my home-country Finland, a finnish word (double plus).
Salama means lightning (or flash), and that is fast (double dou . . . .Read whole post
Layers vs passes ( 2014-07-05 )
I am not stuck. I know i’m not. Just because there is little visible progress doesn’t mean i’m stuck. It may just feel like it though.
But like little cogwheels in the clock, i can hear the background process ticking away and sometimes there is a gong.
What i wasn’t stuck with, is where to draw the layer for the vm.
More clarity ( 2014-06-10 )
It’s such a nice name, crystal. My first association is clarity, and that is exactly what i am trying to achieve.
But i’ve been struggling a bit to achieve any clarity on the topic of system boundary: where does OO stop. I mean i can’t very well define method lookup in ruby syntax, as that involves method lookups. But tail recursion is so . . . .Read whole post
First fibo ( 2014-05-20 )
Both “ends”, parsing and machine code, were relatively clear cut. Now it is into unknown territory.
I had ported the Kaleidoscope llvm tutorial language to ruby-llvm last year, so there were some ideas floating.
The idea of basic blocks, as the smallest unit of code without branches was pretty clear. Using those as jump targets wa . . . .Read whole post
Asm out ( 2014-04-24 )
Part of the reason why i even thought this was possible was because i had bumped into Metasm.
Metasm creates native code in 100% ruby. Either from Assembler or even C (partially). And for many cpu’s too. It also creates many binary formats, elf among them.
Still, i wanted something small that i could understand easily as it was . . . .Read whole post
To see or not to_c ( 2014-04-22 )
The c machine
Software engineers have clean brains, scrubbed into full c alignment through decades. A few rebels (klingons?) remain on embedded systems, but of those most strive towards posix compliancy too.
In other words, since all programming ultimately boils down to c, libc makes the bridge to the kernel/ma . . . .Read whole post
First parses ( 2014-05-06 )
Parsing is a difficult, the theory incomprehensible and older tools cryptic. At least for me.
And then i heard recursive is easy and used by even llvm. Formalised as peg parsing libraries exists, and in ruby they have dsl’s and are suddenly quite understandable.
Off the candidates i had first very positive experiences with treet . . . .Read whole post
Official start ( 2014-04-10 )
Well, it has been a good holiday, two months in Indonesia, Bali and diving Komodo. It brought clarity, and so i have to start a daunting task.
When i learned programming at University, they were still teaching Pascal. So when I got to choose c++ in my first bigger project that was a real step up. But even as i wrestled templates, it w . . . .Read whole post