Archive for March, 2004

gcjx, politics, Tutu, Maude

gcjx update

This weekend saw many minor improvements: a round of “fixme”
removal, some internal cleanups I’d meant to do (e.g., caching the
constant-ness of an expression). I also wrote a couple nice warnings
(unused import and use of a static member in a non-static
context), plus I wrote folding code for constant expressions.

So contrary to my plan I ended up just doing general improvements
instead of working on generics.


I’ve been following the Richard Clarke story with great interest.
I saw him on Charlie Rose and also I got up Sunday to watch Meet the
Press to see what he had to say. I think he comes off as basically
credible, perhaps at times a bit pompous in delivery. And
occasionally I wish he took a stronger stance, for instance being more
forthright that one reason to write a book is to make money. Why not
admit that? I don’t think it would expose any real conflict of
interest; one can tell the truth and make money. Usually :-)


Last night we saw Desmond Tutu give a speech at the local
basketball stadium. He’s an engaging speaker, quite good at it
really. It was a bit annoying, though, since he talks in terms that I
generally don’t agree with; for instance the idea that some people are
“good” and that we can tell the difference between “good” and “evil”
was a main theme of his talk. Likewise that this is God’s world and
that the evil will “bite the dust ignominiously” — nearly an exact

The simple dualisms and commandments to be “good” seem simplistic
to me. And after reading The Embodied Mind I constantly come back to
the idea that the core of both materialism and dualism is a kind of
alienation or nihilism. Of course Tutu doesn’t let it go there, but
you can see its thumb print all over contemporary culture.

A statement I’m sure we could also find in Ovid or Catullus, if we
were to look. Sub sole nihil…

Anyway I ended up translating his speech internally into my own
terms, which I suppose is a way of destroying it. But his energy was
very positive — motivational and inspiring. And he did say some
things I agreed with, even philosophically.


My dog Maude (who is kind of stealthily famous, if that isn’t an
outright contradiction) got in a fight the other day. She got bit and
had to have some surgery. Right now she has some tubes sticking out
of her to let the wounds drain. “Frankendog” is the term that fits
best, she has a pretty disturbing appearance.

gcj stuff

GCC 3.4 is coming out soon. I think this will, unfortunately, be
the worst gcj release in quite a while. Basically no one worked on
looking at bugs, and it turns out there are some dumb ones in there –
but now it is too late in the release cycle to fix them.

More generally nobody is working on fixing gcj bugs, and gcj is
really in pretty bad shape. Bugzilla doesn’t tell the whole story
here, since nobody has had the time or the heart to file all the Jacks
failures as bugs.

Today I’m depressed about it, probably leakage from other parts
of my life and the fact that I didn’t really sleep last night. I’m
sure tomorrow it won’t affect me quite as much.


McNealy says
that Sun won’t open source their Java implementation. No surprise
there — did anyone really expect them to?

Equally dumb is his comment “We’re trying to understand what
problem does it solve that is not already solved”. How about letting
people fix bugs that affect them? How about letting people port to
new platforms? Both of these have come up for me in the last year.
How about growing a community to drive the technology forward faster?
How about sharing development costs among all Java stakeholders,
instead of footing the whole bill yourself?

These reasons and more are why we work to build free systems.

libgcj future

Various Classpath hackers have been pushing the idea of unifying
Classpath even further, perhaps to the point of doing Classpath
releases and having VMs use it unmodified. This is pretty
interesting, I think.

The logical next step is to just erase the different VMs and
decide on a single one. We could put it directly into Classpath.
The fact is, at least for C-based Unix-y VMs, there really isn’t much
difference outside the execution engines. These we could comfortably
leave separate, perhaps following the pluggable JIT talks at FOSDEM.

As Mark points out, libgcj remains the problem child in these
discussions, stubbornly sticking to, as he puts it,
micro-optimizations we’re proud of. In most cases this isn’t far off
the mark.

Lately I’ve been wondering a bit if we should just treat the
standard library like we plan to treat any other Java application.
That is, make the precompiled runtime the bare minimum to bootstrap,
then load the standard library using our binary-compatible shared
library cache.

This has several advantages. First, we could work with a standard
Classpath, at least if we resolved a few issues (placement of native
methods in some cases). Some classes we still couldn’t, or wouldn’t
want to, merge, but that is no big deal — these would just be loaded
by the bootstrap loader and the Classpath versions would be

This would let us debug more easily, since we could just point gij
at Classpath. We could even completely decouple libgcj from gcc,
which I’m sure would make many gcc maintainers happy.

