GNU header update.
[cacao.git] / src / vm / jit / alpha / asmpart.S
index e5971550546b040713d14116063ac88668fc1fb0..081fe32436f4b3b768d4500341534151d685c107 100644 (file)
@@ -1,10 +1,9 @@
 /* vm/jit/alpha/asmpart.S - Java-C interface functions for alpha
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Institut f. Computersprachen, TU Wien
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
-   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
-   J. Wenninger
+   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+   Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
@@ -30,7 +29,7 @@
 
    Changes: Joseph Wenninger
 
-   $Id: asmpart.S 1683 2004-12-05 21:33:36Z jowenn $
+   $Id: asmpart.S 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
@@ -39,6 +38,7 @@
 #include "vm/jit/alpha/offsets.h"
 #include "vm/jit/alpha/asmoffsets.h"
 
+
 #define v0      $0
 
 #define t0      $1
 /********************* exported functions and variables ***********************/
 
        .globl has_no_x_instr_set
-       .globl synchronize_caches
        .globl asm_calljavafunction
        .globl asm_calljavafunction2
        .globl asm_calljavafunction2double
@@ -527,8 +526,10 @@ asm_refillin_and_handle_exception_cont:
 *******************************************************************************/
 
        .ent asm_throw_and_handle_arrayindexoutofbounds_exception
+
 asm_throw_and_handle_arrayindexoutofbounds_exception:
        ldgp    gp,0(pv)
+
        ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
        sll     t0,48,t0
        sra     t0,48,t0              /* isolate offset                           */
@@ -543,45 +544,43 @@ asm_throw_and_handle_arrayindexoutofbounds_exception:
        addq    t0,pv,pv              /* compute update address                   */
 
 asm_throw_and_handle_arrayindexoutofbounds_exception_cont:
-       mov     sp,t0
-       lda     sp,-6*8(sp) /*prepare stackframe*/
-        stq     pv,5*8(sp)  /*pv of failure*/
-       stq     itmp1,4*8(sp) /*int parameter  of the exception*/
-       stq     xpc,3*8(sp) /*address of failure */
-       stq     t0,2*8(sp) /*store begin of java stack frame*/
-       stq     pv,1*8(sp) /*store pv of caller in structure*/
-       stq     zero,0*8(sp) /*builtin (invisible function)*/
-       jsr     ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
-       ldgp    gp,0(ra)
+       mov     sp,t0
+       lda     sp,-6*8(sp) /*prepare stackframe*/
+       stq     pv,5*8(sp)  /*pv of failure*/
+       stq     itmp1,4*8(sp) /*int parameter  of the exception*/
+       stq     xpc,3*8(sp) /*address of failure */
+       stq     t0,2*8(sp) /*store begin of java stack frame*/
+       stq     pv,1*8(sp) /*store pv of caller in structure*/
+       stq     zero,0*8(sp) /*builtin (invisible function)*/
 
-       ldq     a0,string_java_lang_ArrayIndexOutOfBoundsException
-       ldq     a1,6*8(sp)  /*int  of exception*/
-       jsr ra,new_exception_int
+       jsr     ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
+       ldgp    gp,0(ra)
+
+       ldq     a0,6*8(sp)  /*int  of exception*/
+       jsr     ra,new_arrayindexoutofboundsexception
        ldgp    gp,0(ra)
 
-       mov v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
+       mov     v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
 
-       jsr ra,asm_remove_native_stackinfo
-       ldgp    gp,0(ra)
+       jsr     ra,asm_remove_native_stackinfo
+       ldgp    gp,0(ra)
 
-       ldq itmp2,0(sp) 
-        ldq    pv,2*8(sp)
-       lda sp,3*8(sp)
-       br asm_handle_exception
+       ldq     itmp2,0(sp)     
+       ldq     pv,2*8(sp)
+       lda     sp,3*8(sp)
+       br      asm_handle_exception
 
        .end asm_throw_and_handle_arrayindexoutofbounds_exception
 
