FAQ update

Per Bothner per@bothner.com
Wed Nov 3 23:57:00 GMT 1999


Bradley Schatz <bradley.schatz@netali.com> writes:
> The GCJ compiler will compile both java source
> and bytecode .class files. For the moment support for
> compiling bytecodes is the better option of
> the two, with the source code compiler lacking support for
> inner classes

"Better" is incorrect. If you need inner classes, you need to
compile bytecodes, but if you don't compiling from sources is
better, as described below.
> ( which are used heavily in JDK 1.1).

"JDK 1.1" is a competing product. What is used *in* JDK 1.1
is of no relevance. What you presumably menat to write was
something like "which are used in many programs written for JDK 1.1"
> It is of interest to note that in many cases
> the native code produced by compiling from source is better
> optimised than that compiled from .class
> files.
>> Has anyone anything to add here as to an
> explanation?

The reason is that when you compile to bytecode you lose a lot of
information about program structure etc. That information helps
in generating better code. We can in theory recover the information
we need by analysing the structure of the bytecodes, but it is
sometimes difficult - or sometimes it just that no-one has gotten
around to it.
Specific examples include loop structure (gcc generates better code
with explicit loops rather than with the equivalent spaghetti code),
array initializers, and the JDK 1.1 `CLASS.class' syntax, all of which
are represented using more low-level constructs in bytecode.
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/~per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /