Unified variables changes for common/i386.
[cacao.git] / src / vm / jit / reg.c
index dd82952fd899306c3ea34fa645a7c9da757e8b1f..cb6407d9a80037b4ff3e98c2f33db0f437db4426 100644 (file)
 
    Changes: Stefan Ring
             Christian Thalinger
-                       Christian Ullrich
+            Christian Ullrich
             Michael Starzinger
+            Edwin Steiner
 
-   $Id: reg.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: reg.c 5404 2006-09-07 13:29:05Z christian $
 
 */
 
@@ -46,6 +47,7 @@
 #include "md-abi.h"
 
 #include "mm/memory.h"
+#include "vm/jit/abi.h"
 #include "vm/jit/reg.h"
 
 
 
 *******************************************************************************/
 
-void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
+void reg_setup(jitdata *jd)
 {
-       s4 i;
-       varinfo5 *v;
-       
+       methodinfo   *m;
+       registerdata *rd;
+       s4            i;
+#if !defined(NEW_VAR)
+       varinfo5     *v;
+#endif
+
+       /* get required compiler data */
+
+       m  = jd->m;
+       rd = jd->rd;
+
        /* setup the integer register table */
 
 #if defined(__ARM__)
@@ -185,21 +196,28 @@ void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
        assert(rd->argfltreguse == FLT_ARG_CNT);
 
 
-       rd->freemem    = DMNEW(s4, id->cummaxstack);
+       rd->freemem    = DMNEW(s4, m->maxstack);
 #if defined(HAS_4BYTE_STACKSLOT)
-       rd->freemem_2  = DMNEW(s4, id->cummaxstack);
+       rd->freemem_2  = DMNEW(s4, m->maxstack);
 #endif
-       rd->locals     = DMNEW(varinfo5, id->cumlocals);
-       rd->interfaces = DMNEW(varinfo5, id->cummaxstack);
-       for (v = rd->locals, i = id->cumlocals; i > 0; v++, i--) {
+#if !defined(NEW_VAR)
+       rd->locals     = DMNEW(varinfo5, m->maxlocals);
+       rd->interfaces = DMNEW(varinfo5, m->maxstack);
+       for (v = rd->locals, i = m->maxlocals; i > 0; v++, i--) {
                v[0][TYPE_INT].type = -1;
                v[0][TYPE_LNG].type = -1;
                v[0][TYPE_FLT].type = -1;
                v[0][TYPE_DBL].type = -1;
                v[0][TYPE_ADR].type = -1;
+
+               v[0][TYPE_INT].regoff = 0;
+               v[0][TYPE_LNG].regoff = 0;
+               v[0][TYPE_FLT].regoff = 0;
+               v[0][TYPE_DBL].regoff = 0;
+               v[0][TYPE_ADR].regoff = 0;
        }
 
-       for (v = rd->interfaces, i = id->cummaxstack; i > 0; v++, i--) {
+       for (v = rd->interfaces, i = m->maxstack; i > 0; v++, i--) {
                v[0][TYPE_INT].type = -1;
                v[0][TYPE_INT].flags = 0;
                v[0][TYPE_LNG].type = -1;
@@ -210,21 +228,28 @@ void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
                v[0][TYPE_DBL].flags = 0;
                v[0][TYPE_ADR].type = -1;
                v[0][TYPE_ADR].flags = 0;
+
+               v[0][TYPE_INT].regoff = 0;
+               v[0][TYPE_LNG].regoff = 0;
+               v[0][TYPE_FLT].regoff = 0;
+               v[0][TYPE_DBL].regoff = 0;
+               v[0][TYPE_ADR].regoff = 0;
        }
+#endif
 
 #if defined(SPECIALMEMUSE)
 # if defined(__DARWIN__)
        /* 6*4=24 byte linkage area + 8*4=32 byte minimum parameter Area */
-       rd->memuse = LA_WORD_SIZE + INT_ARG_CNT; 
+       rd->memuse = LA_SIZE_IN_POINTERS + INT_ARG_CNT; 
 # else
-       rd->memuse = LA_WORD_SIZE;
+       rd->memuse = LA_SIZE_IN_POINTERS;
 # endif
 #else
        rd->memuse = 0; /* init to zero -> analyse_stack will set it to a higher  */
                        /* value, if appropriate */
 #endif
 
-       /* Set rd->argxxxreguse to XXX_ARG_CNBT to not use unused argument        */
+       /* Set rd->arg*reguse to *_ARG_CNBT to not use unused argument            */
        /* registers as temp registers  */
 #if defined(HAS_ADDRESS_REGISTER_FILE)
        rd->argadrreguse = 0;
@@ -245,4 +270,5 @@ void reg_setup(methodinfo *m, registerdata *rd, t_inlining_globals *id)
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */