* Removed all Id tags.
[cacao.git] / src / vm / jit / stacktrace.h
index 7bf800dc8fe839d397736167dccd812d9cb3c436..a2eddd4c4c4b7d6455e73663ec9af6cff35bd99d 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/stacktrace.h - header file for stacktrace generation
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
    J. Wenninger, Institut f. Computersprachen - TU Wien
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
-   $Id: stacktrace.h 4824 2006-04-24 11:40:05Z edwin $
-
 */
 
 
@@ -45,7 +37,8 @@ typedef struct stacktrace_entry stacktrace_entry;
 #include "config.h"
 #include "vm/types.h"
 
-#include "vm/method.h"
+#include "vmcore/class.h"
+#include "vmcore/method.h"
 
 
 /* stackframeinfo **************************************************************
@@ -64,14 +57,6 @@ struct stackframeinfo {
        u1             *xpc;                /* XPC (for inline stubs)             */
 };
 
-#if defined(USE_THREADS)
-#define STACKFRAMEINFO    (stackframeinfo **) (&THREADINFO->_stackframeinfo)
-#else
-extern stackframeinfo *_no_threads_stackframeinfo;
-
-#define STACKFRAMEINFO    (&_no_threads_stackframeinfo)
-#endif
-
 
 /* stacktrace_entry ***********************************************************/
 
@@ -97,6 +82,20 @@ struct stacktracebuffer {
 };
 
 
+/* stacktracecontainer ********************************************************
+
+   ATTENTION: Use the stacktracecontainer to place a stacktrace onto the heap
+   with stacktrace_fillInStackTrace() so that the GC does not get confused.
+
+*******************************************************************************/
+
+typedef struct stacktracecontainer {
+       java_array_t            header;     /* default array header for the GC    */
+       struct stacktracebuffer stb;        /* let entries point to data below    */
+       stacktrace_entry        data[1];    /* the actual array of entries        */
+} stacktracecontainer;
+
+
 /* function prototypes ********************************************************/
 
 #if defined(ENABLE_INTRP)
@@ -104,9 +103,6 @@ void stacktrace_create_stackframeinfo(stackframeinfo *sfi, u1 *pv, u1 *sp,
                                                                          u1 *ra);
 #endif
 
-void stacktrace_create_inline_stackframeinfo(stackframeinfo *sfi, u1 *pv,
-                                                                                        u1 *sp, u1 *ra, u1 *xpc);
-
 void stacktrace_create_extern_stackframeinfo(stackframeinfo *sfi, u1 *pv,
                                                                                         u1 *sp, u1 *ra, u1 *xpc);
 
@@ -115,64 +111,28 @@ void stacktrace_create_native_stackframeinfo(stackframeinfo *sfi, u1 *pv,
 
 void stacktrace_remove_stackframeinfo(stackframeinfo *sfi);
 
-/* inline exception creating functions */
-java_objectheader *stacktrace_inline_arithmeticexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                                u1 *xpc);
-#define STACKTRACE_inline_arithmeticexception \
-    (functionptr) stacktrace_inline_arithmeticexception
-                                                                                               
-
-java_objectheader *stacktrace_inline_arrayindexoutofboundsexception(u1 *pv,
-                                                                                                                                       u1 *sp,
-                                                                                                                                       u1 *ra,
-                                                                                                                                       u1 *xpc,
-                                                                                                                                       s4 index);
-#define STACKTRACE_inline_arrayindexoutofboundsexception \
-    (functionptr) stacktrace_inline_arrayindexoutofboundsexception
-
-java_objectheader *stacktrace_inline_arraystoreexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                                u1 *xpc);
-#define STACKTRACE_inline_arraystoreexception \
-    (functionptr) stacktrace_inline_arraystoreexception
-
-java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                               u1 *xpc);
-#define STACKTRACE_inline_classcastexception \
-    (functionptr) stacktrace_inline_classcastexception
 
-java_objectheader *stacktrace_inline_nullpointerexception(u1 *pv, u1 *sp,
-                                                                                                                 u1 *ra, u1 *xpc);
-#define STACKTRACE_inline_nullpointerexception \
-    (functionptr) stacktrace_inline_nullpointerexception
+stacktracebuffer *stacktrace_create(stackframeinfo *sfi);
 
-/* refill the stacktrace of an existing exception */
-java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                         u1 *xpc);
-#define STACKTRACE_inline_fillInStackTrace \
-    (functionptr) stacktrace_inline_fillInStackTrace
+stacktracecontainer *stacktrace_fillInStackTrace(void);
 
+#if defined(ENABLE_JAVASE)
+java_handle_objectarray_t *stacktrace_getClassContext(void);
+classinfo                 *stacktrace_getCurrentClass(void);
+java_handle_objectarray_t *stacktrace_getStack(void);
+#endif
 
-/* hardware exception creating functions */
-java_objectheader *stacktrace_hardware_arithmeticexception(u1 *pv, u1 *sp,
-                                                                                                                  u1 *ra, u1 *xpc);
-
-java_objectheader *stacktrace_hardware_nullpointerexception(u1 *pv, u1 *sp,
-                                                                                                                       u1 *ra, u1 *xpc);
-
-
-stacktracebuffer  *stacktrace_fillInStackTrace(void);
-java_objectarray  *stacktrace_getClassContext(void);
-classinfo         *stacktrace_getCurrentClass(void);
-java_objectarray  *stacktrace_getStack(void);
-
-void stacktrace_dump_trace(void);
-void stacktrace_print_trace(java_objectheader *xptr);
-
+void stacktrace_print_trace_from_buffer(stacktracebuffer *stb);
+void stacktrace_print_trace(java_handle_t *xptr);
 
 /* machine dependent functions (code in ARCH_DIR/md.c) */
 
 #if defined(ENABLE_JIT)
 u1 *md_stacktrace_get_returnaddress(u1 *sp, u4 framesize);
+# if defined(__SPARC_64__)
+u1 *md_get_framepointer(u1 *sp);
+u1 *md_get_pv_from_stackframe(u1 *sp);
+# endif
 #endif
 
 #if defined(ENABLE_INTRP)