Don’t get your hopes up on this actually happening. I’m just

Monotone, etc.


mentions monotone in his Planet Classpath
entry. One thing we’ve been wanting to do here is use monotone to
help with libgcj/classpath merges. The idea is to reduce the cost of
these merges and make it much easier for us to share work across the
different projects and branches. Monotone isn’t quite there yet, but
it will be.


I added a new warning that detects when you write extends
, which is simply redundant. It turns out this happens
in a couple of places in Classpath. I really have to send in my
warning removal patch…

I’ve also been looking at really starting work on generics. I
think that’s what I want to hack on next.


I posted a note to libffi-discuss (see the libffi page for a
pointer to the list) about the possibility of putting it on its own
release schedule. Please join the discussion if you have an interest
in libffi.

Triplets of Belleville

It was very strange to see this in a theater, since it isn’t the
sort of movie I would expect to get a wide theatrical release.
Anyway, it is a fun and quirky adventure comic. I enjoyed it quite a
bit, especially the horsey noises made by the bikers.

gcjx "progress"

More gcjx progress. I added a little more access checking code
(still not complete yet), and now gcjx will successfully not
compile libgcj. gcj has an access protection bug that lets through
invalid code, and such code has snuck through a couple of times.

Free Java and Else

Free Java

Today I sent a non-open letter to Bob Sutor, the IBM guy raising
all the fuss with Sun about making Java free. I figured, why couldn’t
IBM work with the already existing free world, in addition to talking
to Sun? I’ll post if I get an interesting response.


This weekend, gcjx
generated its first 33 .class files. The generated code for Object is
basically correct (it has a minor pessimization which is actually
caused by a semantic analysis bug). Another milestone down.

Language stuff

graydon writes: “the high level free software platform in 2004 is
C++ and python”.

I think this pair misses some fundamental features of Java and C#.
First, C++ is just much more complicated than these languages, and in
my opinion much of this complexity is unwarranted. It doesn’t provide
enough benefit for the cost it imposes. Second, just because one can
write safe C++ isn’t the key point — the point is that Java is safe
by default. C++ does give you more tools than C to make your programs
less buggy, but as I see it Java eliminates certain classes of bugs
entirely. This comes at a price, but I find in practice I don’t mind
paying it.

As for Python, personally I prefer static type checking. As far
as I know, Python doesn’t have this.

One other nice thing about Java that is often overlooked is that
the tight integration of the language and the libraries. This idea
is really contrary to C and C++ design principles; I’ve seen C
hackers complain about this any number of times. However, it does
give you nice things like the new enhanced for

It’s mostly gas, though. I don’t want to come off as a rabid
Java proponent, since I’m not that. I do like writing programs in
it. But, on the other hand, gcjx is written in C++, and the writing
does go reasonably well. I find I’m confused from time to time;
there have been occasions where I can’t tell what g++ is trying to
tell me, or more embarrassingly, occasions when I can’t tell whether
a bug is in my code or in the compiler. These are just minor
problems in the overall scheme of things.

One actual problem is compilation time. It takes unbelieveable
resources to compile gcjx, which by any sane measure is a small
program. I realize that use of STL implies a cost, and that STL isn’t
“small”, but in my opinion the current cost is simply much too high
for using the standard container classes. I tend to see this, perhaps
unfairly, as a result of semantic choices made by C++, e.g.,
instantiating templates based on concrete types. Java uses
constraints here instead, which are less powerful but simpler to
check. It’s hard to make a fair comparison, though, since one uses
different styles when writing in the different languages.

This brings up an interesting aside, which is that C++ led the way
into generic programming. Now Java and C# are both adding generics.
In Java, unfortunately, this complicate the language in some strange
ways. The addition of generics necessitated the addition of covariant
returns, introduced some deprecated-at-introduction features (a bad
sign, ugh), and turned the already complicated method name lookup
algorithm into a 2-stage process which is yet to be fully documented
in public form (this process may only be a requirement due to
auto-boxing, but this feature was added only due to generics not
including primitive types…). To me this suggests that the next OO
programming language should have generics designed in at the

Progress on many fronts

Everyone has read and is talking about Havoc’s article.
It’s great to see this debate taking place.

Of course, I’m in the “let’s use gcj camp”. I think gcj is an
excellent solution to these sorts of problems. For instance, in
general I think JIT approaches are over-rated, most applications are
mostly static and can benefit from precompilation. Second, with the
gcj changes currently in progress, we’ll be more than partly erasing
this distinction.