-/**************** function asm_throw_and_handle_arithmetic_exception ***********
-*                                                                              *
-*   This function handles an exception. It does not use the usual calling      *
-*   conventions. The exception string  is passed in REG_ITMP1 and the          *
-*   pc from the exception raising position is passed in REG_ITMP2.             *
-*                                                                              *
-*   void asm_handle_arithmetic_exception (exceptionclass, exceptionpc);        *
-*                                                                              *
+
+/* asm_throw_and_handle_arithmetic_exception ***********************************
+
+   DOCUMENT ME!
+
 *******************************************************************************/
 
        .ent asm_throw_and_handle_arithmetic_exception
+
 asm_throw_and_handle_arithmetic_exception:
        ldl     t0,0(ra)              /* load instruction LDA PV,xxx(RA)          */
        sll     t0,48,t0
@@ -608,11 +607,9 @@ asm_throw_and_handle_arithmetic_exception_cont:
        jsr     ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
        ldgp    gp,0(ra)
 
-       ldq     a0,string_java_lang_ArithmeticException
-       ldq     a1,6*8(sp)  /*string  of exception*/
-       jsr ra,new_exception_message
+       jsr     ra,new_arithmeticexception
        ldgp    gp,0(ra)
-       mov v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
+       mov     v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
 
        jsr ra,asm_remove_native_stackinfo
        ldgp    gp,0(ra)
@@ -700,7 +697,7 @@ asm_handle_nat_exception:
        ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
        srl     t0,16,t0              /* isolate instruction code                 */
        lda     t0,-0x177b(t0)        /* test for LDAH                            */
-       bne     t0,asm_handle_exception       
+       bne     t0,asm_handle_exception
        ldl     t0,4(ra)              /* load instruction LDAH PV,xxx(PV)         */
        sll     t0,16,t0              /* compute high offset                      */
        addl    t0,0,t0               /* sign extend high offset                  */
@@ -989,10 +986,7 @@ ex_flt2:
 asm_check_clinit:
        ldgp    gp,0(itmp2)           /* function is called via `jsr ra,itmp1'    */
 
-       ldl             itmp2,offclassinit(itmp1)
-       bne             itmp2,L_is_initialized
-       
-       subq    sp,9*8,sp
+       subq    sp,8*8,sp
 
        stq             ra,0*8(sp)            /* save return address                      */
        stq     pv,1*8(sp)            /* save pv of calling java function         */
@@ -1003,10 +997,23 @@ asm_check_clinit:
        stq             a4,6*8(sp)
        stq             a5,7*8(sp)
                
+       ldl             itmp2,offclassinit(itmp1)
+       bne             itmp2,L_is_initialized
+       
        mov             itmp1,a0              /* move class pointer to a0                 */
        jsr             ra,class_init
     ldgp    gp,0(ra)
                
+       beq     v0,L_initializererror
+
+L_is_initialized:
+       ldq     ra,0*8(sp)            /* get return address                       */
+       subq    ra,1*4,ra             /* go back 1 instruction                    */
+       ldl     itmp1,8*8(sp)         /* load machine code from stack             */
+       stl     itmp1,0(ra)           /* store the machine code                   */
+
+       call_pal PAL_imb              /* synchronise instruction cache            */
+
        ldq             ra,0*8(sp)            /* restore return address                   */
        ldq     pv,1*8(sp)            /* restore pv of calling java function      */
        ldq             a0,2*8(sp)            /* restore argument registers               */
@@ -1016,39 +1023,33 @@ asm_check_clinit:
        ldq             a4,6*8(sp)
        ldq             a5,7*8(sp)
 
-       addq    sp,9*8,sp
-
-       beq     v0,L_initializererror
-
-L_is_initialized:
-       subq    ra,1*4,ra             /* go back 1 instructions                   */
-       ldl     itmp1,0(sp)           /* load machine code from stack             */
-       addq    sp,1*8,sp             /* remove stack frame                       */
-       stl     itmp1,0(ra)           /* store the machine code                   */
-
-       call_pal PAL_imb              /* synchronise instruction cache            */
+       addq    sp,(8+1)*8,sp         /* remove stack frame (+1 for machine code) */
 
