Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

The Bag of Holding


A bottomless satchel once possessed by a knight-errant.

Epoch 64-bit compiler progress

Just a short while ago, the first working 64-bit compiler for Epoch was produced!

Well, "working" might be a minor stretch; it launches, prints a simple text banner message, and then exits cleanly. But that represents a lot of operational code by itself.

  • The 32-bit compiler is able to lex, parse, type-check, and code-gen the entirety of the 64-bit compiler’s source code.

  • The 32-bit linker can emit 64-bit binaries, assisted by LLVM’s machine code generation facilities.

  • The 64-bit compiler binary is a completely functional Windows executable image.

  • This executable can run to completion on 64-bit Windows versions.

  • Inside the compiled binary is a table of string constants.

  • 64-bit Epoch code can load those strings and route them out to the command-line console.

  • A number of support DLL calls are involved in this process, including loading garbage collection metadata and stack tracing for identifying GC roots.

All told there are hundreds of thousands of lines of code involved. Building the 64-bit compiler takes about 164 seconds (just over two and a half minutes) when using debug versions of LLVM. (For comparison, the 32-bit compiler can self-host in under 20 seconds, but that’s an unfair comparison because that build process uses optimized Release versions of LLVM.)

I’m pretty pleased with this progress. There are still many things left to get working, though.

  • 64-bit globals do not work correctly; all of them are currently stuffed into a single random address which may or may not crash when dereferenced.

  • More support DLL calls need to be implemented or eliminated.

  • Certain code constructs do not work correctly yet; this is worked around for the time being by not using them in the compiler, but they will be good to get working as soon as is practical.

  • A large number of hacks and temporary shims exist in the linker. This will need to be cleaned up substantially before self-hosting is really practical.

  • Debug metadata and symbols are not generated correctly yet.

  • Visual Studio integration has a number of bugs, ranging from the pesky to the outright unusable.

  • It is exceedingly likely that there will be bugs in the compiler, meaning that 64-bit self-hosting is still a ways out even if the basics are operational.

Making the highly optimisic presumption that this will all happen soon, I think it’s fair to say that once all of the above is addressed (and 64-bit self-hosting is complete) it will be time to cut another release of Epoch.

In all probability, though, I’ll course-correct sometime between now and then, but it never hurts to have objectives!


About the author

Mike Lewis

Bellevue, WA https://apoch.github.io/

Guild Wars 2 Project Technical Director @arenanet and author of the Epoch programming language.


Discussions