Some of the debate centers around language issues: “is C# better
than Java?”. Personally I think Java is just fine. It isn’t my ideal
language (I doubt C# would be either); but it is more than acceptable
for the problem space. That’s hardly a ringing endorsement, but then
I’m very skeptical when I hear assertions — concerning productivity
or other things — about any programming language.

As I see it, we already know we need a Free Java implementation.
There is already a lot of actually existing free Java code that is
useful, and more importantly actually used. So the community already
has to expend effort here. There are also a lot of nice Java tools
out there; Eclipse being one of the flagship products. It seems
wasteful to me to try to reproduce this environment for another
similar-but-different runtime and language.

There are the other legal arguments about patents and openness and
such. I tend to discount these. I mean, it is important that if MS
has a patent covering .NET, that we-as-community actually have strong
reasons to believe it won’t affect us. But it seems to me that any
patent in, say, the JIT space could affect the JVM and .NET equally.

Sun’s process is a bit closed, it is true. But Sun has been
slowly coming along, and I think as Free Java gains momentum they will
come around to deal with us. They’ll have to, and the results will be
to everybody’s benefit. There’s been a lot of rumbling about this
from IBM lately; I’m sure we’ll see more progress here.

More prosaically, gcjx is nearing code generation. If I find time
this weekend it will generate its first .class file by
Monday. There is still a huge amount to do; if you’ve ever wanted to
hack a compiler front end, or learn about gcc trees, let me know.

Also, some of us are gathering on the libffi list,, to talk about doing libffi releases
on a separate schedule from GCC releases. It turns out that there
actually are libffi users other than libgcj, and that they actually
want a say in what goes on. That’s great news.

Not quite code generation

This weekend I made the bytecode generation parts of gcjx
actually compile. There are still crashing bugs in this code, and
parts are missing, so even if it didn’t crash you still wouldn’t see
.class files.

Work here has pointed out how I cut corners to get to this point,
so I’m having to go back and fill in missing things. From the outside
this can look weird, e.g., tonight I made new actually
find the constructor it is going to invoke, something which appears
pretty basic. It isn’t really a big deal, though, just a consequence
of the approach I’ve taken to development.

For this particular project I chose a style of total freedom in
terms of ordering. So, I just do whatever I’m interested in at a
given moment. I don’t worry much about getting everything perfect;
instead, I just litter the code with “fixme” comments.

This means there will be more work later on, cleaning up the final
bits, making sure all the appropriate error messages are emitted, etc.
I’m not too concerned about this, since there is already the excellent
Jacks test suite to back me up. Plus, this way is more fun as it lets
me get to various milestones more quickly. In practice I seem to be
alternating periods of pure development, where things don’t even
compile, periods of polishing to get things building again, and
periods of fixing bugs. You can see this reflected in the ChangeLog
by looking at the average paragraph lengths.

This approach probably wouldn’t scale. That doesn’t seem to be a
big deal as I’m the only person hacking gcjx at the moment. I wonder
how real it has to be before I look for help.

Speaking of which, I sent a feeler to Eric Blake about the idea of
using Jikes as the gcj front end. I think this would be excellent
because Jikes is already complete, and it would let us merge efforts
– the Free Java world is really too small for us to split our labor
across multiple compilers. Unfortunately I can’t answer the question
“what’s in it for Jikes?”. I assume that that consideration, plus
legal barriers, make this impossible. That’s why I started gcjx back
in December. But truthfully I still hope we can find an agreement.

Swimming Pool

This was an interesting movie, enjoyable, but not what I was
expecting. I was expecting something darker, I’m glad it didn’t live
up to the reports I had heard. On the other hand I was also expecting
something a little more engaging as well. It does have its moments,
though, and I found it pretty funny in a couple of places. The ending
didn’t make me angry in the way that movies that end this way
typically do, so that’s success of a sort.


With David Mamet you certainly know what you’re getting: usually
a well-crafted story with interesting but weirdly-delivered dialog
and several plot twists. Spartan doesn’t disappoint.

In the movie, Val Kilmer plays a Marine, the sort of guy who is
single-mindedly focused on his mission. He explains that he is a
shooter, that he isn’t a thinker and never wanted to be. Then of
course he is forced into an existential crisis where he can no longer
abdicate his privilege to choose.

This is the sort of thing authors must write into movies. I see
it in allegorical terms, you need to take some shortcuts with reality
both to provide action and to fit your film into the allotted two