* Merged executionstate branch.
[cacao.git] / src / vm / jit / inline / inline_debug.inc
1 #if 0
2 static void debug_dump_inline_context(inline_node *iln)
3 {
4         assert(iln->indent);
5
6         printf("%sinline_context @%p: \n",
7                         iln->indent, (void*)iln->ctx);
8 }
9 #endif
10
11
12 static void dump_inline_tree(inline_node *iln, s4 blocknr)
13 {
14         char indent[100];
15         int i;
16         inline_node *child;
17         s4 nr;
18         s4 lastnr;
19
20         if (!iln) {
21                 printf("(inline_node *)null\n");
22                 return;
23         }
24
25         for (i=0; i<iln->depth; ++i)
26                 indent[i] = '\t';
27         indent[i] = 0;
28
29         assert(iln->m);
30         if (iln->depth) {
31                 if (!iln->parent) {
32                         printf("parent unset");
33                 }
34                 else {
35                         printf("%s[%d] (°%d) start L%03d %c%c (caller L%03d pc %d)"
36                                    " (pt=%d+%d,lofs=%d,exh %d) cum(ins %d,bb %d,etl %d) sync=%d(%d) ",
37                                         indent, iln->depth, iln->debugnr, blocknr,
38                                         (iln->blockbefore) ? 'B' : '-',
39                                         (iln->blockafter) ? 'A' : '-',
40                                         iln->callerblock->nr, iln->callerpc,
41                                         iln->n_passthroughcount - iln->n_selfpassthroughcount,
42                                         iln->n_selfpassthroughcount,
43                                         iln->localsoffset,
44                                         iln->n_handlercount,
45                                         iln->cumul_instructioncount, iln->cumul_basicblockcount,
46                                         iln->cumul_exceptiontablelength,
47                                         iln->synchronize, iln->synclocal
48                                         );
49                 }
50         }
51         else {
52                 printf("%s[%d] ROOT cum(ins %d,bb %d,etl %d) ",
53                                 indent, iln->depth,
54                                 iln->cumul_instructioncount, iln->cumul_basicblockcount,
55                                 iln->cumul_exceptiontablelength);
56         }
57         method_println(iln->m);
58
59         child = iln->children;
60         lastnr = 0;
61         nr = blocknr;
62         if (child) {
63                 do {
64                         nr += (child->callerblock->nr - lastnr);
65                         lastnr = child->callerblock->nr;
66
67                         if (child->blockbefore)
68                                 nr++;
69
70                         dump_inline_tree(child, nr);
71
72                         nr += child->cumul_basicblockcount - 1;
73                         if (!child->blockbefore)
74                                 nr++;
75                         if (child->blockafter)
76                                 nr++;
77                 }
78                 while ((child = child->next) != iln->children);
79         }
80
81         if (iln->depth) {
82                 printf("%s[%d] (°%d) end   L%03d\n",
83                                 indent, iln->depth, iln->debugnr,
84                                 blocknr + iln->cumul_basicblockcount
85                                                 - ((iln->blockbefore) ? 1 : 0));
86         }
87 }
88
89
90 /* vim:noexpandtab:sw=4:ts=4:ft=c:
91  */