Merged revisions 7797-7917 via svnmerge from
[cacao.git] / src / vm / jit / sparc64 / asmpart.S
index 3afa0d92dd72bee69c80824c63dd8a2895f86192..ce7a16fda60822ab24b3c126edff6710207803b3 100644 (file)
@@ -96,47 +96,82 @@ asm_vm_call_method_long:
 asm_vm_call_method_float: 
 asm_vm_call_method_double:
        
-       save %sp,-144,%sp                                /* 16 reg-save + 2 */
+       save %sp,-((JITSTACK_CNT+2)*8),%sp
+       add %sp,JITSTACK,%l1               /* right above window save area */
 
 
-       /* %i2 not needed after _nocopy -> calculate in branch delay */
+       /* %i1 not needed after _nocopy -> calculate in branch delay */
 
        brlez %i1, calljava_nocopy
        
        dec %i1   /* branch delay */
        ldx [%i2 + offvmargdata],%o0
+       ldx [%i2 + offvmargtype],%l2
+       cmp %l2,2
+       be,a %xcc,calljava_arg0isfloat
+       ld  [%i2 + offvmargdata],fa0f   /* delay: annulled if branch not taken */
        ldd [%i2 + offvmargdata],fa0
+calljava_arg0isfloat:
        brlez %i1,calljava_nocopy
 
        dec %i1   /* branch delay */
        ldx [%i2 + (offvmargdata+sizevmarg*1)],%o1
+       ldx [%i2 + (offvmargtype+sizevmarg*1)],%l2
+       cmp %l2,2
+       be,a %xcc,calljava_arg1isfloat
+       ld  [%i2 + (offvmargdata+sizevmarg*1)],fa1f
        ldd [%i2 + (offvmargdata+sizevmarg*1)],fa1
+calljava_arg1isfloat:
        brlez %i1,calljava_nocopy
 
        dec %i1
        ldx [%i2 + (offvmargdata+sizevmarg*2)],%o2
+       ldx [%i2 + (offvmargtype+sizevmarg*2)],%l2
+       cmp %l2,2
+       be,a %xcc,calljava_arg2isfloat
+       ld  [%i2 + (offvmargdata+sizevmarg*2)],fa2f
        ldd [%i2 + (offvmargdata+sizevmarg*2)],fa2
+calljava_arg2isfloat:
        brlez %i1,calljava_nocopy
 
        dec %i1
        ldx [%i2 + (offvmargdata+sizevmarg*3)],%o3
+       ldx [%i2 + (offvmargtype+sizevmarg*3)],%l2
+       cmp %l2,2
+       be,a %xcc,calljava_arg3isfloat
+       ld  [%i2 + (offvmargdata+sizevmarg*3)],fa3f
        ldd [%i2 + (offvmargdata+sizevmarg*3)],fa3
+calljava_arg3isfloat:
        brlez %i1,calljava_nocopy
 
        dec %i1
        ldx [%i2 + (offvmargdata+sizevmarg*4)],%o4
+       ldx [%i2 + (offvmargtype+sizevmarg*4)],%l2
+       cmp %l2,2
+       be,a %xcc,calljava_arg4isfloat
+       ld  [%i2 + (offvmargdata+sizevmarg*4)],fa4f
        ldd [%i2 + (offvmargdata+sizevmarg*4)],fa4
+calljava_arg4isfloat:
 
 calljava_argsloaded:   
        brlez %i1, calljava_nocopy
        nop
        sllx %i1,3,%l0                     /* remaining args * 8           */
-       add %sp,16*8+bias,%l1              /* right above window save area */
        sub %sp,%l0,%sp                    /* allocate more stack space    */
+       add %sp,JITSTACK,%l1               /* adjust stack begin pointer   */
        
 calljava_copyloop:
+       ldx [%i2 + (offvmargtype+sizevmarg*5)],%l2
+       cmp %l2,2
+       be  %xcc,calljava_copyloop_float
+       nop
        ldx [%i2 + (offvmargdata+sizevmarg*5)],%l0
        stx %l0,[%l1]
