[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: initialization
From: |
Patrik Reali |
Subject: |
Re: initialization |
Date: |
Wed, 8 May 2002 09:29:27 +0200 |
From: "Brian Jones" <address@hidden>
Subject: initialization
> So I guess the question on my mind is whether any free JVM implements
> the detailed procedure for initialization outlined in 2.17.5 of the
> Java Virtual Machine Specification Second Edition. ORP seems to try
> to preload various classes directly rather than through the normal
> loading of the class with a main() and the preload I think involves
> initialization but I need to check that.
>
> Brian
I can't speak for ORP, but in my experience this is unavoidable.
There are 3 classes which are "anchored" in the language:
Object, String, and Throwable. To make it worse, the transitive
hull of Object contains 299 classes (two dozens of them are arrays).
(measured on classpath 0.03) and a few more are loaded by name.
If the JVM is written in Java or uses the Java API, then it
is unavoidable to load classes needed to bootstrap the JVM.
As an example, the Jaos VM preloads Object, String, System, Runtime,
Thread, ThreadGroup, Throwable. This indirectly causes the
initialization of a few more classes.
The only way for a JVM to avoid preloading classes is to avoid using
the Java API, but this makes no sense, as Java may access some
information like the metadata through the reflection mechanism
and it would be an overkill to maintain the same information twice.
-Patrik