(parse): Likewise.
* src/vm/jit/jit.h (JITDATA_FLAG_REORDER): Added.
(JITDATA_HAS_FLAG_REORDER): Likewise.
(basicblock): Removed pre_count and added predecessorcount,
successorcount, predecessors, successors.
(BASICBLOCK_INIT): Don't zero fields.
* src/vm/jit/stack.c (new_stack_analyse): Renamed pre_count to
predecessorcount.
(stack_analyse): Likewise and removed predecessor count calculation.
* src/vm/jit/show.c (new_show_basicblock): Likewise.
(show_basicblock): Likewise.
* src/vm/jit/ifconv/ifconv.c (ifconv_static): Likewise.
case ICMD_IF_ACMPNE:
/* basic blocks can only have 1 predecessor */
- if ((bptr[1].pre_count != 1) || (bptr[2].pre_count != 1))
+ if ((bptr[1].predecessorcount != 1) ||
+ (bptr[2].predecessorcount != 1))
break;
check(jd, bptr);
Changes: Christian Thalinger
Edwin Steiner
- $Id: jit.h 5183 2006-07-26 15:20:15Z twisti $
+ $Id: jit.h 5208 2006-08-04 14:42:57Z twisti $
*/
#define JITDATA_FLAG_INSTRUMENT 0x00000004
#define JITDATA_FLAG_IFCONV 0x00000008
+#define JITDATA_FLAG_REORDER 0x00000010
#define JITDATA_FLAG_SHOWINTERMEDIATE 0x20000000
#define JITDATA_FLAG_SHOWDISASSEMBLE 0x40000000
#define JITDATA_HAS_FLAG_IFCONV(jd) \
((jd)->flags & JITDATA_FLAG_IFCONV)
+#define JITDATA_HAS_FLAG_REORDER(jd) \
+ ((jd)->flags & JITDATA_FLAG_REORDER)
+
#define JITDATA_HAS_FLAG_SHOWINTERMEDIATE(jd) \
((jd)->flags & JITDATA_FLAG_SHOWINTERMEDIATE)
stackptr outstack; /* stack at end of basic block */
s4 indepth; /* stack depth at begin of basic block */
s4 outdepth; /* stack depth end of basic block */
- s4 pre_count; /* count of predecessor basic blocks */
+
+ s4 predecessorcount;
+ s4 successorcount;
+ basicblock *predecessors; /* array of predecessor basic blocks */
+ basicblock *successors; /* array of successor basic blocks */
+
branchref *branchrefs; /* list of branches to be patched */
basicblock *next; /* used to build a BB list (instead of array) */
methodinfo *method; /* method this block belongs to */
};
-/* macro for initializing newly allocated basicblock:s */
+
+/* Macro for initializing newly allocated basic block's. It does not
+ need to zero fields, as we zero out the whole basic block array. */
#define BASICBLOCK_INIT(bptr,m) \
- do { \
- bptr->mpc = -1; \
- bptr->flags = -1; \
- bptr->bitflags = 0; \
- bptr->lflags = 0; \
- bptr->type = BBTYPE_STD; \
- bptr->branchrefs = NULL; \
- bptr->pre_count = 0; \
- bptr->method = (m); \
- bptr->debug_nr = (m)->c_debug_nr++; \
- } while (0)
+ do { \
+ bptr->mpc = -1; \
+ bptr->flags = -1; \
+ bptr->type = BBTYPE_STD; \
+ bptr->method = (m); \
+ bptr->debug_nr = (m)->c_debug_nr++; \
+ } while (0)
/* branchref *****************************************************************/
Joseph Wenninger
Christian Thalinger
- $Id: parse.c 5202 2006-08-01 13:10:48Z twisti $
+ $Id: parse.c 5208 2006-08-04 14:42:57Z twisti $
*/
bptr = jd->new_basicblocks = DMNEW(basicblock, b_count + 1); /* one more for end ipc */
+ /* zero out all basic block structures */
+
+ MZERO(bptr, basicblock, b_count + 1);
+
b_count = 0;
jd->new_c_debug_nr = 0;
bptr = m->basicblocks = DMNEW(basicblock, b_count + 1); /* one more for end ipc */
+ /* zero out all basic block structures */
+
+ MZERO(bptr, basicblock, b_count + 1);
+
b_count = 0;
m->c_debug_nr = 0;
}
printf(", instruction count: %d, predecessors: %d):\n",
- bptr->icount, bptr->pre_count);
+ bptr->icount, bptr->predecessorcount);
iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
}
printf(", instruction count: %d, predecessors: %d):\n",
- bptr->icount, bptr->pre_count);
+ bptr->icount, bptr->predecessorcount);
iptr = bptr->iinstr;
Christian Thalinger
Christian Ullrich
- $Id: stack.c 5173 2006-07-25 15:57:11Z twisti $
+ $Id: stack.c 5208 2006-08-04 14:42:57Z twisti $
*/
bptr->type = BBTYPE_EXH;
bptr->instack = new;
bptr->indepth = 1;
- bptr->pre_count = 10000;
+ bptr->predecessorcount = 10000;
STACKRESET;
NEWXSTACK;
}
- /* count predecessors of each block **************************************/
+ /* count predecessors of each block ***************************************/
#if CONDITIONAL_LOADCONST
/* XXX move this to a separate function */
case ICMD_IF_ACMPEQ:
case ICMD_IF_ACMPNE:
/* XXX add missing conditional branches */
- bptr[1].pre_count++;
+ bptr[1].predecessorcount++;
/* FALLTHROUGH */
/* unconditional branch */
case ICMD_GOTO:
- BLOCK_OF(iptr->dst.insindex)->pre_count++;
+ BLOCK_OF(iptr->dst.insindex)->predecessorcount++;
break;
/* switches */
case ICMD_TABLESWITCH:
table = iptr->dst.table;
- BLOCK_OF((table++)->insindex)->pre_count++;
+ BLOCK_OF((table++)->insindex)->predecessorcount++;
i = iptr->sx.s23.s3.tablehigh
- iptr->sx.s23.s2.tablelow + 1;
while (--i >= 0) {
- BLOCK_OF((table++)->insindex)->pre_count++;
+ BLOCK_OF((table++)->insindex)->predecessorcount++;
}
break;
case ICMD_LOOKUPSWITCH:
lookup = iptr->dst.lookup;
- BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->pre_count++;
+ BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->predecessorcount++;
i = iptr->sx.s23.s2.lookupcount;
while (--i >= 0) {
- BLOCK_OF((lookup++)->target.insindex)->pre_count++;
+ BLOCK_OF((lookup++)->target.insindex)->predecessorcount++;
}
break;
/* default - fall into next block */
default:
- bptr[1].pre_count++;
+ bptr[1].predecessorcount++;
break;
} /* end switch */
} /* end basic block loop */
bptr->type = BBTYPE_EXH;
bptr->instack = new;
bptr->indepth = 1;
- bptr->pre_count = 10000;
+ bptr->predecessorcount = 10000;
STACKRESET;
NEWXSTACK;
}
- b_count = m->basicblockcount;
- bptr = m->basicblocks;
-
- while (--b_count >= 0) {
- if (bptr->icount != 0) {
- iptr = bptr->iinstr + bptr->icount - 1;
- switch (iptr->opc) {
- case ICMD_RET:
- case ICMD_RETURN:
- case ICMD_IRETURN:
- case ICMD_LRETURN:
- case ICMD_FRETURN:
- case ICMD_DRETURN:
- case ICMD_ARETURN:
- case ICMD_ATHROW:
- break;
-
- case ICMD_IFEQ:
- case ICMD_IFNE:
- case ICMD_IFLT:
- case ICMD_IFGE:
- case ICMD_IFGT:
- case ICMD_IFLE:
-
- case ICMD_IFNULL:
- case ICMD_IFNONNULL:
-
- case ICMD_IF_ICMPEQ:
- case ICMD_IF_ICMPNE:
- case ICMD_IF_ICMPLT:
- case ICMD_IF_ICMPGE:
- case ICMD_IF_ICMPGT:
- case ICMD_IF_ICMPLE:
-
- case ICMD_IF_ACMPEQ:
- case ICMD_IF_ACMPNE:
- bptr[1].pre_count++;
-
- case ICMD_GOTO:
- m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
- break;
-
- case ICMD_TABLESWITCH:
- s4ptr = iptr->val.a;
- m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
- i = *s4ptr++; /* low */
- i = *s4ptr++ - i + 1; /* high */
- while (--i >= 0) {
- m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
- }
- break;
-
- case ICMD_LOOKUPSWITCH:
- s4ptr = iptr->val.a;
- m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
- i = *s4ptr++; /* count */
- while (--i >= 0) {
- m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
- s4ptr += 2;
- }
- break;
-
- default:
- bptr[1].pre_count++;
- break;
- }
- }
- bptr++;
- }
-
do {
loops++;
b_count = m->basicblockcount;