Jump to content

April 2017 »

2324252627 28 29

View more

The Bag of Holding

4: Adsense

Still rambling about self-hosting

Down to 9 tests in the compiler suite that still need some love before they will pass.

For those not keeping score at home, this means that 58 out of 67 compiler tests are passing in the Epoch implementation of the Epoch compiler. In other words, Epoch is getting very, very close to being able to compile itself.

Fun facts:
The compiler in C++, not incl...

Speculation and such

Just fooling around.

//// Define an Epoch task that does some work//task Worker :{ // // This specifies a "message signature" which can be // used by and instance of this task to receive data // and commands from other code. // Work : integer a, integer b { // Do some computation integer result = a + b // Reply...

Epoch self-hosting progress

So the Epoch compiler is now written end-to-end in Epoch. There is no C++ left in the bootstrapping process aside from the runtime environment which does garbage collection and such.

Sadly this doesn't mean that we're quite to self-hosting just yet. Only about a third of the compiler test suite is passing, and a lot of the remaining work centers around g...

Epoch Optimizations and Garbage Collection

Following the Great Garbage Collection Debug Spree of the past few weeks, I've noticed a general trend towards bad performance in the realtime raytracer benchmark. At one point it was down to ~6.5FPS peak performance, which is just unacceptably bad.

Profiling revealed two main causes of this slowdown. One is the garbage collector invocations themselves;...


Turns out my garbage collection woes are over.

I was strongly suspicious of the inliner in my last post, and it turns out that this hunch was (albeit indirectly) completely correct.

The obvious thing to do when facing a bug like this is to compare the code generated; dump out a listing of the version that works, and a listing of the version that doesn'...

The ongoing mission

Nailed down some more quirks in the GC over the past day; unfortunately the last one is a real bugger.

It appears that LLVM's function inlining optimizations cause the GC to go slightly insane. I have yet to ascertain the exact interaction between the inliner and the GC, but disabling all inline functions makes the GC run beautifully.

I also remembered...

More adventures in garbage collection

One of my least favorite types of bug to unravel is the Ball of Yarn.

A Ball of Yarn is not just one bug. It's a large number of bugs, all in close proximity, which influence and interact with each other. If you pull on one of the threads, one of two things will happen: either you will slowly gain insight into the mess, or (more likely), you'll inadverte...

Hard lessons

I've learned three nasty lessons this week.

First, exception handling in C++ is a knotted mess of undefined behavior, especially when you start blending JIT compiled native code with C++ code that can throw exceptions.

Second, as a result of this, when testing code you should always run it under a debugger so you can tell if an exception is getting thr...

IDE hackery

As I continue to mess with self-hosting the Epoch compiler, I'm spending a lot more time actually editing Epoch code than C++ code. This is a wonderful thing overall, since I basically created the language precisely so I could quit writing apps in C++.

Writing a lot of Epoch code in Notepad is pretty brutal, and I was kind of tired of just working on th...

I'll just leave this here...

Here's the kicker: the compiler that produced this working program is written entirely in Epoch.

Yes, the test program is extremely minimalistic, but it passed .

Self-hosting completion is now just a matter of getting the parser to understand the entire language grammar, and finishing out the last bits of semantic analysis/type system enforcement t...