[bitc-dev] Bringup decisions
Jonathan S. Shapiro
shap at eros-os.org
Thu May 18 23:21:04 EDT 2006
On Fri, 2006-05-19 at 02:57 +0100, David Hopwood wrote:
> If it were my decision, I would probably have implemented the bootstrap
> compiler in ML, Scheme or Haskell, generating MLRISC or a Scheme-based IL.
> Generating C may look like a tempting way to get something working quickly,
> but it has many deficiencies as an intermediate language.
Swaroop wanted to do it in Haskell or O'Caml, but I overrode him.
The problem with using ML, Scheme, or Haskell is that it reduces the
bootstrap problem to a previously unsolved problem: bringing up an ML,
Scheme, or Haskell environment for the target. My experience has been
that even when you are simply going to a new minor variant of UNIX it
can be non-trivial to bootstrap any of those. We wanted a universal
assembly language, and I think that we got one.
We did look at various code generators, notably C-- and LLVM. We didn't
look at MLRISC, though in hindsight we should have done so.
Unfortunately *none* of those target all of the platforms that we need
to target, and C-- and LLVM aren't all that helpful.
I should add that originally we anticipated targeting GCC specifically
rather than C so that we could use the extended expressions. Because of
this feature, we didn't anticipate needing to do an SSA pass, which
would have made going to C much more convenient. This broke down when we
discovered that goto's don't work in GCC extended expressions. At that
point we were forced to do an SSA pass, with the result that we ended up
much closer to low level code generation than I had originally
anticipated.
In hindsight, I think what we probably should have done was to design a
low-level bytecode format and implement an interpreter for that. As with
many such plans, I think that we now know enough to do that, but we
probably didn't when we started the BitC work. For example, we now think
we know how the heap looks, and we definitely didn't then.
In any case, I'm now fairly convinced that targeting C for bringup
wasn't such a great idea, and cost us a fair bit of time.
The benefits of hindsight, and all that...
shap
More information about the bitc-dev
mailing list