Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 8210 2007-07-18 12:51:00Z twisti $
-
*/
.globl asm_vm_call_method_end
.globl asm_vm_call_method_exception_handler
-.globl asm_call_jit_compiler
-
-.globl asm_patcher_wrapper
-
.globl asm_abstractmethoderror
.globl asm_handle_exception
*/
/* this is the method header see src/vm/jit/methodheader.h */
+
.align 4
- .long 0 /* catch type all */
- .long 0 /* handler pc */
- .long 0 /* end pc */
- .long 0 /* start pc */
- .long 1 /* extable size */
- .long 0 /* line number table start */
- .long 0 /* line number table size */
+
.long 0 /* fltsave */
.long 0 /* intsave */
.long 0 /* isleaf */
- .long 0 /* IsSync */
.long 0 /* frame size */
.long 0 /* codeinfo pointer */
movel %sp@(12*4+2*4),%a2 /* arg array */
movel %sp@(12*4+3*4),%d2 /* arg count */
- movel %a3, %sp@(12*4) /* copy method address to stackslot */
- leal %sp@(12*4), %a3 /* and store that address in %a3 */
+ movel %a3, %sp@(11*4) /* copy method address to stackslot */
+ leal %sp@(11*4), %a3 /* and store that address in %a3 */
#else
addal #(-12*4-6*8), %sp
moveml %d2/%d3/%d4/%d5/%d6/%d7/%a2/%a3/%a4/%a5/%fp,%sp@ /* save registers */
jmp L_asm_vm_call_method_return
-/* asm_call_jit_compiler ************************************************************************************
- * Invokes compiler for untranslated java methods.
- * C prototype: void asm_call_jit_compiler(void);
- * BUT: this does not match reality, arguments _ARE_ passed via createcompilerstub and asm_vm_call_method...
- * arguments passed via %a2(methodinfo) == REG_ATMP1
- * %a3(mptr) == REG_ATMP2
- ************************************************************************************************************/
-asm_call_jit_compiler:
- addal #(-4*4),%sp /* create stackframe to save registers */
- moveml %a0/%a1/%d0/%d1,%sp@ /* save volatile registers */
-#if !defined(ENABLE_SOFTFLOAT)
- addal #-8*2, %sp
- fmovemd %fp0/%fp1, %sp@
- movel %sp@(8*4), %sp@-
- pea %sp@(8*4+8)
-#else
- movel %sp@(4*4), %sp@- /* push arguments onto stack (ra)*/
- pea %sp@(4*4+8) /* the old stack pointer*/
-#endif
- movel %a3,%sp@- /* mptr */
- movel %a2,%sp@- /* methodinfo */
-
- /* C prototype: u1 *jit_asm_compile(methodinfo *m, u1 *mptr, u1 *sp, u1 *ra); */
- jsr jit_asm_compile /* invoke compiler */
- addal #(4*4),%sp /* pop arguments off stack */
- moveal %d0, %a2 /* to tmp register */
-
-#if !defined(ENABLE_SOFTFLOAT)
- fmovemd %sp@, %fp0/%fp1
- addal #8*2, %sp
-#endif
-
- moveml %sp@,%a0/%a1/%d0/%d1 /* restore volatile registers */
- addal #(4*4),%sp /* remove stackframe */
-
- tstl %a2 /* check for exception */
- beq L_asm_call_jit_compiler_exception
-
- jmp %a2@ /* invoke java method */
- jsr 0 /* we should not ever return here */
-
-L_asm_call_jit_compiler_exception:
- jsr exceptions_get_and_clear_exception /* exception object in %d0 now */
- moveal %d0, %a2 /* move exception object into sptr register */
- moveal %sp@+, %a3 /* pop return address into exception address reg */
- jmp asm_handle_exception /* handle exception */
-
-
-/* asm_patcher_wrapper ********************************************************
-
- prepares arguments on stack
- calls patcher_wrapper signature: java_objectheader *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra);
-
- Stack layout:
- 24 return address
- 20 REG_ITMP3
- 16 pointer to virtual java_objectheader
- 12 last byte of machine code (xmcode)
- 8 machine code (which is patched back later)
- 4 unresolved field reference
- 0 patcher function pointer to call
-*******************************************************************************/
-asm_patcher_wrapper:
-
- /* save scratch registers */
- movel %a0, %sp@-
- movel %a1, %sp@-
- movel %d0, %sp@-
- movel %d1, %sp@-
-
-#if defined(ENABLE_SOFTFLOAT)
- /* calculate original value of sp */
- movel %sp, %d0
- addil #4*4, %d0
-#else
- addal #-8*2, %sp
- fmovemd %fp0/%fp1, %sp@
-
- movel %sp, %d0
- addil #8*4, %d0
-#endif
-
- clrl %sp@- /* pass ra */
- clrl %sp@- /* pass pv, if null use findmethod */
- movel %d0, %sp@- /* pass sp of patcher stub */
- jsr patcher_wrapper /* return value in %d0 */
-
- lea %sp@(3*4), %sp /* pop arguments off stack */
- tst %d0 /* test if exception occured */
- bne L_asm_patcher_wrapper_exception
-
-#if !defined(ENABLE_SOFTFLOAT)
- fmovemd %sp@, %fp0/%fp1
- addal #8*2, %sp
-#endif
- movel %sp@+, %d1
- movel %sp@+, %d0
- movel %sp@+, %a1
- movel %sp@+, %a0
-
- lea %sp@(6*4), %sp /* restore stack and remove patcher stub*/
- rts /* back to jit code */
-
-L_asm_patcher_wrapper_exception:
- /* WARNING: the stack is still disturbed, look at asm_patcher_wrapper for details */
- /* we do not need to restore the content of the registers, I hope */
-#if !defined(ENABLE_SOFTFLOAT)
- lea %sp@(8*4), %sp
-#else
- lea %sp@(4*4), %sp
-#endif
-
- lea %sp@(5*4), %sp /* restore stack and remove patcher stub*/
- movel %sp@+, %d4 /* restore REG_ITMP3, stored in emit_patcher_stubs */
- moveal %d0, %a2 /* xptr, pointer to exception object */
- moveal %sp@+, %a3 /* pop return address into exception address register */
- jmp asm_handle_exception /* handle exception */
- illegal /* XXX: we never come back */
-
-
asm_abstractmethoderror:
/* asm_handle_exception ********************************************************
/* we need the dseg, figure it out */
movel %a3, %sp@- /* push ra argument */
- jsr md_codegen_get_pv_from_pc /* pv in %d0 now */
+ jsr md_asm_codegen_get_pv_from_pc /* pv in %d0 now */
movel %d0, %d2 /* move to safe register */
lea %sp@(4), %sp /* pop args off stack */