Rust progress

October 2nd, 2010

Three months ago we introduced the Rust programming language, a new lower-level language that Mozilla is developing. At that point the bootstrap compiler was just beginning to support interesting constructs, the runtime system only worked correctly in single-threaded mode, and library code was mostly nonexistent.

There has been a fair bit of work since since then:

  • We’ve made over 500 commits to the code.
  • The boostrap compiler and runtime have grown by 6000 lines.
  • The self-hosted compiler — the second version of the compiler, written in Rust and compiled with the bootstrap compiler — has grown by 3800 lines and is now capable of lexing, parsing, and translating some minimal programs (hello world, various expressions) through LLVM to executable code.
  • The standard library has grown by 1000 lines, including a small selection of nontrivial data structures and helpers.
  • We’ve discussed and agreed-on a number of careful shifts to the language semantics and pragmatics:
    • Compile-time constant value items.
    • A rewrite of the tag system in nominal terms.
    • Shifting to toolchain-supported symbols and self-encoded metadata rather than the existing heavy reliance on DWARF metadata.
    • Changes to the effect system and its classification of stateful values, as well as a system for “freezing” snapshots of mutable data (and thawing them later).
    • Reclassification of various syntactic forms from statements to expressions.

I had a hand in a lot of the above work, but several others have been getting involved as well, including interns, MoCo employees and community members:

  • Michael Bebenita overhauled much of the runtime system to work better with threads, including rewriting the lockless communication queues, implementing a proxy model for inter-thread references, and correcting a number of races and lifecycle bugs in the task model.
  • Roy Frostig fixed a large number of semantic translation bugs — particularly concerning vector manipulation and type descriptors — and implemented many important standard library features (containers, I/O functions, debugging helpers).
  • Patrick Walton rewrote the typechecker and fixed several bugs in the DWARF generator and Win32 object file generator, and also helped with the semantics of recursive types and multiply imported modules.
  • Or Brostovski implemented a number of missing language constructs and contributed several tests
  • Jeffrey Yasskin added code to the standard library, the LLVM bootstrap backend and its debug information, the tasking system, destructors and the OSX object file generator.
  • Peter Hull contributed translations of various benchmarks.

Of course there remains a very large amount of work ahead. I’m looking forward to watching the self-hosted compiler mature. The fact that it requires rewriting the existing front- and middle-ends means that we have a chance to adjust a number of subtle, systemic implementation choices with the benefit of hindsight; choices that would otherwise be a bit too costly to revisit in the bootstrap compiler, not obviously worth the effort. The self-hosted compiler also has the pleasant advantage of targeting LLVM alone, which frees us from spending much (or any) time on backend bugs. I expect progress on it to be much quicker.

Leave a Reply

You must be logged in to post a comment.