stackframeinfo_t.
* src/mm/cacao-gc/gc.c,
src/native/jvmti/jvmti.c,
src/threads/native/threads.h,
src/threads/threads-common.c,
src/vm/exceptions.c,
src/vm/jit/alpha/codegen.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/codegen-common.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/jit.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/m68k/patcher.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/replace.c,
src/vm/jit/replace.h,
src/vm/jit/s390/codegen.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/sparc64/patcher.c,
src/vm/jit/stacktrace.c,
src/vm/jit/x86_64/codegen.c,
src/vm/signal.c: Likewise.
rootset_t *rs;
s4 dumpsize;
#if !defined(NDEBUG)
- stackframeinfo *sfi;
+ stackframeinfo_t *sfi;
stacktracebuffer *stb;
#endif
#if defined(ENABLE_RT_TIMING)
/* src/native/jvmti/jvmti.c - implementation of the Java Virtual Machine
Tool Interface functions
- 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
-
- Author: Martin Platter
-
- Changes: Edwin Steiner
- Samuel Vinson
- Christan Thalinger
-
*/
GetFrameLocation (jvmtiEnv * env, jthread thread, jint depth,
jmethodID * method_ptr, jlocation * location_ptr)
{
- stackframeinfo *sfi;
+ stackframeinfo_t *sfi;
int i;
threadobject* th;
u1 *pc; /* current PC (used for profiling) */
java_object_t *_exceptionptr; /* current exception */
- stackframeinfo *_stackframeinfo; /* current native stackframeinfo */
+ stackframeinfo_t *_stackframeinfo; /* current native stackframeinfo */
localref_table *_localref_table; /* JNI local references */
#if defined(ENABLE_INTRP)
void threads_thread_print_stacktrace(threadobject *thread)
{
- stackframeinfo *sfi;
+ stackframeinfo_t *sfi;
stacktracebuffer *stb;
s4 dumpsize;
java_object_t *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra)
{
- stackframeinfo sfi;
- java_handle_t *e;
- java_object_t *o;
+ stackframeinfo_t sfi;
+ java_handle_t *e;
+ java_object_t *o;
/* Fill and add a stackframeinfo (XPC is equal to RA). */
#if defined(ENABLE_JIT)
u1 *exceptions_handle_exception(java_object_t *xptro, u1 *xpc, u1 *pv, u1 *sp)
{
- stackframeinfo sfi;
+ stackframeinfo_t sfi;
java_handle_t *xptr;
methodinfo *m;
codeinfo *code;
cd->stackframesize =
1 + /* return address */
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
1 + /* methodinfo for call trace */
md->paramcount +
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
- disp = cd->stackframesize * 8 - SIZEOF_VOID_P - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - SIZEOF_VOID_P - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_AST(abi_registers_integer_saved[i], REG_SP, disp + i * 8);
/* Restore callee saved integer registers from stackframeinfo (GC
might have modified them during a collection). */
- disp = cd->stackframesize * 8 - SIZEOF_VOID_P - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - SIZEOF_VOID_P - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 8);
cd->stackframesize =
4 + /* return address */
- sizeof(stackframeinfo) + /* stackframeinfo */
+ sizeof(stackframeinfo_t) + /* stackframeinfo */
sizeof(localref_table) + /* localref_table */
nmd->memuse * 4; /* stack arguments */
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
- disp = cd->stackframesize - SIZEOF_VOID_P - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize - SIZEOF_VOID_P - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_STR_INTERN(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
/* restore callee saved int registers from stackframeinfo (GC might have */
/* modified them during a collection). */
- disp = cd->stackframesize - SIZEOF_VOID_P - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize - SIZEOF_VOID_P - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_LDR_INTERN(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
java_handle_t *codegen_start_native_call(u1 *sp, u1 *pv)
{
- stackframeinfo *sfi;
- localref_table *lrt;
- methodinfo *m;
- int32_t framesize;
+ stackframeinfo_t *sfi;
+ localref_table *lrt;
+ methodinfo *m;
+ int32_t framesize;
uint8_t *datasp;
uint8_t *javasp;
framesize = *((int32_t *) (pv + FrameSize));
- assert(framesize >= sizeof(stackframeinfo) + sizeof(localref_table));
+ assert(framesize >= sizeof(stackframeinfo_t) + sizeof(localref_table));
/* calculate needed values */
/* get data structures from stack */
- sfi = (stackframeinfo *) (datasp - sizeof(stackframeinfo));
- lrt = (localref_table *) (datasp - sizeof(stackframeinfo) -
- sizeof(localref_table));
+ sfi = (stackframeinfo_t *) (datasp - sizeof(stackframeinfo_t));
+ lrt = (localref_table *) (datasp - sizeof(stackframeinfo_t) -
+ sizeof(localref_table));
#if defined(ENABLE_JNI)
/* add current JNI local references table to this thread */
java_object_t *codegen_finish_native_call(u1 *sp, u1 *pv)
{
- stackframeinfo *sfi;
- java_handle_t *e;
- java_object_t *o;
- codeinfo *code;
- methodinfo *m;
- int32_t framesize;
+ stackframeinfo_t *sfi;
+ java_handle_t *e;
+ java_object_t *o;
+ codeinfo *code;
+ methodinfo *m;
+ int32_t framesize;
uint8_t *datasp;
uint64_t *ret_regs;
/* get data structures from stack */
- sfi = (stackframeinfo *) (datasp - sizeof(stackframeinfo));
+ sfi = (stackframeinfo_t *) (datasp - sizeof(stackframeinfo_t));
/* Remove current stackframeinfo from chain. */
/* calculate stackframe size */
cd->stackframesize =
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
4 + /* 4 arguments (start_native_call) */
nmd->memuse;
/* remember callee saved int registers in stackframeinfo (GC may need to */
/* recover them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_AST(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
/* restore callee saved int registers from stackframeinfo (GC might have */
/* modified them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
#if !defined(JIT_COMPILER_VIA_SIGNAL)
u1 *jit_asm_compile(methodinfo *m, u1 *mptr, u1 *sp, u1 *ra)
{
- stackframeinfo sfi;
- u1 *entrypoint;
- u1 *pa;
- ptrint *p;
+ stackframeinfo_t sfi;
+ u1 *entrypoint;
+ u1 *pa;
+ ptrint *p;
/* create the stackframeinfo (subtract 1 from RA as it points to the */
/* instruction after the call) */
md = m->parseddesc;
/* calc stackframe size */
- cd->stackframesize = sizeof(stackframeinfo) / SIZEOF_VOID_P +
- sizeof(localref_table) / SIZEOF_VOID_P +
- nmd->memuse +
- 1 + /* functionptr */
- 4; /* args for codegen_start_native_call */
+ cd->stackframesize =
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
+ sizeof(localref_table) / SIZEOF_VOID_P +
+ nmd->memuse +
+ 1 + /* functionptr */
+ 4; /* args for codegen_start_native_call */
/* create method header */
(void) dseg_add_unique_address(cd, code); /* CodeinfoPointer */
#if 0
java_objectheader *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra)
{
- stackframeinfo sfi;
+ stackframeinfo_t sfi;
u1 *xpc;
java_objectheader *o;
functionptr f;
cd->stackframesize =
1 + /* return address */
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
md->paramcount + /* for saving arguments over calls */
#if SIZEOF_VOID_P == 4
/* calculate stackframe size */
cd->stackframesize =
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
4 + /* 4 stackframeinfo arguments (darwin) */
nmd->paramcount +
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_AST(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
/* Restore callee saved integer registers from stackframeinfo (GC
might have modified them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
/* calculate stackframe size */
cd->stackframesize =
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
4 + /* 4 stackframeinfo arguments (darwin)*/
nmd->paramcount +
#if !defined(NDEBUG)
static void java_value_print(s4 type, replace_val_t value);
-static void replace_stackframeinfo_println(stackframeinfo *sfi);
+static void replace_stackframeinfo_println(stackframeinfo_t *sfi);
#endif
#if !defined(NDEBUG)
static void replace_pop_native_frame(executionstate_t *es,
sourcestate_t *ss,
- stackframeinfo *sfi)
+ stackframeinfo_t *sfi)
{
sourceframe_t *frame;
codeinfo *code;
*******************************************************************************/
sourcestate_t *replace_recover_source_state(rplpoint *rp,
- stackframeinfo *sfi,
+ stackframeinfo_t *sfi,
executionstate_t *es)
{
sourcestate_t *ss;
static void replace_me(rplpoint *rp, executionstate_t *es)
{
- stackframeinfo *sfi;
+ stackframeinfo_t *sfi;
sourcestate_t *ss;
sourceframe_t *frame;
s4 dumpsize;
#if defined(ENABLE_GC_CACAO)
void replace_gc_from_native(threadobject *thread, u1 *pc, u1 *sp)
{
- stackframeinfo *sfi;
+ stackframeinfo_t *sfi;
executionstate_t *es;
sourcestate_t *ss;
#endif
#if !defined(NDEBUG)
-static void replace_stackframeinfo_println(stackframeinfo *sfi)
+static void replace_stackframeinfo_println(stackframeinfo_t *sfi)
{
printf("prev=%p pv=%p sp=%p ra=%p xpc=%p method=",
(void*)sfi->prev, (void*)sfi->pv, (void*)sfi->sp,
codeinfo *tocode; /* code this frame was mapped to */
/* info for native frames */
- stackframeinfo *sfi; /* sfi for native frames, otherwise NULL */
+ stackframeinfo_t *sfi; /* sfi for native frames, otherwise NULL */
s4 nativeframesize; /* size (bytes) of native frame */
u1 *nativepc;
ptrint nativesavint[INT_SAV_CNT]; /* XXX temporary */
cd->stackframesize =
1 + /* return address */
- sizeof(stackframeinfo) / 8 +
+ sizeof(stackframeinfo_t) / 8 +
sizeof(localref_table) / 8 +
nmd->paramcount +
nmd->memuse +
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_AST(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
/* Restore callee saved integer registers from stackframeinfo (GC
might have modified them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
WINSAVE_CNT +
ABIPARAMS_CNT +
FLT_ARG_CNT +
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
4; /* 4 arguments or return value */
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs) + BIAS;
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs) + BIAS;
for (i = 0; i < INT_SAV_CNT; i++)
M_AST(abi_registers_integer_saved[i], REG_SP, disp + i * 8);
/* Restore callee saved integer registers from stackframeinfo (GC
might have modified them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs) + BIAS;
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs) + BIAS;
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 8);
java_object_t *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra)
{
- stackframeinfo sfi;
+ stackframeinfo_t sfi;
u1 *xpc;
u1 *javasp;
java_object_t *o;
/* global variables ***********************************************************/
#if !defined(ENABLE_THREADS)
-stackframeinfo *_no_threads_stackframeinfo = NULL;
+stackframeinfo_t *_no_threads_stackframeinfo = NULL;
#endif
CYCLES_STATS_DECLARE(stacktrace_overhead ,100,1)
*******************************************************************************/
-void stacktrace_stackframeinfo_add(stackframeinfo *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc)
+void stacktrace_stackframeinfo_add(stackframeinfo_t *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc)
{
- stackframeinfo **psfi;
- methodinfo *m;
+ stackframeinfo_t **psfi;
+ methodinfo *m;
#if !defined(__I386__) && !defined(__X86_64__) && !defined(__S390__) && !defined(__M68K__)
- bool isleafmethod;
+ bool isleafmethod;
#endif
#if defined(ENABLE_JIT)
- s4 framesize;
+ s4 framesize;
#endif
/* get current stackframe info pointer */
*******************************************************************************/
-void stacktrace_stackframeinfo_remove(stackframeinfo *sfi)
+void stacktrace_stackframeinfo_remove(stackframeinfo_t *sfi)
{
- stackframeinfo **psfi;
+ stackframeinfo_t **psfi;
/* clear the native world flag for the current thread */
/* ATTENTION: Clear this flag _before_ removing the stackframe info */
*******************************************************************************/
-static inline stacktracebuffer *stacktrace_method_add(stacktracebuffer *stb, stackframeinfo *sfi)
+static inline stacktracebuffer *stacktrace_method_add(stacktracebuffer *stb, stackframeinfo_t *sfi)
{
methodinfo *m;
void *pv;
*******************************************************************************/
-static inline void stacktrace_stack_walk(stackframeinfo *sfi)
+static inline void stacktrace_stack_walk(stackframeinfo_t *sfi)
{
methodinfo *m;
void *pv;
*******************************************************************************/
-stacktracebuffer *stacktrace_create(stackframeinfo *sfi)
+stacktracebuffer *stacktrace_create(stackframeinfo_t *sfi)
{
stacktracebuffer *stb;
- stackframeinfo tmpsfi;
+ stackframeinfo_t tmpsfi;
/* Create a stacktracebuffer in dump memory. */
/* forward typedefs ***********************************************************/
-typedef struct stackframeinfo stackframeinfo;
+typedef struct stackframeinfo_t stackframeinfo_t;
typedef struct stacktracebuffer stacktracebuffer;
typedef struct stacktrace_entry stacktrace_entry;
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
#include "md-abi.h"
*******************************************************************************/
-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) */
+struct stackframeinfo_t {
+ stackframeinfo_t *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];
+ uintptr_t adrregs[ADR_SAV_CNT];
# else
- ptrint intregs[INT_SAV_CNT];
+ uintptr_t intregs[INT_SAV_CNT];
# endif
#endif
};
/* function prototypes ********************************************************/
-void stacktrace_stackframeinfo_add(stackframeinfo *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc);
-void stacktrace_stackframeinfo_remove(stackframeinfo *sfi);
+void stacktrace_stackframeinfo_add(stackframeinfo_t *sfi, u1 *pv, u1 *sp, u1 *ra, u1 *xpc);
+void stacktrace_stackframeinfo_remove(stackframeinfo_t *sfi);
-stacktracebuffer *stacktrace_create(stackframeinfo *sfi);
+stacktracebuffer *stacktrace_create(stackframeinfo_t *sfi);
java_handle_bytearray_t *stacktrace_fillInStackTrace(void);
/* calculate stack frame size */
cd->stackframesize =
- sizeof(stackframeinfo) / SIZEOF_VOID_P +
+ sizeof(stackframeinfo_t) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
md->paramcount +
(md->returntype.type == TYPE_VOID ? 0 : 1) +
/* Save callee saved integer registers in stackframeinfo (GC may
need to recover them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_AST(abi_registers_integer_saved[i], REG_SP, disp + i * 8);
/* Restore callee saved integer registers from stackframeinfo (GC
might have modified them during a collection). */
- disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
- OFFSET(stackframeinfo, intregs);
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo_t) +
+ OFFSET(stackframeinfo_t, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 8);
void *signal_handle(int type, intptr_t val,
void *pv, void *sp, void *ra, void *xpc, void *context)
{
- stackframeinfo sfi;
- int32_t index;
- java_handle_t *o;
- methodinfo *m;
- java_handle_t *p;
+ stackframeinfo_t sfi;
+ int32_t index;
+ java_handle_t *o;
+ methodinfo *m;
+ java_handle_t *p;
/* wrap the value into a handle if it is a reference */
/* BEFORE: creating stackframeinfo */