classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Query on stacktrace management logic


From: Patrik Reali
Subject: Re: Query on stacktrace management logic
Date: Sat, 13 Mar 2004 10:13:41 +0100



--On Sonntag, 7. März 2004 16:02 +0100 Chris Gray <address@hidden> wrote:
On Thursday 04 March 2004 09:01, Jeroen Frijters wrote:
David Holmes wrote:
> class Class is the first class that must be initialized [...]

Given the wide variety of VMs that use Classpath, I'd be careful with
statements like these. For almost every such assumption there will be a
VM for which it isn't true.

Amen.  Wonka [doesn't use Classbath [yet], but] currently loads five
other  classes before java.lang.Class; java.lang.Object,
java.lang.Cloneable,  java.lang.Serializable, java.lang.Throwable, and
the mysterious "array" class.


You don't need java.lang.String from the beginning?

Jaos is more exigent:
* java.lang.Object
* java.lang.String (also initialized)
* java.lang.RuntimeException
* java.lang.NullPointerException
* java.lang.ClassCastException
* java.lang.ArrayOutOfBoundariesException
* java.lang.OutOfMemoryException
* java.io.IOException
* java.lang.AbstractMethodException
* java.lang.Throwable (also initialized)
* java.lang.StackTraceElement (also initialized)
* java.lang.VMThrowable (also initialized)
* java.lang.Thread (also initialized)
* java.lang.ThreadGroup (also initialized)
* java.lang.System (also initialized)

And obviously, many other follow implicitly when a class is initialized.

You may ask why so many classes? Well, there are mainly two reasons. First, I try to use as much java code as possible (I'm lazy), thus parts of the JVM rely on the code in the libraries. A beautiful example are threads, which rely on the Runnable interface: during the first implementation of Jaos, the Oberon language didn't have interfaces, thus the threads where started by invoking the Java code in java.lang.Thread; only later I did integrate Jaos interface support in the Oberon Kernel and added them to the language :-) . Of course, some functions must be duplicated for bootstrap purposes, because they are needed before they become available.

Second, the exceptions are handled by Oberon's exception handler, which is not able to load classes. All Exceptions that are generated by the compiler or the CPU as interrupts must be already available in Throwable. And obviously Throwable, StackTraceElement, and VMThrowable.


-Patrik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]