* Merged in twisti-branch.
[cacao.git] / src / vm / jit / s390 / asmpart.S
index 5fb0292ea54b79dad319c521aea94440d9c5e93b..0dcd911fdaf4f5d19781964f6ddb20ee95bb8251 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: asmpart.S 7407 2007-02-26 19:12:03Z michi $
+   $Id: asmpart.S 7486 2007-03-08 13:50:07Z twisti $
 
 */
 
@@ -73,6 +73,7 @@ L_##magic##_lp_end:                                         ; \
        .globl asm_vm_call_method_float
        .globl asm_vm_call_method_double
        .globl asm_vm_call_method_exception_handler
+       .globl asm_vm_call_method_end
 
        .globl asm_call_jit_compiler
 
@@ -95,8 +96,6 @@ L_##magic##_lp_end:                                         ; \
        .globl asm_getclassvalues_atomic
 
 
-asm_handle_nat_exception:
-       .long 0
 asm_abstractmethoderror:
        .long 0
 asm_replacement_out:
@@ -414,6 +413,7 @@ L_avcmeh_bras:
 
 L_no_args:
        lr    s3, sp
+       lhi   s4, 0
        j     L_copy_done
 
 L_handle_i0:
@@ -459,6 +459,8 @@ L_handle_d1:
        ld    fa1, offvmargdata(itmp1)
        j     L_register_copy
 
+asm_vm_call_method_end:
+       nop
 
 /****************** function asm_call_jit_compiler *****************************
 *                                                                              *
@@ -519,24 +521,27 @@ L_bras_jac:
        lm      %r2,%r5,96(sp)             /* restore volatile int arg regs */
        ld      %f0,96+16(sp)              /* restore volatile float arg regs */
        ld      %f2,96+24(sp)              /* restore volatile float arg regs */
-       l       %r14,96+32(sp)             /* restore return address */
-       ahi     sp, ACJC_STACKFRAME        /* remove stack frame */
 
        ltr     pv,pv
        je      L_asm_call_jit_compiler_exception
 
+       l       %r14,96+32(sp)             /* restore return address */
+       ahi     sp, ACJC_STACKFRAME        /* remove stack frame */
+
 jit_code_entry:                        /* label to set breakpoint on */
        br      pv                         /* call the method, it will return to the caller */
 
 
 L_asm_call_jit_compiler_exception:
-#if 0
-       call    exceptions_get_and_clear_exception@PLT
-       pop     xpc                         /* delete return address              */
-       sub     $3,xpc                      /* faulting address is ra - 3         */
-       jmp     L_asm_handle_exception
-#endif
-       .long 0
+       bras    itmp2, L_bras_acjce
+       .long exceptions_get_and_clear_exception
+L_bras_acjce:
+       l       itmp2, 0(itmp2)
+       basr    %r14, itmp2
+       lr      xptr, %r2
+       l       xpc,96+32(sp)              /* restore return address */
+       ahi     sp, ACJC_STACKFRAME        /* remove stack frame */
+       j       L_asm_handle_nat_exception
 
 
 #if 0
@@ -550,10 +555,11 @@ L_asm_call_jit_compiler_exception:
 *                                                                              *
 *******************************************************************************/
 
-asm_handle_nat_exception:
-       add     $8,sp                       /* clear return address of native stub*/
 #endif
-       
+
+asm_handle_nat_exception:
+L_asm_handle_nat_exception:
+       /* TODO really nothing here ? */
 asm_handle_exception:
 L_asm_handle_exception:                 /* required for PIC code              */
 
@@ -784,12 +790,10 @@ L_apw_bras:
        br      itmp3                       /* return */
 
 L_asm_patcher_wrapper_exception:
-       .long 0
-#if 0
-       mov     itmp3,xptr                  /* get exception                      */
-       pop     xpc                         /* get and remove return address      */
-       jmp     L_asm_handle_exception
-#endif
+       lr      xptr,itmp3                  /* get exception                      */
+       l       xpc, apw_sfs + (5 * 4)(sp)  /* load return address to JIT from stack */
+       ahi     sp, apw_sfs + (6 * 4)       /* remove stack frame, and stack frame by patcher stub */
+       j       L_asm_handle_exception
 
 #if 0
 
@@ -1010,7 +1014,7 @@ asm_criticalsections:
        .long   _crit_end
        .long   _crit_restart
 #endif
-       .quad 0
+       .long 0
 
 
 /* Disable exec-stacks, required for Gentoo ***********************************/