Hi Stuart,

On Mon, 2006-02-13 at 21:37 +0000, Stuart Ballard wrote:
> Another dumb question: Could you just do something like:
> 
> public class Math {
>   static {
>     VMMath.initialize();
>   }
>   ...
> }
> 
> class VMMath {
>   static void initialize() {
>     System.loadLibrary("javalang");
>   }
>   ...
> }
> 
> Or do the timing rules of class initialization make that impossible or
> impractical somehow?

I had thought that would create an bootstrap cycle at that point, but
see my response to Archie, I was wrong. So, yes, you can do that. But we
prefer to do that implicitly through just initializing VMMath on its
first active use. That way the runtime author can decide whether they
need any explicit initialization for their VM runtime class or not. And
it defers loading of native JNI libs in our reference implementation
till those libraries are actually needed.

I am happy the workaround in the static Math initializer to do an
explicit System.loadLibrary() isn't actually needed. It makes things
more clear. But we might want to keep it for a little while to keep
backwards compatible with previous runtime versions that depended on the
explicit loading of "javalang" through Math in the default bootstrap
cycle.

Cheers,

Mark

-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to