-/* jit/stack.c - stack analysis
+/* vm/jit/stack.c - stack analysis
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
- M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
- P. Tomsich, J. Wenninger
+ Copyright (C) 1996-2005 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
This file is part of CACAO.
Changes: Edwin Steiner
- $Id: stack.c 1456 2004-11-05 14:33:14Z twisti $
+ $Id: stack.c 1735 2004-12-07 14:33:27Z twisti $
*/
#include <stdio.h>
#include <string.h>
-#include "global.h"
-#include "native.h"
-#include "builtin.h"
+
#include "disass.h"
-#include "tables.h"
#include "types.h"
-#include "options.h"
-#include "statistics.h"
-#include "jit/codegen.inc.h"
-#include "jit/jit.h"
-#include "jit/stack.h"
-#include "jit/reg.h"
+#include "mm/memory.h"
+#include "native/native.h"
#include "toolbox/logging.h"
-#include "toolbox/memory.h"
+#include "vm/global.h"
+#include "vm/builtin.h"
+#include "vm/options.h"
+#include "vm/statistics.h"
+#include "vm/tables.h"
+#include "vm/jit/codegen.inc.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/reg.h"
+#include "vm/jit/stack.h"
/**********************************************************************/
}
else if (bptr->indepth != stackdepth) {
show_icmd_method(m, cd, rd);
- printf("Block: %ld, required depth:%ld, current depth:%ld\n",bptr->debug_nr,bptr->indepth,stackdepth);
+ printf("Block: %d, required depth: %d, current depth: %d\n", bptr->debug_nr, bptr->indepth, stackdepth);
panic("Stack depth mismatch");
}
if (breplace && opcode == breplace->opcode) {
iptr[0].opc = breplace->icmd;
iptr[0].op1 = breplace->type_d;
- iptr[0].val.a = breplace->builtin;
+ iptr[0].val.fp = breplace->builtin;
m->isleafmethod = false;
switch (breplace->icmd) {
case ICMD_BUILTIN1:
if (breplace && opcode == breplace->opcode) {
iptr[0].opc = breplace->icmd;
iptr[0].op1 = breplace->type_d;
- iptr[0].val.a = breplace->builtin;
+ iptr[0].val.fp = breplace->builtin;
m->isleafmethod = false;
switch (breplace->icmd) {
case ICMD_BUILTIN1:
#if SUPPORT_CONST_ASTORE
if (len > 0 && iptr->val.a == 0) {
if (iptr[1].opc == ICMD_BUILTIN3 &&
- iptr[1].val.a == BUILTIN_aastore) {
+ iptr[1].val.fp == BUILTIN_aastore) {
iptr[0].opc = ICMD_AASTORECONST;
iptr[1].opc = ICMD_NOP;
OPTT2_0(TYPE_INT, TYPE_ADR);
#if !SUPPORT_DIVISION
iptr[0].opc = ICMD_BUILTIN2;
iptr[0].op1 = TYPE_INT;
- iptr[0].val.a = BUILTIN_idiv;
+ iptr[0].val.fp = BUILTIN_idiv;
m->isleafmethod = false;
goto builtin2;
#endif
#if !SUPPORT_DIVISION
iptr[0].opc = ICMD_BUILTIN2;
iptr[0].op1 = TYPE_INT;
- iptr[0].val.a = BUILTIN_irem;
+ iptr[0].val.fp = BUILTIN_irem;
m->isleafmethod = false;
goto builtin2;
#endif
#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
iptr[0].opc = ICMD_BUILTIN2;
iptr[0].op1 = TYPE_LNG;
- iptr[0].val.a = BUILTIN_ldiv;
+ iptr[0].val.fp = BUILTIN_ldiv;
m->isleafmethod = false;
goto builtin2;
#endif
#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
iptr[0].opc = ICMD_BUILTIN2;
iptr[0].op1 = TYPE_LNG;
- iptr[0].val.a = BUILTIN_lrem;
+ iptr[0].val.fp = BUILTIN_lrem;
m->isleafmethod = false;
goto builtin2;
#endif
}
break;
}
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
+ SETDST;
+ break;
case ICMD_BUILTIN3:
/* DEBUG */ /*dolog("builtin3");*/
if (m->basicblockcount > count_max_basic_blocks)
count_max_basic_blocks = m->basicblockcount;
count_basic_blocks += m->basicblockcount;
- if (m->instructioncount > count_max_javainstr)
- count_max_javainstr = m->instructioncount;
+ if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
count_javainstr += m->instructioncount;
if (m->stackcount > count_upper_bound_new_stack)
count_upper_bound_new_stack = m->stackcount;
printf("\n");
}
printf("\n");
-
+#ifdef LSRA
+ if (!opt_lsra) {
+#endif
printf("Interface Table:\n");
for (i = 0; i < cd->maxstack; i++) {
if ((rd->interfaces[i][0].type >= 0) ||
}
}
printf("\n");
-
+#ifdef LSRA
+ }
+#endif
if (showdisassemble) {
#if defined(__I386__) || defined(__X86_64__)
u1 *u1ptr;
s4 a;
- u1ptr = m->mcode + cd->dseglen;
+ u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
for (i = 0; i < m->basicblocks[0].mpc; i++, u1ptr++) {
a = disassinstr(u1ptr, i);
i += a;
#else
s4 *s4ptr;
- s4ptr = (s4 *) (m->mcode + cd->dseglen);
+ s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
for (i = 0; i < m->basicblocks[0].mpc; i += 4, s4ptr++) {
disassinstr(s4ptr, i);
}
printf("\n");
i = bptr->mpc;
- u1ptr = m->mcode + cd->dseglen + i;
+ u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + i);
if (bptr->next != NULL) {
for (; i < bptr->next->mpc; i++, u1ptr++) {
printf("\n");
} else {
- for (; u1ptr < (u1 *) (m->mcode + m->mcodelength); i++, u1ptr++) {
+ for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength); i++, u1ptr++) {
a = disassinstr(u1ptr, i);
i += a;
u1ptr += a;
printf("\n");
i = bptr->mpc;
- s4ptr = (s4 *) (m->mcode + cd->dseglen + i);
+ s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
if (bptr->next != NULL) {
for (; i < bptr->next->mpc; i += 4, s4ptr++) {
printf("\n");
} else {
- for (; s4ptr < (s4 *) (m->mcode + m->mcodelength); i += 4, s4ptr++) {
+ for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); i += 4, s4ptr++) {
disassinstr(s4ptr, i);
}
printf("\n");
}
break;
+ case ICMD_INLINE_START:
+ printf("\t\t\t%s.%s%s depth=%i",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text, iptr->op1);
+ break;
+ case ICMD_INLINE_END:
+ break;
+
case ICMD_BUILTIN3:
case ICMD_BUILTIN2:
case ICMD_BUILTIN1:
- printf(" %s", icmd_builtin_name((functionptr) iptr->val.a));
+ printf(" %s", icmd_builtin_name((functionptr) iptr->val.fp));
break;
case ICMD_INVOKEVIRTUAL:
}
break;
}
-/* printf(" Line number: %d, method:",iptr->line); */
- printf("\t\t");
+ printf(" Line number: %d, method:",iptr->line);
+/* printf("\t\t");
utf_display(iptr->method->class->name);
printf(".");
- utf_display(iptr->method->name);
+ utf_display(iptr->method->name); */
}