Merged with tip.
[cacao.git] / src / vm / jit / show.c
index b6539c7960aa7266b41bb5cbebaed507e121f04d..7287f0968e56b600c981ef66ad0061dca47e385e 100644 (file)
 #include "vmcore/options.h"
 
 #if defined(ENABLE_DEBUG_FILTER)
-#      include <sys/types.h>
-#      include <regex.h>
-#      if defined(ENABLE_THREADS)
-#              include "threads/native/threads.h"
-#      else
-#              include "threads/none/threads.h"
-#      endif
+# include <sys/types.h>
+# include <regex.h>
+# include "threads/thread.h"
 #endif
 
+
 /* global variables ***********************************************************/
 
 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
@@ -537,7 +534,10 @@ void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
                        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");
                }
 
@@ -549,6 +549,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++) {
@@ -1422,6 +1434,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);
 }
@@ -1538,7 +1566,7 @@ void show_filters_apply(methodinfo *m) {
        /* 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) +
@@ -1548,7 +1576,7 @@ void show_filters_apply(methodinfo *m) {
 
        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);