* src/vm/jit/stack.h (MARKREACHED): Set invars.
* src/vm/jit/stack.c (new_stack_analyse): Set invars and outvars.
* src/vm/jit/show.c (new_show_basicblock): Show invars and outvars.
--HG--
branch : new_instruction_format
Changes: Christian Thalinger
Edwin Steiner
- $Id: jit.h 5310 2006-09-05 11:34:49Z edwin $
+ $Id: jit.h 5311 2006-09-05 11:40:03Z edwin $
*/
s4 icount; /* number of intermediate code instructions */
s4 mpc; /* machine code pc at start of block */
stackptr instack; /* stack at begin of basic block */
+ stackptr *invars; /* array of in-variables at begin of block */
stackptr outstack; /* stack at end of basic block */
+ stackptr *outvars; /* array of out-variables at end of block */
s4 indepth; /* stack depth at begin of basic block */
s4 outdepth; /* stack depth end of basic block */
printf("]):\n");
+ if (stage >= SHOW_STACK) {
+ printf("IN: ");
+ new_show_variable_array(jd, bptr->invars, bptr->indepth, stage);
+ printf("\n");
+ }
+
iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
for (i = 0; i < bptr->icount; i++, iptr++) {
printf("\n");
}
+ if (stage >= SHOW_STACK) {
+ printf("OUT: ");
+ new_show_variable_array(jd, bptr->outvars, bptr->outdepth, stage);
+ printf("\n");
+ }
+
#if defined(ENABLE_DISASSEMBLER)
if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
(!deadcode)) {
Christian Thalinger
Christian Ullrich
- $Id: stack.c 5310 2006-09-05 11:34:49Z edwin $
+ $Id: stack.c 5311 2006-09-05 11:40:03Z edwin $
*/
new = jd->new_stack;
jd->new_basicblocks[0].flags = BBREACHED;
- jd->new_basicblocks[0].instack = 0;
+ jd->new_basicblocks[0].instack = NULL;
+ jd->new_basicblocks[0].invars = NULL;
jd->new_basicblocks[0].indepth = 0;
/* initialize in-stack of exception handlers */
bptr->flags = BBREACHED;
bptr->type = BBTYPE_EXH;
bptr->instack = new;
+ bptr->invars = DMNEW(stackptr, 1);
+ bptr->invars[0] = new;
bptr->indepth = 1;
bptr->predecessorcount = CFG_UNKNOWN_PREDECESSORS;
STACKRESET;
/* by falling through from the previous block. */
COPYCURSTACK(copy);
bptr->instack = copy;
+ bptr->invars = DMNEW(stackptr, stackdepth);
+ for (i=stackdepth; i--; copy = copy->prev)
+ bptr->invars[i] = copy;
bptr->indepth = stackdepth;
}
else {
bptr->outstack = curstack;
bptr->outdepth = stackdepth;
+ bptr->outvars = DMNEW(stackptr, stackdepth);
+ for (i = stackdepth, copy = curstack; i--; copy = copy->prev)
+ bptr->outvars[i] = copy;
/* stack slots at basic block end become interfaces */
Changes: Christian Ullrich
- $Id: stack.h 5303 2006-09-05 10:39:58Z edwin $
+ $Id: stack.h 5311 2006-09-05 11:40:03Z edwin $
*/
* c...current stack
*/
+/* XXX this macro is much too big! */
+
#define MARKREACHED(b,c) \
do { \
if ((b) <= (bptr)) \
(b)->bitflags |= BBFLAG_REPLACEMENT; \
if ((b)->flags < BBREACHED) { \
+ int locali; \
COPYCURSTACK((c)); \
(b)->flags = BBREACHED; \
(b)->instack = (c); \
(b)->indepth = stackdepth; \
+ (b)->invars = DMNEW(stackptr, stackdepth); \
+ for (locali = stackdepth; locali--; (c) = (c)->prev) \
+ (b)->invars[locali] = (c); \
} else { \
stackptr s = curstack; \
stackptr t = (b)->instack; \