X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fstacktrace.c;h=02ed7f89e21e86ef4224deb12cbb86e365dd4ca2;hb=63824b44a4f8082643c21e20634c88d199bb8045;hp=8a58dce8c98c537a87b303d0bf8254bbae06b7ed;hpb=163a556f6d971fce7f861d7ef8debbeca992a4de;p=cacao.git diff --git a/src/vm/jit/stacktrace.c b/src/vm/jit/stacktrace.c index 8a58dce8c..02ed7f89e 100644 --- a/src/vm/jit/stacktrace.c +++ b/src/vm/jit/stacktrace.c @@ -74,7 +74,7 @@ /* 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) @@ -91,15 +91,15 @@ CYCLES_STATS_DECLARE(stacktrace_getStack ,40,10000) *******************************************************************************/ -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; + codeinfo *code; #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 */ @@ -126,9 +126,9 @@ void stacktrace_stackframeinfo_add(stackframeinfo *sfi, u1 *pv, u1 *sp, u1 *ra, } } - /* Get methodinfo pointer for the parent Java method. */ + /* Get codeinfo pointer for the parent Java method. */ - m = code_get_methodinfo_for_pv(pv); + code = code_get_codeinfo_for_pv(pv); /* XXX */ /* assert(m != NULL); */ @@ -179,19 +179,19 @@ void stacktrace_stackframeinfo_add(stackframeinfo *sfi, u1 *pv, u1 *sp, u1 *ra, /* Fill new stackframeinfo structure. */ - sfi->prev = *psfi; - sfi->method = m; - sfi->pv = pv; - sfi->sp = sp; - sfi->ra = ra; - sfi->xpc = xpc; + sfi->prev = *psfi; + sfi->code = code; + sfi->pv = pv; + sfi->sp = sp; + sfi->ra = ra; + sfi->xpc = xpc; #if !defined(NDEBUG) if (opt_DebugStackFrameInfo) { log_start(); log_print("[stackframeinfo add : sfi=%p, method=%p, pv=%p, sp=%p, ra=%p, xpc=%p, method=", - sfi, sfi->method, sfi->pv, sfi->sp, sfi->ra, sfi->xpc); - method_print(sfi->method); + sfi, sfi->code->m, sfi->pv, sfi->sp, sfi->ra, sfi->xpc); + method_print(sfi->code->m); log_print("]"); log_finish(); } @@ -216,9 +216,9 @@ void stacktrace_stackframeinfo_add(stackframeinfo *sfi, u1 *pv, u1 *sp, u1 *ra, *******************************************************************************/ -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 */ @@ -233,8 +233,8 @@ void stacktrace_stackframeinfo_remove(stackframeinfo *sfi) if (opt_DebugStackFrameInfo) { log_start(); log_print("[stackframeinfo remove: sfi=%p, method=%p, pv=%p, sp=%p, ra=%p, xpc=%p, method=", - sfi, sfi->method, sfi->pv, sfi->sp, sfi->ra, sfi->xpc); - method_print(sfi->method); + sfi, sfi->code->m, sfi->pv, sfi->sp, sfi->ra, sfi->xpc); + method_print(sfi->code->m); log_print("]"); log_finish(); } @@ -310,18 +310,21 @@ static inline stacktracebuffer *stacktrace_entry_add(stacktracebuffer *stb, meth *******************************************************************************/ -static inline stacktracebuffer *stacktrace_method_add(stacktracebuffer *stb, stackframeinfo *sfi) +static inline stacktracebuffer *stacktrace_method_add(stacktracebuffer *stb, stackframeinfo_t *sfi) { - methodinfo *m; + codeinfo *code; void *pv; void *xpc; + methodinfo *m; int32_t linenumber; /* Get values from the stackframeinfo. */ - m = sfi->method; - pv = sfi->pv; - xpc = sfi->xpc; + code = sfi->code; + pv = sfi->pv; + xpc = sfi->xpc; + + m = code->m; /* Skip builtin methods. */ @@ -349,22 +352,22 @@ static inline stacktracebuffer *stacktrace_method_add(stacktracebuffer *stb, sta *******************************************************************************/ -static inline void stacktrace_stack_walk(stackframeinfo *sfi) +static inline void stacktrace_stack_walk(stackframeinfo_t *sfi) { - methodinfo *m; - void *pv; - void *sp; - void *ra; - void *xpc; - uint32_t framesize; + codeinfo *code; + void *pv; + void *sp; + void *ra; + void *xpc; + uint32_t framesize; /* Get values from the stackframeinfo. */ - m = sfi->method; - pv = sfi->pv; - sp = sfi->sp; - ra = sfi->ra; - xpc = sfi->xpc; + code = sfi->code; + pv = sfi->pv; + sp = sfi->sp; + ra = sfi->ra; + xpc = sfi->xpc; /* Get the current stack frame size. */ @@ -382,14 +385,8 @@ static inline void stacktrace_stack_walk(stackframeinfo *sfi) else # endif { - /* TODO Remove jd->isleafmethod and use the flags in - codeinfo. */ - -/* if (!CODE_IS_LEAFMETHOD(m->code)) { */ - int32_t isleafmethod = *((int32_t *) (((intptr_t) pv) + IsLeaf)); - if (!isleafmethod) { + if (!code_is_leafmethod(code)) ra = md_stacktrace_get_returnaddress(sp, framesize); - } } #else ra = intrp_md_stacktrace_get_returnaddress(sp, framesize); @@ -413,9 +410,9 @@ static inline void stacktrace_stack_walk(stackframeinfo *sfi) #endif } - /* Get the methodinfo pointer for the parent Java method. */ + /* Get the codeinfo pointer for the parent Java method. */ - m = code_get_methodinfo_for_pv(pv); + code = code_get_codeinfo_for_pv(pv); /* Calculate the SP for the parent Java method. */ @@ -438,11 +435,11 @@ static inline void stacktrace_stack_walk(stackframeinfo *sfi) 1 from the RA to get the XPC, because the RA points to the instruction after the call instruction. */ - sfi->method = m; - sfi->pv = pv; - sfi->sp = sp; - sfi->ra = ra; - sfi->xpc = (void *) (((intptr_t) ra) - 1); + sfi->code = code; + sfi->pv = pv; + sfi->sp = sp; + sfi->ra = ra; + sfi->xpc = (void *) (((intptr_t) ra) - 1); } @@ -463,10 +460,10 @@ static inline void stacktrace_stack_walk(stackframeinfo *sfi) *******************************************************************************/ -stacktracebuffer *stacktrace_create(stackframeinfo *sfi) +stacktracebuffer *stacktrace_create(stackframeinfo_t *sfi) { stacktracebuffer *stb; - stackframeinfo tmpsfi; + stackframeinfo_t tmpsfi; /* Create a stacktracebuffer in dump memory. */ @@ -490,11 +487,11 @@ stacktracebuffer *stacktrace_create(stackframeinfo *sfi) if (sfi == NULL) return NULL; - tmpsfi.method = sfi->method; - tmpsfi.pv = sfi->pv; - tmpsfi.sp = sfi->sp; - tmpsfi.ra = sfi->ra; - tmpsfi.xpc = sfi->xpc; + tmpsfi.code = sfi->code; + tmpsfi.pv = sfi->pv; + tmpsfi.sp = sfi->sp; + tmpsfi.ra = sfi->ra; + tmpsfi.xpc = sfi->xpc; /* Iterate till we're done. */ @@ -505,9 +502,9 @@ stacktracebuffer *stacktrace_create(stackframeinfo *sfi) if (opt_DebugStackTrace) { log_start(); log_print("[stacktrace: method=%p, pv=%p, sp=%p, ra=%p, xpc=%p, method=", - tmpsfi.method, tmpsfi.pv, tmpsfi.sp, tmpsfi.ra, + tmpsfi.code->m, tmpsfi.pv, tmpsfi.sp, tmpsfi.ra, tmpsfi.xpc); - method_print(tmpsfi.method); + method_print(tmpsfi.code->m); log_print("]"); log_finish(); } @@ -527,12 +524,12 @@ stacktracebuffer *stacktrace_create(stackframeinfo *sfi) stacktrace_stack_walk(&tmpsfi); - /* If the new methodinfo pointer is NULL we reached a + /* If the new codeinfo pointer is NULL we reached a asm_vm_call_method function. In this case we get the next values from the previous stackframeinfo in the chain. Otherwise the new values have been calculated before. */ - if (tmpsfi.method == NULL) { + if (tmpsfi.code == NULL) { sfi = sfi->prev; /* If the previous stackframeinfo in the chain is NULL we @@ -545,11 +542,11 @@ stacktracebuffer *stacktrace_create(stackframeinfo *sfi) /* Fill the temporary stackframeinfo with the new values. */ - tmpsfi.method = sfi->method; - tmpsfi.pv = sfi->pv; - tmpsfi.sp = sfi->sp; - tmpsfi.ra = sfi->ra; - tmpsfi.xpc = sfi->xpc; + tmpsfi.code = sfi->code; + tmpsfi.pv = sfi->pv; + tmpsfi.sp = sfi->sp; + tmpsfi.ra = sfi->ra; + tmpsfi.xpc = sfi->xpc; } }