X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fstacktrace.h;h=c2531481c037302adc0296fcf60a1b588fa8991d;hb=b222b26cb9052c27af8005482b8a68161fb33397;hp=7da200f6351fee6b59af82581a77d8c6e8f84532;hpb=299ff6d435b3ea0d5fb4ef8a8f2ace6a05a50d87;p=cacao.git diff --git a/src/vm/jit/stacktrace.h b/src/vm/jit/stacktrace.h index 7da200f63..c2531481c 100644 --- a/src/vm/jit/stacktrace.h +++ b/src/vm/jit/stacktrace.h @@ -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, 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 This file is part of CACAO. @@ -19,16 +19,8 @@ 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. - - Contact: cacao@complang.tuwien.ac.at - - Authors: Christian Thalinger - - Changes: - - $Id: stacktrace.h 2985 2005-07-11 18:55:35Z twisti $ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ @@ -39,30 +31,49 @@ /* 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 "types.h" +#include "vm/types.h" + +#include "md-abi.h" -#include "vm/method.h" +#include "vmcore/class.h" +#include "vmcore/method.h" -/* stackframeinfo *************************************************************/ +/* stackframeinfo ************************************************************** + + ATTENTION: Keep the number of elements of this structure even, to + make sure that the stack keeps aligned (e.g. 16-bytes for x86_64). + +*******************************************************************************/ struct stackframeinfo { - void *oldThreadspecificHeadValue; - void **addressOfThreadspecificHead; - methodinfo *method; /* methodinfo of current function */ - u1 *pv; /* PV of current function */ - u1 *sp; /* SP of parent Java function */ - functionptr ra; /* RA to parent Java function */ - functionptr xpc; /* XPC (for inline stubs) */ - void *padding; /* multiple of 16-byte padding */ + stackframeinfo *prev; /* pointer to prev stackframeinfo */ + methodinfo *method; /* methodinfo of current function */ + u1 *pv; /* PV of current function */ + u1 *sp; /* SP of parent Java function */ + u1 *ra; /* RA to parent Java function */ + u1 *xpc; /* XPC (for inline stubs) */ +#if defined(ENABLE_GC_CACAO) + /* + * The exact GC needs to be able to recover saved registers, so the + * native-stub saves these registers here + */ +# if defined(HAS_ADDRESS_REGISTER_FILE) + ptrint adrregs[ADR_SAV_CNT]; +# else + ptrint intregs[INT_SAV_CNT]; +# endif +#endif }; -struct stacktraceelement { +/* stacktrace_entry ***********************************************************/ + +struct stacktrace_entry { #if SIZEOF_VOID_P == 8 u8 linenumber; #else @@ -72,64 +83,54 @@ struct stacktraceelement { }; -struct stackTraceBuffer { - s4 needsFree; - stacktraceelement *start; - s4 size; - s4 full; -}; +/* stacktracebuffer ***********************************************************/ +#define STACKTRACE_CAPACITY_DEFAULT 80 +#define STACKTRACE_CAPACITY_INCREMENT 80 -/* function prototypes ********************************************************/ +struct stacktracebuffer { + s4 capacity; /* size of the buffer */ + s4 used; /* current entries in the buffer */ + stacktrace_entry entries[80]; /* the actual entries */ +}; -void stacktrace_create_inline_stackframeinfo(stackframeinfo *sfi, u1 *pv, - u1 *sp, functionptr ra, - functionptr xpc); -void stacktrace_create_native_stackframeinfo(stackframeinfo *sfi, u1 *pv, - u1 *sp, functionptr ra); +/* function prototypes ********************************************************/ -void stacktrace_remove_stackframeinfo(stackframeinfo *sfi); +void stacktrace_stackframeinfo_add(stackframeinfo *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc); +void stacktrace_stackframeinfo_remove(stackframeinfo *sfi); -/* exception creating functions */ -java_objectheader *stacktrace_new_arithmeticexception(u1 *pv, u1 *sp, - functionptr ra, - functionptr xpc); -java_objectheader *stacktrace_new_arrayindexoutofboundsexception(u1 *pv, - u1 *sp, - functionptr ra, - functionptr xpc, - s4 index); +stacktracebuffer *stacktrace_create(stackframeinfo *sfi); -java_objectheader *stacktrace_new_arraystoreexception(u1 *pv, u1 *sp, - functionptr ra, - functionptr xpc); +java_handle_bytearray_t *stacktrace_fillInStackTrace(void); -java_objectheader *stacktrace_new_classcastexception(u1 *pv, u1 *sp, - functionptr ra, - functionptr xpc); +#if defined(ENABLE_JAVASE) +java_handle_objectarray_t *stacktrace_getClassContext(void); +classinfo *stacktrace_getCurrentClass(void); +java_handle_objectarray_t *stacktrace_getStack(void); +#endif -java_objectheader *stacktrace_new_negativearraysizeexception(u1 *pv, u1 *sp, - functionptr ra, - functionptr xpc); +void stacktrace_print_trace_from_buffer(stacktracebuffer *stb); +void stacktrace_print_trace(java_handle_t *xptr); -java_objectheader *stacktrace_new_nullpointerexception(u1 *pv, u1 *sp, - functionptr ra, - functionptr xpc); +/* machine dependent functions (code in ARCH_DIR/md.c) */ -java_objectheader *stacktrace_fillInStackTrace(u1 *pv, u1 *sp, functionptr ra, - functionptr xpc); +#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 -void cacao_stacktrace_NormalTrace(void **target); -java_objectarray *cacao_createClassContextArray(void); -java_objectheader *cacao_currentClassLoader(void); -methodinfo* cacao_callingMethod(void); -java_objectarray *cacao_getStackForVMAccessController(void); -void stacktrace_dump_trace(void); +#if defined(ENABLE_INTRP) +u1 *intrp_md_stacktrace_get_returnaddress(u1 *sp, u4 framesize); +#endif -/* machine dependent functions (code in ARCH_DIR/md.c) */ -functionptr md_stacktrace_get_returnaddress(u1 *sp, u4 framesize); +#if defined(ENABLE_CYCLES_STATS) +void stacktrace_print_cycles_stats(FILE *file); +#endif #endif /* _STACKTRACE_H */ @@ -145,4 +146,5 @@ functionptr md_stacktrace_get_returnaddress(u1 *sp, u4 framesize); * c-basic-offset: 4 * tab-width: 4 * End: + * vim:noexpandtab:sw=4:ts=4: */