natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass.
2002-12-03 Andrew Haley <aph@redhat.com> * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass. (_Jv_InitNewClassFields): Set protectionDomain and chain = NULL. (_Jv_PopClass): New. (_Jv_PushClass): New. * java/lang/natClass.cc (forName (jstring)): Use a StackTrace to discover the ClassLoader of our caller. (_Jv_CheckArrayStore): Don't check that a class is assignment compatible with Object. * java/lang/natVMTHrowable.cc: Delete. * gnu/gcj/runtime/StackTrace.java: New, partly copied from java.lang.VMThrowable. (StackTrace(), StackTrace(int)): New constructors. (classAt, methodAt, update, methodAtAddress): New methods. (map): New field. * java/lang/VMThrowable.java: Use StackTrace instead of natVMTHrowable. * java/lang/Class.h (getClassLoaderInternal): New. (class Class): Be friendly with _Jv_PopClass and _Jv_PushClass. Be friendly with gnu::gcj::runtime::StackTrace. (Object.chain): New field. * include/java-interp.h (class _Jv_InterpMethod): Be friendly with gnu::gcj::runtime::StackTrace. * prims.cc (_Jv_NewObjectArray): Use getClassLoaderInternal() instead of getClassLoader(). * verify.cc (class _Jv_BytecodeVerifier): Likewise. java::lang::VMThrowable. * Makefile.am (core_java_source_files): Add MethodRef.java, StackTrace.java. (nat_source_files): Remove natVMThrowable.cc; add natStackTrace.cc. * Makefile.in: Rebuild. 2002-12-03 Andrew Haley <aph@redhat.com> * class.c (make_class_data): New field, "chain". * decl.c (java_init_decl_processing): Likewise. From-SVN: r59769
This commit is contained in:
parent
ee7ecb2924
commit
421f9e6091
12 changed files with 131 additions and 39 deletions
|
@ -38,9 +38,10 @@ exception statement from your version. */
|
|||
package java.lang;
|
||||
|
||||
import gnu.gcj.runtime.NameFinder;
|
||||
import gnu.gcj.runtime.StackTrace;
|
||||
|
||||
/**
|
||||
* VM dependant state and support methods Throwabele.
|
||||
* VM dependent state and support methods Throwable.
|
||||
* It is deliberately package local and final and should only be accessed
|
||||
* by the Throwable class.
|
||||
* <p>
|
||||
|
@ -50,8 +51,7 @@ import gnu.gcj.runtime.NameFinder;
|
|||
*/
|
||||
final class VMThrowable
|
||||
{
|
||||
private gnu.gcj.RawData stackTraceAddrs;
|
||||
private int length;
|
||||
private gnu.gcj.runtime.StackTrace trace;
|
||||
|
||||
/**
|
||||
* Private contructor, create VMThrowables with fillInStackTrace();
|
||||
|
@ -67,7 +67,20 @@ final class VMThrowable
|
|||
* @return a new VMThrowable containing the current execution stack trace.
|
||||
* @see Throwable#fillInStackTrace()
|
||||
*/
|
||||
static native VMThrowable fillInStackTrace(Throwable t);
|
||||
static VMThrowable fillInStackTrace(Throwable t)
|
||||
{
|
||||
VMThrowable state = null;
|
||||
|
||||
/* FIXME: size of the stack trace is limited to 128 elements.
|
||||
It's undoubtedly sensible to limit the stack trace, but 128 is
|
||||
rather arbitrary. It may be better to configure this. */
|
||||
if (trace_enabled)
|
||||
{
|
||||
state = new VMThrowable ();
|
||||
state.trace = new gnu.gcj.runtime.StackTrace(128);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an <code>StackTraceElement</code> array based on the execution
|
||||
|
@ -80,10 +93,11 @@ final class VMThrowable
|
|||
StackTraceElement[] getStackTrace(Throwable t)
|
||||
{
|
||||
StackTraceElement[] result;
|
||||
if (stackTraceAddrs != null)
|
||||
if (trace != null)
|
||||
{
|
||||
NameFinder nameFinder = new NameFinder();
|
||||
result = nameFinder.lookup(t, stackTraceAddrs, length);
|
||||
result = nameFinder.lookup(t, trace.stackTraceAddrs(),
|
||||
trace.length());
|
||||
nameFinder.close();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue