stack frame more abi compliant
[cacao.git] / src / vm / jit / stack.c
index 8061a3e56ee66b5e8509d1945b8a984a0c8675bc..25fad8880f771d2f328ecff0be41c4a43d798e7a 100644 (file)
@@ -1,4 +1,4 @@
-/* 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,
 
    Changes: Edwin Steiner
 
-   $Id: stack.c 1582 2004-11-24 13:57:36Z twisti $
+   $Id: stack.c 1680 2004-12-04 12:02:08Z jowenn $
 
 */
 
 
 #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"
 
 
 /**********************************************************************/
@@ -209,7 +210,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
                                }
                                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");
                                        
                                }
@@ -235,7 +236,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
                                                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:
@@ -251,7 +252,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
                                                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:
@@ -1396,7 +1397,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
 #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
@@ -1405,7 +1406,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
 #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
@@ -1434,7 +1435,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
 #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
@@ -1443,7 +1444,7 @@ methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
 #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
@@ -2160,7 +2161,9 @@ void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
                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) ||
@@ -2195,7 +2198,9 @@ void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
                }
        }
        printf("\n");
-
+#ifdef LSRA
+       }
+#endif
        if (showdisassemble) {
 #if defined(__I386__) || defined(__X86_64__)
                u1 *u1ptr;
@@ -2285,7 +2290,7 @@ void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
 
                        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++) {
@@ -2294,7 +2299,7 @@ void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
                                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");
@@ -2494,7 +2499,7 @@ void show_icmd(instruction *iptr, bool deadcode)
                break;
 
        case ICMD_INLINE_START:
-               printf("\t\t\t%s.%s%s",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text);
+               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;
@@ -2625,7 +2630,7 @@ void show_icmd(instruction *iptr, bool deadcode)
                }
                break;
        }
-/*     printf(" Line number: %d, method:",iptr->line); */
+       printf(" Line number: %d, method:",iptr->line);
 /*        printf("\t\t");
        utf_display(iptr->method->class->name); 
        printf(".");