I wrote a pretty good piece of definite assignment, and gcjx is
down to around 400 Jacks failures. There is some tricky code in
Jacks, here’s my current favorite example:
void foo() { final int v; new T165a3(v = 1) { int i = v; }; }
What’s tricky about this is that a compiler has to insert a dummy
parameter to the anonymous class constructor to capture the final
variable (unless the compiler is smart enough to see that this value
is already being passed in — which few are). If the compiler
inserts this variable at the start of the argument list, it will
generate invalid code.
gcjx was mentioned on
the gcc list this week. Of course, this happened in the context
of a C++ language flame war. Perhaps, as Ranjit
suggests, it will be harder to get gcjx into gcc than I previously
thought.
I’m still hopeful. I’m about ready to switch away from
Jacks-related hacking and back to other things. First will be a small
reorganization, then some class file reading fixes, and finally back
to work on lowering to gcc trees. Once tree lowering works, I think
I’ll move the source onto a branch in the gcc repository.
C++
So, why C++ for gcjx? Basically, I didn’t think the other gcc
maintainers would accept Java. Plus, using Java would mean a pretty
uncomfortable bootstrap — something that will be difficult enough
using C++ (since we’ll have to build libstdc++ and then go back and
build gcj).
There were a lot of arguments in the gcc thread about the various
problems with C++. Everybody has their own list of features they
hate. MI seems universally disliked, along with operator overloading,
but some folks were against templates, exceptions, and Dewar even
apparently dislikes virtual functions. gcjx uses all these features,
but purposely avoids something no one mentioned, namely statically
initialized objects.
As was pointed out several times, accepting C++ doesn’t mean
accepting the worst kind of spaghetti code that can be written in C++.
Egregious misuses, obscure operator overloading, etc, can be simply
rejected, and probably would be, just as we reject bogus C
constructs.
I like to think I made tasteful use of all these things in gcjx,
but I suppose I’ll get a different opinion at merge time.
Bill Gates
As said on slashdot, Bill Gates thinks that open source kills
jobs. It is sad to see capitalists not understand their own system.
In capitalism, Bill, if a product can be made efficiently by some
other means, old modes of production will simply die. The theory says
that this is painful for those displaced but good overall since it
frees people to work on other things. I don’t always agree that this
is the proper set of tradeoffs for us to make as a society, but then
I’m not a famous capitalist either.
Be the first to leave a comment. Don’t be shy.