+       subq    ra,1*4,ra             /* go back 1 instruction                    */
        jmp             zero,(ra)             /* jump to the new code                     */
 
 L_initializererror:
-       addq    sp,1*8,sp             /* remove stack frame                       */
-
 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
-       subq    sp,1*8,sp
-       stq     ra,0*8(sp)
        jsr     ra,builtin_asm_get_exceptionptrptr
-       ldq     ra,0*8(sp)
-       addq    sp,1*8,sp
-       ldq     xptr,0(v0)            /* get the exception pointer                */
-       stq     zero,0(v0)            /* clear the exception pointer              */
 #else
-       lda     itmp3,_exceptionptr
-       ldq     xptr,0(itmp3)
-       stq     zero,0(itmp3)
+       lda     v0,_exceptionptr
 #endif
+       ldq     xptr,0(v0)            /* get the exception pointer                */
+       stq     zero,0(v0)            /* clear the exception pointer              */
+
+       ldq             ra,0*8(sp)            /* restore return address                   */
+       ldq     pv,1*8(sp)            /* restore pv of calling java function      */
+       ldq             a0,2*8(sp)            /* restore argument registers               */
+       ldq             a1,3*8(sp)
+       ldq             a2,4*8(sp)
+       ldq             a3,5*8(sp)
+       ldq             a4,6*8(sp)
+       ldq             a5,7*8(sp)
+
+       addq    sp,(8+1)*8,sp         /* remove stack frame (+1 for machine code) */
 
        subq    ra,4,xpc
-       br      asm_handle_nat_exception
+       br      asm_handle_exception  /* we have the pv of the calling java func. */
 
        .end    asm_check_clinit
 
@@ -1074,8 +1075,7 @@ nb_monitorenter:
 #if 0
        subq    sp,8,sp
     stq     ra,0(sp)
-       ldq     a0,string_java_lang_NullPointerException
-    jsr     ra,new_exception
+    jsr     ra,new_nullpointerexception
     ldgp    gp,0(ra)
        mov     v0,xptr
     ldq     ra,0(sp)
@@ -1108,8 +1108,7 @@ nb_monitorexit:
 #if 0
        subq    sp,8,sp
     stq     ra,0(sp)
-       ldq     a0,string_java_lang_NullPointerException
-    jsr     ra,new_exception
+    jsr     ra,new_nullpointerexception
     ldgp    gp,0(ra)
        mov     v0,xptr
     ldq     ra,0(sp)
@@ -1288,8 +1287,7 @@ nb_aastore_null:
 #if 0  
        subq    sp,8,sp                   /* allocate stack space                 */
        stq     ra,0(sp)                  /* save return address                  */
-       ldq     a0,string_java_lang_NullPointerException
-    jsr     ra,new_exception
+    jsr     ra,new_nullpointerexception
     ldgp    gp,0(ra)
        mov     v0,xptr
        ldq     ra,0(sp)
@@ -1322,8 +1320,7 @@ nb_aastore_throw:
 #if 0
        subq    sp,8,sp                   /* allocate stack space                 */
        stq     ra,0(sp)                  /* save return address                  */
-       ldq     a0,string_java_lang_ArrayStoreException
-    jsr     ra,new_exception
+    jsr     ra,new_arraystoreexception
     ldgp    gp,0(ra)
        mov     v0,xptr
        ldq     ra,0(sp)
@@ -1499,14 +1496,14 @@ asm_prepare_native_stackinfo:
        ret
        .end asm_prepare_native_stackinfo
 
-       .end asm_remove_native_stackinfo
+       .ent asm_remove_native_stackinfo
 asm_remove_native_stackinfo:
        ldq t0,0(sp)
        ldq t1,8(sp)
        stq t0,0(t1)
        lda sp,40(sp)
        ret
-       .end asm_prepare_native_stackinfo
+       .end asm_remove_native_stackinfo
 
 /*
  * These are local overrides for various environment variables in Emacs.