Archive for the ‘Uncategorized’ Category

Monotone, etc.

Monotone

saugart
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.

gcjx

I added a new warning that detects when you write extends
Object
, 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.

libffi

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.
Sigh.

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.

gcjx

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
construct.

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
beginning.

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,
libffi-discuss@sources.redhat.com, 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.

Spartan

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
hours.

Major gcjx milestone

gcjx can now parse
and analyze all 2016 files in libgcj. This is a major milestone!

I had already done some work on code generation. I think that is
where I’m going to focus my efforts for a little while, to try to get
the first class file written.

gcjx update

I rewrote model_field to be subclass of
model_variable_decl, to make certain cases of name
resolution work correctly. In particular there were some problems
with local classes in the previous scheme. Well, doing this
predictably broke nearly everything, so I spent today debugging and
now things are more or less back to where they were.

Two steps forward, one step back.