Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stacktrace.h 7413 2007-02-27 21:51:17Z twisti $
-
*/
/* forward typedefs ***********************************************************/
-typedef struct stackframeinfo stackframeinfo;
-typedef struct stacktracebuffer stacktracebuffer;
-typedef struct stacktrace_entry stacktrace_entry;
+typedef struct stackframeinfo_t stackframeinfo_t;
+typedef struct stacktrace_entry_t stacktrace_entry_t;
+typedef struct stacktrace_t stacktrace_t;
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#else
-# include "threads/none/threads.h"
-#endif
+#include "md-abi.h"
+
+#include "vm/global.h"
+
+#include "vm/jit/code.h"
#include "vmcore/class.h"
-#include "vmcore/method.h"
/* stackframeinfo **************************************************************
*******************************************************************************/
-struct stackframeinfo {
- 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) */
-};
-
-
-/* stacktrace_entry ***********************************************************/
-
-struct stacktrace_entry {
-#if SIZEOF_VOID_P == 8
- u8 linenumber;
-#else
- u4 linenumber;
+struct stackframeinfo_t {
+ stackframeinfo_t *prev; /* pointer to prev stackframeinfo */
+ codeinfo *code; /* codeinfo of current method */
+ 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)
+ uintptr_t adrregs[ADR_SAV_CNT];
+# else
+ uintptr_t intregs[INT_SAV_CNT];
+# endif
#endif
- methodinfo *method;
};
-/* stacktracebuffer ***********************************************************/
+/* stacktrace_entry_t *********************************************************/
-#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 */
+struct stacktrace_entry_t {
+ codeinfo *code; /* codeinfo pointer of this method */
+ void *pc; /* PC in this method */
};
-/* stacktracecontainer ********************************************************
-
- ATTENTION: Use the stacktracecontainer to place a stacktrace onto the heap
- with stacktrace_fillInStackTrace() so that the GC does not get confused.
+/* stacktrace_t ***************************************************************/
-*******************************************************************************/
-
-typedef struct stacktracecontainer {
- java_arrayheader 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;
+struct stacktrace_t {
+ int32_t length; /* length of the entries array */
+ stacktrace_entry_t entries[1]; /* stacktrace entries */
+};
/* function prototypes ********************************************************/
-#if defined(ENABLE_INTRP)
-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);
-
-void stacktrace_create_native_stackframeinfo(stackframeinfo *sfi, u1 *pv,
- u1 *sp, u1 *ra);
-
-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
+void stacktrace_stackframeinfo_add(stackframeinfo_t *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc);
+void stacktrace_stackframeinfo_remove(stackframeinfo_t *sfi);
-java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
- 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 */
-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);
-
-
-stacktracecontainer *stacktrace_fillInStackTrace(void);
+java_handle_bytearray_t *stacktrace_get(void);
#if defined(ENABLE_JAVASE)
-java_objectarray *stacktrace_getClassContext(void);
-classinfo *stacktrace_getCurrentClass(void);
-java_objectarray *stacktrace_getStack(void);
+classloader *stacktrace_first_nonnull_classloader(void);
+java_handle_objectarray_t *stacktrace_getClassContext(void);
+classinfo *stacktrace_get_current_class(void);
+java_handle_objectarray_t *stacktrace_get_stack(void);
#endif
-void stacktrace_dump_trace(threadobject *thread);
-void stacktrace_print_trace(java_objectheader *xptr);
-
+void stacktrace_print(stacktrace_t *st);
+void stacktrace_print_exception(java_handle_t *h);
/* 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);
* c-basic-offset: 4
* tab-width: 4
* End:
+ * vim:noexpandtab:sw=4:ts=4:
*/