-/**************** function asm_refillin_and_handle_exception *******************
-* *
-* This function handles an exception. It does not use the usual calling *
-* conventions. The exception is passed in REG_ITMP1 and the *
-* pc from the exception raising position is passed in REG_ITMP2. *
-* a0 contains the PV of the function causing the problem *
-* *
-* void asm_handle_arithmetic_exception (exceptionclass, exceptionpc); *
-* *
-*******************************************************************************/
- .ent asm_refillin_and_handle_exception
-asm_refillin_and_handle_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 */
- addq t0,ra,pv /* compute update address */
- 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_refillin_and_handle_exception_cont
- 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 */
- addq t0,pv,pv /* compute update address */
-
-asm_refillin_and_handle_exception_cont:
-
- mov sp,t0
- lda sp,-6*8(sp) /* prepare stackframe*/
- stq pv,5*8(sp) /* store pv of caller */
- stq xptr,4*8(sp) /*exception ptr*/
- stq xpc,3*8(sp) /*address of failure*/
- stq t0,2*8(sp) /*begin of java stack frame*/
- stq pv,1*8(sp) /* store pv of caller */
- stq zero,0*8(sp) /*builtin (invisible) function */
- jsr ra,asm_prepare_native_stackinfo /* puts 2 additional quadwords on stack */
- ldgp gp,0(ra)
-
- ldq a2,utf_void__java_lang_Throwable
- ldq a1,utf_fillInStackTrace
- ldq t0,6*8(sp)
- ldq t1,offobjvftbl(t0)
- ldq a0,offclass(t1)
- jsr ra,class_resolvemethod
- ldgp gp,0(ra)
- /* now we have the method */
-
- /*refillin */
- mov v0,a0
- ldq a1,6*8(sp)
- jsr ra,asm_calljavafunction
- ldgp gp,0(ra)
-
- /*remove frame*/
- jsr ra,asm_remove_native_stackinfo
- ldgp gp,0(ra)
-
-
- /*finish*/
- ldq xpc,0(sp)
- ldq xptr,1*8(sp)
- ldq pv,2*8(sp)
- lda sp,3*8(sp)
- br asm_handle_exception
-
- .end asm_refillin_and_handle_exception
-
-/****** function asm_throw_and_handle_arrayindexoutofbounds_exception **********
-* *
-* This function handles an exception. It does not use the usual calling *
-* conventions. The integer parameter 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); *
-* *
-*******************************************************************************/
-
- .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 */
- addq t0,ra,pv /* compute update address */
- 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_throw_and_handle_arrayindexoutofbounds_exception_cont
- 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 */
- 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)
-
- 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*/
-
- 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
-
- .end asm_throw_and_handle_arrayindexoutofbounds_exception
-
-
-/* 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
- sra t0,48,t0 /* isolate offset */
- addq t0,ra,pv /* compute update address */
- 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_throw_and_handle_arithmetic_exception_cont
- 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 */
- addq t0,pv,pv /* compute update address */
-
-asm_throw_and_handle_arithmetic_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) /*exception string 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)
-
- jsr ra,new_arithmeticexception
- ldgp gp,0(ra)
- mov v0,itmp1 /*itmp1 is not touched in asm_remove_native_stackinfo*/
-
- 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
-
- .end asm_throw_and_handle_arithmetic_exception
-
-
-/* asm_throw_and_handle_exception **********************************************
-
- DOCUMENT ME!!!
-
-*******************************************************************************/
-
- .ent asm_throw_and_handle_nat_exception
-
-asm_throw_and_handle_nat_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 */
- addq t0,ra,pv /* compute update address */
- 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_throw_and_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 */
- addq t0,pv,pv /* compute update address */
-
- .aent asm_throw_and_handle_exception
-
-asm_throw_and_handle_exception:
- mov sp,t0
- lda sp,-6*8(sp) /* prepare stackframe */
- stq pv,5*8(sp) /* pv of failure */
- stq xptr,4*8(sp) /* classname 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) */
- /* puts 2 additional quadwords on stack */
-
- br ra,L_asm_throw_and_handle_exception_load_gp
-L_asm_throw_and_handle_exception_load_gp:
- ldgp gp,0(ra) /* load gp (it's not set correctly in jit) */
-
- jsr ra,asm_prepare_native_stackinfo
- ldgp gp,0(ra)
-
- ldq a0,6*8(sp) /* classname of exception */
- jsr ra,new_exception
- ldgp gp,0(ra)
-
- mov v0,xptr /* xptr (itmp1) is not touched in */
- /* asm_remove_native_stackinfo */
-
- 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
-
- .end asm_throw_and_handle_nat_exception
-
-