From f3f110d5d1a748bf3b8a71c30fb0e786140d82ad Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Tue, 3 Dec 2002 13:50:40 +0000 Subject: [PATCH] natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass. 2002-12-03 Andrew Haley * 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. From-SVN: r59770 --- libjava/java/lang/natVMThrowable.cc | 97 ----------------------------- 1 file changed, 97 deletions(-) delete mode 100644 libjava/java/lang/natVMThrowable.cc diff --git a/libjava/java/lang/natVMThrowable.cc b/libjava/java/lang/natVMThrowable.cc deleted file mode 100644 index c1b030d4288..00000000000 --- a/libjava/java/lang/natVMThrowable.cc +++ /dev/null @@ -1,97 +0,0 @@ -// natVMThrowable.cc - native helper methods for Throwable - -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -/** - * @author Andrew Haley - * @author Mark Wielaard - * - * Native helper methods for VM specific Throwable support. - */ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include - -#ifdef HAVE_EXECINFO_H -#include -#endif - -/* 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. */ - -java::lang::VMThrowable * -java::lang::VMThrowable::fillInStackTrace (java::lang::Throwable*) -{ - if (! trace_enabled) - return NULL; -#if defined (HAVE_BACKTRACE) - VMThrowable* state = new VMThrowable; - void *p[128]; - - // We subtract 1 from the number of elements because we don't want - // to include the calls to fillInStackTrace in the trace. - int n = backtrace (p, 128) - 1; - - _Jv_frame_info *addrs; - if (n > 0) - { -#ifdef INTERPRETER - extern void _Jv_StartOfInterpreter (void); - extern void _Jv_EndOfInterpreter (void); - - java::lang::Thread *thread = java::lang::Thread::currentThread(); - _Jv_MethodChain *interp_frame - = (thread ? reinterpret_cast<_Jv_MethodChain *> (thread->interp_frame) - : NULL); -#endif // INTERPRETER - - state->length = n; - int len = n; - addrs = (_Jv_frame_info *) _Jv_Malloc (n * sizeof (_Jv_frame_info)); - for (n = 0; n < len; n++) - { - addrs[n].addr = p[n]; -#ifdef INTERPRETER - if (p[n] >= &_Jv_StartOfInterpreter && p[n] <= &_Jv_EndOfInterpreter) - { - addrs[n].interp = (void *) interp_frame->self; - interp_frame = interp_frame->next; - } - else - addrs[n].interp = 0; -#endif // INTERPRETER - } - } - else - addrs = NULL; - - state->stackTraceAddrs = reinterpret_cast (addrs); - - return state; -#endif - return NULL; -} -- 2.30.2