Saturday, May 18, 2013

llgo on Go 1.1

Hi folks,

(For those of you coming from HN/Twitter/elsewhere, this is a post about llgo. llgo is an LLVM frontend for the Go programming language).

In my last post I mentioned that work had began on moving to Go 1.1 compatibility; this has been my primary focus since then. Since Go 1.1 is now released (woohoo!), I've gone ahead and pulled all the changes back into the master branch on GitHub. If you want to play around, you can do the following:

  1. Get Go 1.1.
  2. Get Clang and LLVM (I've tested with 3.2, Ubuntu x86-64). Make sure llvm-config is in your $PATH.
  3. Run "go get github.com/axw/llgo/cmd/llgo-dist"
  4. Run "llgo-dist". This will install llgo into $GOBIN, and build the runtime.


The biggest new feature would have to be: defer, panic and recover (I'm lumping them together as they're closely related). I've implemented them on top of LLVM's exception handling support. The panic and recover functions are currently tied to DWARF exception handling, though it's simple enough that it should be feasible to use setjmp/longjmp on platforms where DWARF exception handling isn't viable.

Aside from that, there's some new bits and bobs:

  • Method sets are handled properly now (or at least not completely wrong like before). This means you can use a embedded types' methods to satisfy an interface.
  • "return" requirements are now checked by go/types
  • cap() is now implemented for slices.
  • llgo-dist now builds against the LLVM static libraries (if available) by default now, with an option for building against the shared libraries.

I'll be working on a temporary fork of cmd/go to build programs with llgo, while a long-term solution is figured out. I'd also like to get PNaCl integration working again, given that its release is nigh.

That's all for now.

No comments:

Post a Comment