+       b   calljava_copy_done
+calljava_copyloop_float:
+       ld  [%i2 + (offvmargdata+sizevmarg*5)],%f1      
+       std %f0,[%l1]
+calljava_copy_done:
        inc sizevmarg,%i2                  /* src++                        */
        subcc %i1,1,%i1                    /* arg_count--                  */
        bnz %xcc, calljava_copyloop        /* use cc from previous instr   */
@@ -151,8 +186,8 @@ calljava_nocopy:
        mov   %i0,itmp1         /* pass method info pointer via itmp1 */
        
        setx  asm_call_jit_compiler,%l0,mptr_itmp2  /* fake virtual function call (2 instr) */
-       stx   mptr_itmp2,[%sp + 2047 + 17*8]        /* store function address               */
-       add   %sp,2047 + 16*8,mptr_itmp2            /* set method pointer                   */
+       stx   mptr_itmp2,[%l1 + 1*8]        /* store function address               */
+       mov   %l1,mptr_itmp2            /* set method pointer                   */
        
        ldx  [1*8 + mptr_itmp2], pv_caller          /* method call as in Java               */
        jmpl pv_caller,ra_caller                      /* call JIT compiler          */
@@ -205,7 +240,8 @@ asm_vm_call_method_end:
 asm_call_jit_compiler:
        
        /* stacksave for regsave(16) + argslots(6) + float args  */
-       save    %sp,-((16+6+FLT_ARG_CNT)*8),%sp
+       /* Note: +1 to keep stack 16-byte aligned                */
+       save    %sp,-((16+6+FLT_ARG_CNT+1)*8),%sp
 
        SAVE_FLOAT_ARGUMENT_REGISTERS(22)
 
@@ -419,31 +455,6 @@ L_asm_patcher_wrapper_exception:
        nop
 
 
-asm_getclassvalues_atomic:
-_crit_restart:
-_crit_begin:
-/* not doing a window save, using the global temporary registers */
-       ldsw    [offbaseval+%o0],itmp1
-       ldsw    [offdiffval+%o0],itmp2
-       ldsw    [offbaseval+%o1],itmp3
-_crit_end:
-       stw     itmp1,[offcast_super_baseval+%o2]
-       stw     itmp2,[offcast_super_diffval+%o2]
-       stw     itmp3,[offcast_sub_baseval+%o2]
-       jmpl    ra_caller+8,zero  /* caller's ra, b/c no window save */
-       nop
-
-
-    .data
-
-asm_criticalsections:
-#if defined(ENABLE_THREADS)
-    .xword   _crit_begin
-    .xword   _crit_end
-    .xword   _crit_restart
-#endif
-    .xword   0
-    
     
 /* asm_store_fp_state_reg **************************************************
  *                                                                         *
@@ -476,6 +487,34 @@ asm_load_fp_state_reg:
        nop
 
 
+
+
+asm_getclassvalues_atomic:
+_crit_restart:
+_crit_begin:
+/* not doing a window save, using the global temporary registers */
+       ldsw    [offbaseval+%o0],itmp1
+       ldsw    [offdiffval+%o0],itmp2
+       ldsw    [offbaseval+%o1],itmp3
+_crit_end:
+       stw     itmp1,[offcast_super_baseval+%o2]
+       stw     itmp2,[offcast_super_diffval+%o2]
+       stw     itmp3,[offcast_sub_baseval+%o2]
+       jmpl    ra_caller+8,zero  /* caller's ra, b/c no window save */
+       nop
+
+
+    .data
+
+asm_criticalsections:
+#if defined(ENABLE_THREADS)
+    .xword   _crit_begin
+    .xword   _crit_end
+    .xword   _crit_restart
+#endif
+    .xword   0
+    
+
 /* disable exec-stacks ********************************************************/
 
 #if defined(__linux__) && defined(__ELF__)