generic type support

Cedric Berger
Thu Feb 20 09:43:00 GMT 2003

Andrew Haley wrote:

>Cedric Berger writes:
> > Andrew Haley wrote:
> > 
> > >I on't know about that.  I would have thought that there are
> > >tremendous opportunities for optimization with the added type
> > >information.
> > >
> > Hmm, so to generate better machine code from bytecode,
> > gcj should maybee run the bytecode through one of the many
> > good java decompilers around, and compile it from source ;)
>I'm not sure how decompilers would cope with generics.
That is a good question.
However, I'm pretty confident that they will able to cope pretty well.
Generics in java work in "erasure mode" and loose type information when
translated into bytecode *But* at the same time, there is a new
"Signature" classfile attribute to exactly specify generic classes,
methods and fields. So I believe that a decompiler (or gcj compiling
from bytecode) should be able to recover type information from classfile

I'm of course not suggesting that gcj adds another step and use a
decompiler. What I'm saying is that I hear a lot on that list that there
is more optimization  opportunities when compiling from source. I think
it's plain wrong, and that if gcj optimize better from source it is
because of the way GCJ is implemented, and nothing more fundamental.
The fact that decompilers work so well proves that there is little
information lossage between sourcefile and classfile.

More information about the Java mailing list