Very slow compiler?

Per Bothner per@bothner.com
Mon Sep 25 16:46:00 GMT 2000


Alexandre Petit-Bianco <apbianco@cygnus.com> writes:

> This seems about right. Gcj won't load a class unless it has to or
> unless it's seriously confused. 150+ sounds to be right for the core
> libraries. Compiling a random awt file, for examples, triggers the
> resolution of 300+ types.

That seems high.  When compiling Foo.java, you need to load all the
classes that are named in Foo.java.  However, you should not load the
classes that are indirectly referenced.  I.e. if Foo.java declares a
variable of type Bar, then you need to load Bar.  However, you should
not load classes that are referenced in Bar, except when needed for
type-checking.  I.e. if Foo references a field Bar.x that has type
Baz, you may need to load Baz.  (But not always!  E.g. if Bar.x is
passed to a method that takes a Baz argument, then there is no need
to load Baz, unless Baz is mentioned by name in Foo.)
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


More information about the Java mailing list