This is the mail archive of the
mailing list for the GCC project.
Re: [ecj] Patch: remove old .java parser
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 22 Dec 2006 17:40:33 -0700
- Subject: Re: [ecj] Patch: remove old .java parser
- References: <email@example.com>
- Reply-to: tromey at redhat dot com
Tom> I'm going to check this in on the gcj-eclipse-merge-branch.
Tom> Andrew, if you could give it a look over first, that would be helpful.
Tom> This is the first step at removing the old .java parser and other
Tom> now-unused code from gcj. There is still some unused code remaining,
Tom> and a few bits which I simply commented out. I'll have more cleanups
Tom> in future patches.
On irc Andrew asked about how I decided what to remove. It is a fair
question and I do have an answer, albeit a somewhat ugly one.
I started at the obvious starting place: delete every file which ought
to be deletable. So, I removed the parser, the lexer, and
check-init.c (definite assignment is only needed for source analysis).
Then I removed supporting files (keyword, character tables) and random
files which have long been obsolete (buffer.[ch] and convert.h).
Then I started building gcj and seeing what broke. If the code was
related only to parsing source files, I generally removed it. Since
over the years gcj has not been maintained with perfect cleanliness,
sometimes java-source-language-related functions ended up in the wrong
files; there were also a few already dead things lying about.
When I determined either via compilation or later testing that a given
function was wrongly deleted, I resurrected it (eg cxx_keyword_p stuff
in the name mangler).
The only really odd bit here was java_layout_seen_class_methods, which
was in parse.y but which is needed for proper operation of the .class
compiler. You can see all the resurrected functions by searching for
"New function" in the ChangeLog.
At this point I had a working compiler which could build libgcj and
pass all tests. Then I worked my way through parse.h, java-tree.h,
and java-tree.def, deleting every declaration, definition, or macro
which appeared not to be in use by the remaining parts of the
compiler. There were a couple surprises here, since things like
URSHIFT_EXPR turn out to only be referenced via token pasting... yay.
If a deleted macro referred to a field in some structure, I removed
the field as well.
This is by no means a complete patch. However, it is a good start. I
think it removed around 50% of the source lines in gcj.