* src/vm/jit/powerpc/codegen.c (createcompilerstub): Store the
authortwisti <none@none>
Sun, 12 Feb 2006 23:22:36 +0000 (23:22 +0000)
committertwisti <none@none>
Sun, 12 Feb 2006 23:22:36 +0000 (23:22 +0000)
methodinfo pointer in the same place as in the methodheader for
compiled methods.

* src/vm/jit/powerpc/asmpart.S (asm_call_jit_compiler): methodinfo
pointer is passed via itmp1.
(asm_calljavafunction, asm_calljavafunction2): Pass methodinfo pointer
via itmp1.

src/vm/jit/powerpc/asmpart.S
src/vm/jit/powerpc/codegen.c

index 9cb943847cb414c21c9965ed5ea70993fe69bfa7..34a321f32be3c82864807540c2b70ccf3cce2c1a 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: asmpart.S 4440 2006-02-05 12:03:43Z twisti $
+   $Id: asmpart.S 4497 2006-02-12 23:22:36Z twisti $
 
 */
 
@@ -137,8 +137,8 @@ asm_calljavafunction_int:
        SAVE_TEMPORARY_REGISTERS(18)      /* the offset has to be even            */
 #endif
 
-       stw     a0,36(r1)
-       addi    itmp1,r1,36
+       mr      itmp1,a0                  /* pass method pointer via tmp1         */
+
        mr      a0,a1
        mr      a1,a2
        mr      a2,a3
@@ -151,10 +151,10 @@ asm_calljavafunction_int:
        lis     mptr,asm_call_jit_compiler@ha
        addi    mptr,mptr,asm_call_jit_compiler@l
 #endif
-       stw     mptr,32(r1)
-       addi    mptr,r1,28
+       stw     mptr,8*4(r1)
+       addi    mptr,r1,7*4
 
-       lwz     pv,4(mptr)
+       lwz     pv,1*4(mptr)
        mtctr   pv
        bctrl
 
@@ -262,7 +262,8 @@ asm_calljavafunction2double:
        SAVE_TEMPORARY_REGISTERS(18)      /* the offset has to be even            */
 #endif
 
-       stw     r3,36(r1)                 /* save method pointer for compiler     */
+       stw     a0,9*4(r1)                /* save method pointer for compiler     */
+
        mr      itmp1,r6                  /* pointer to arg block                 */
        mr      itmp2,r4                  /* arg count                            */
 
@@ -324,7 +325,8 @@ L_register_handle_float:
 L_register_copy_done:
 
 L_stack_copy_done:
-       addi    itmp1,r1,36
+       lwz     itmp1,9*4(sp)             /* pass method pointer via tmp1         */
+
 #if defined(__DARWIN__)
        lis     mptr,ha16(asm_call_jit_compiler)
        addi    mptr,mptr,lo16(asm_call_jit_compiler)
@@ -332,10 +334,10 @@ L_stack_copy_done:
        lis     mptr,asm_call_jit_compiler@ha
        addi    mptr,mptr,asm_call_jit_compiler@l
 #endif
-       stw     mptr,32(r1)
-       addi    mptr,r1,28
+       stw     mptr,8*4(r1)
+       addi    mptr,r1,7*4
 
-       lwz     pv,4(mptr)
+       lwz     pv,1*4(mptr)
        mtctr   pv
        bctrl
 1:
@@ -523,8 +525,7 @@ noregchange:
        mr      a4,a3                       /* xpc is equal to ra                 */
        bl      stacktrace_create_extern_stackframeinfo
 
-       lwz     itmp1,(LA_SIZE + 5*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8 + 1*4)(r1)
-       lwz     a0,0(itmp1)
+       lwz     a0,(LA_SIZE + 5*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8 + 1*4)(r1)
        bl      jit_compile                 /* compile the Java method            */
        mr      pv,r3                       /* move address to pv register        */
 
index 89e77287e69b91aeeea61bd3abfb55ab9c94c1db..078c79ef9546a5eb3685623ffadfaf47cd8b5229 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
             Christian Ullrich
 
-   $Id: codegen.c 4393 2006-01-31 15:41:22Z twisti $
+   $Id: codegen.c 4497 2006-02-12 23:22:36Z twisti $
 
 */
 
@@ -3788,29 +3788,46 @@ gen_method:
        
 *******************************************************************************/
 
-#define COMPSTUBSIZE 6
+#define COMPILERSTUB_DATASIZE    2 * SIZEOF_VOID_P
+#define COMPILERSTUB_CODESIZE    4 * 4
+
+#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
+
 
 u1 *createcompilerstub(methodinfo *m)
 {
-       s4 *s = CNEW(s4, COMPSTUBSIZE);     /* memory to hold the stub            */
-       s4 *mcodeptr = s;                   /* code generation pointer            */
+       u1     *s;                          /* memory to hold the stub            */
+       ptrint *d;
+       s4     *mcodeptr;                   /* code generation pointer            */
+
+       s = CNEW(u1, COMPILERSTUB_SIZE);
+
+       /* set data pointer and code pointer */
+
+       d = (ptrint *) s;
+       s = s + COMPILERSTUB_DATASIZE;
 
-       M_LDA(REG_ITMP1, REG_PV, 4 * 4);
-       M_ALD_INTERN(REG_PV, REG_PV, 5 * 4);
+       mcodeptr = (s4 *) s;
+
+       /* Store the methodinfo* in the same place as in the methodheader
+          for compiled methods. */
+
+       d[0] = (ptrint) asm_call_jit_compiler;
+       d[1] = (ptrint) m;
+
+       M_ALD_INTERN(REG_ITMP1, REG_PV, -1 * SIZEOF_VOID_P);
+       M_ALD_INTERN(REG_PV, REG_PV, -2 * SIZEOF_VOID_P);
        M_MTCTR(REG_PV);
        M_RTS;
 
-       s[4] = (s4) m;                      /* literals to be adressed            */
-       s[5] = (s4) asm_call_jit_compiler;  /* jump directly via PV from above    */
-
-       asm_cacheflush((void *) s, (u1 *) mcodeptr - (u1 *) s);
+       asm_cacheflush((void *) d, COMPILERSTUB_SIZE);
 
 #if defined(ENABLE_STATISTICS)
        if (opt_stat)
-               count_cstub_len += COMPSTUBSIZE * 4;
+               count_cstub_len += COMPILERSTUB_SIZE;
 #endif
 
-       return (u1 *) s;
+       return s;
 }