X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fshow.c;h=6075ffa8f689b871060814bf10e15c8de5630757;hb=3e56c54b7f5d9a6bb37aea7ff235b8a100a5bf72;hp=b962972372a07f3f07fbb01e09e20be66efef5e7;hpb=d4f22ce167f35cf350df1d316fd3f61241d98972;p=cacao.git diff --git a/src/vm/jit/show.c b/src/vm/jit/show.c index b96297237..6075ffa8f 100644 --- a/src/vm/jit/show.c +++ b/src/vm/jit/show.c @@ -1,9 +1,7 @@ /* src/vm/jit/show.c - showing the intermediate representation - 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 + Copyright (C) 1996-2005, 2006, 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -28,6 +26,7 @@ #include "config.h" #include +#include #include "vm/types.h" @@ -36,33 +35,29 @@ #include "threads/lock-common.h" #include "vm/global.h" -#include "vm/builtin.h" -#include "vm/stringlocal.h" -#include "vm/vm.h" +#include "vm/jit/builtin.hpp" +#include "vm/options.h" +#include "vm/string.hpp" +#include "vm/vm.hpp" #include "vm/jit/abi.h" -#include "vm/jit/jit.h" +#include "vm/jit/jit.hpp" #include "vm/jit/show.h" #include "vm/jit/disass.h" #include "vm/jit/stack.h" #include "vm/jit/parse.h" -#include "vmcore/options.h" - #if defined(ENABLE_DEBUG_FILTER) -# include -# include -# if defined(ENABLE_THREADS) -# include "threads/native/threads.h" -# else -# include "threads/none/threads.h" -# endif +# include +# include +# include "threads/thread.hpp" #endif + /* global variables ***********************************************************/ -#if defined(ENABLE_THREADS) && !defined(NDEBUG) -static java_object_t *show_global_lock; +#if !defined(NDEBUG) +static Mutex* mutex; #endif @@ -85,9 +80,7 @@ bool show_init(void) #if defined(ENABLE_THREADS) /* initialize the show lock */ - show_global_lock = NEW(java_object_t); - - LOCK_INIT_OBJECT_LOCK(show_global_lock); + mutex = Mutex_new(); #endif #if defined(ENABLE_DEBUG_FILTER) @@ -162,7 +155,7 @@ void show_method(jitdata *jd, int stage) is not reentrant-able and we could not read functions printed at the same time. */ - LOCK_MONITOR_ENTER(show_global_lock); + Mutex_lock(mutex); #if defined(ENABLE_INTRP) if (opt_intrp) @@ -393,7 +386,7 @@ void show_method(jitdata *jd, int stage) } #endif - LOCK_MONITOR_EXIT(show_global_lock); + Mutex_unlock(mutex); /* finally flush the output */ @@ -525,11 +518,23 @@ void show_basicblock(jitdata *jd, basicblock *bptr, int stage) printf("\n"); + if (irstage >= SHOW_CFG) { + printf("succs: %d [ ", bptr->successorcount); + + for (i = 0; i < bptr->successorcount; i++) + printf("%d ", bptr->successors[i]->nr); + + printf("]\n"); + } + if (irstage >= SHOW_STACK) { printf("IN: "); show_variable_array(jd, bptr->invars, bptr->indepth, irstage); printf(" javalocals: "); - show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage); + if (bptr->javalocals) + show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage); + else + printf("null"); printf("\n"); } @@ -541,6 +546,18 @@ void show_basicblock(jitdata *jd, basicblock *bptr, int stage) } #endif /* defined(ENABLE_INLINING) */ +#if defined(ENABLE_SSA) + + iptr = bptr->phis; + + for (i = 0; i < bptr->phicount; i++, iptr++) { + printf("%4d:%4d: ", iptr->line, iptr->flags.bits >> INS_FLAG_ID_SHIFT); + + show_icmd(jd, iptr, deadcode, irstage); + printf("\n"); + } +#endif + iptr = bptr->iinstr; for (i = 0; i < bptr->icount; i++, iptr++) { @@ -618,7 +635,7 @@ void show_basicblock(jitdata *jd, basicblock *bptr, int stage) #define SHOW_INT_CONST(val) \ if (stage >= SHOW_PARSE) { \ - printf("%d (0x%08x) ", (val), (val)); \ + printf("%d (0x%08x) ", (int32_t) (val), (int32_t) (val)); \ } \ else { \ printf("iconst "); \ @@ -1414,6 +1431,22 @@ void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage) SHOW_S1(iptr); SHOW_DST(iptr); break; + case ICMD_GETEXCEPTION: + SHOW_DST(iptr); + break; +#if defined(ENABLE_SSA) + case ICMD_PHI: + printf("[ "); + for (i = 0; i < iptr->s1.argcount; ++i) { + SHOW_VARIABLE(iptr->sx.s23.s2.iargs[i]->dst.varindex); + } + printf("] "); + SHOW_DST(iptr); + if (iptr->flags.bits & (1 << 0)) printf("used "); + if (iptr->flags.bits & (1 << 1)) printf("redundantAll "); + if (iptr->flags.bits & (1 << 2)) printf("redundantOne "); + break; +#endif } fflush(stdout); } @@ -1525,22 +1558,19 @@ void show_filters_apply(methodinfo *m) { int res; char *method_name; s4 len; - s4 dumpsize; /* compose full name of method */ len = - utf_bytes(m->class->name) + + utf_bytes(m->clazz->name) + 1 + utf_bytes(m->name) + utf_bytes(m->descriptor) + 1; - dumpsize = dump_size(); /* allocate memory */ + method_name = MNEW(char, len); - method_name = DMNEW(char, len); - - utf_cat_classname(method_name, m->class->name); + utf_cat_classname(method_name, m->clazz->name); strcat(method_name, "."); utf_cat(method_name, m->name); utf_cat(method_name, m->descriptor); @@ -1563,10 +1593,8 @@ void show_filters_apply(methodinfo *m) { } } - /* release memory */ - - dump_release(dumpsize); - + // Release memory. + MFREE(method_name, char, len); } #define STATE_IS_INITIAL() ((FILTERVERBOSECALLCTR[0] == 0) && (FILTERVERBOSECALLCTR[1] == 0))