* src/vm/jit/alpha/patcher.c (patcher_wrapper): Added return address
[cacao.git] / src / vm / jit / stacktrace.h
index 05d15f370e1aa05aff28b9dd4bfe96f2a4d933c4..31379a964ff9d393f724044b0f7a9a7dda8338fa 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/jit/stacktrace.h - header file for stacktrace generation
 
-   Copyright (C) 1996-2005 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
+   Copyright (C) 1996-2005, 2006 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
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Christian Thalinger
 
    Changes:
 
-   $Id: stacktrace.h 4158 2006-01-12 21:30:55Z twisti $
+   $Id: stacktrace.h 5088 2006-07-08 20:16:05Z twisti $
 
 */
 
@@ -39,8 +39,8 @@
 /* forward typedefs ***********************************************************/
 
 typedef struct stackframeinfo stackframeinfo;
-typedef struct stackTraceBuffer stackTraceBuffer;
-typedef struct stacktraceelement stacktraceelement;
+typedef struct stacktracebuffer stacktracebuffer;
+typedef struct stacktrace_entry stacktrace_entry;
 
 #include "config.h"
 #include "vm/types.h"
@@ -64,8 +64,8 @@ struct stackframeinfo {
        u1             *xpc;                /* XPC (for inline stubs)             */
 };
 
-#if defined(USE_THREADS)
-#define STACKFRAMEINFO    (stackframeinfo **) (&THREADINFO->_stackframeinfo)
+#if defined(ENABLE_THREADS)
+#define STACKFRAMEINFO    (&(THREADOBJECT->_stackframeinfo))
 #else
 extern stackframeinfo *_no_threads_stackframeinfo;
 
@@ -73,7 +73,9 @@ extern stackframeinfo *_no_threads_stackframeinfo;
 #endif
 
 
-struct stacktraceelement {
+/* stacktrace_entry ***********************************************************/
+
+struct stacktrace_entry {
 #if SIZEOF_VOID_P == 8
        u8          linenumber;
 #else
@@ -83,11 +85,15 @@ struct stacktraceelement {
 };
 
 
-struct stackTraceBuffer {
-       s4                 needsFree;
-       stacktraceelement *start;
-       s4                 size;
-       s4                 full;
+/* stacktracebuffer ***********************************************************/
+
+#define STACKTRACE_CAPACITY_DEFAULT      80
+#define STACKTRACE_CAPACITY_INCREMENT    80
+
+struct stacktracebuffer {
+       s4                capacity;         /* size of the buffer                 */
+       s4                used;             /* current entries in the buffer      */
+       stacktrace_entry *entries;          /* the actual entries                 */
 };
 
 
@@ -112,21 +118,39 @@ 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);
+                                                                                                               u1 *xpc,
+                                                                                                               java_objectheader *o);
+#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
+
+/* 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
 
 
 /* hardware exception creating functions */
@@ -136,14 +160,11 @@ java_objectheader *stacktrace_hardware_arithmeticexception(u1 *pv, u1 *sp,
 java_objectheader *stacktrace_hardware_nullpointerexception(u1 *pv, u1 *sp,
                                                                                                                        u1 *ra, u1 *xpc);
 
-/* refill the stacktrace of an existing exception */
-java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
-                                                                                                         u1 *xpc);
 
-bool cacao_stacktrace_NormalTrace(void **target);
-java_objectarray *cacao_createClassContextArray(void);
-java_objectheader *cacao_currentClassLoader(void);
-java_objectarray *cacao_getStackForVMAccessController(void);
+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);
@@ -159,15 +180,8 @@ u1 *md_stacktrace_get_returnaddress(u1 *sp, u4 framesize);
 u1 *intrp_md_stacktrace_get_returnaddress(u1 *sp, u4 framesize);
 #endif
 
-
-#ifdef ENABLE_JVMTI
-typedef bool(*CacaoStackTraceCollector)(void **, stackTraceBuffer*);
-
-bool cacao_stacktrace_fillInStackTrace(void **target,
-                                                                          CacaoStackTraceCollector coll,
-                                                                          threadobject* thread);
-
-bool stackTraceCollector(void **target, stackTraceBuffer *buffer);
+#if defined(ENABLE_CYCLES_STATS)
+void stacktrace_print_cycles_stats(FILE *file);
 #endif
 
 #endif /* _STACKTRACE_H */