-/* asm_call_jit_compiler *******************************************************
-
- Invokes the compiler for untranslated JavaVM methods.
-
- Register R0 contains a pointer to the method info structure (prepared
- by createcompilerstub). Using the return address in R26 and the
- offset in the LDA instruction or using the value in methodptr R28 the
- patching address for storing the method address can be computed:
-
- Method address was either loaded using
-
- i386_mov_imm_reg(a, REG_ITMP2) ; invokestatic/special
- i386_call_reg(REG_ITMP2)
-
- or
-
- i386_mov_membase_reg(REG_SP, 0, REG_ITMP1) ; invokevirtual/interface
- i386_mov_membase_reg(REG_ITMP1, OFFSET(, vftbl), REG_ITMP2)
- i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + \
- sizeof(methodptr) * m->vftblindex, REG_ITMP1)
- i386_call_reg(REG_ITMP1)
-
- In the static case the method pointer can be computed using the
- return address and the lda function following the jmp instruction.
-
-*******************************************************************************/
-
-asm_call_jit_compiler:
-L_asm_call_jit_compiler: /* required for PIC code */
- sub $((4+2)*4+sizestackframeinfo),sp /* create stack frame */
- mov itmp1,(4+0)*4(sp) /* save method pointer */
-
- mov (4+2)*4+sizestackframeinfo(sp),itmp3 /* get return address */
- mov -1(itmp3),itmp1b /* get function code */
- cmp $0xd1,itmp1b /* called with `call *REG_ITMP2'? */
- jne L_not_static_special
-
- sub $6,itmp3 /* calculate address of immediate */
- jmp L_call_jit_compile
-
-L_not_static_special:
- cmp $0xd0,itmp1b /* called with `call *REG_ITMP1' */
- jne L_not_virtual_interface
-
- sub $6,itmp3 /* calculate address of offset */
- mov (itmp3),itmp3 /* get offset */
- add itmp2,itmp3 /* add base address to get method adr */
- jmp L_call_jit_compile
-
-L_not_virtual_interface:
- xor itmp3,itmp3 /* a call from asm_calljavafunction */
-
-L_call_jit_compile:
- mov itmp3,(4+1)*4(sp) /* save address for method pointer */
-
- mov sp,itmp1 /* create stackframe info */
- add $((4+2)*4),itmp1
- mov itmp1,0*4(sp) /* stackframeinfo pointer */
- movl $0,1*4(sp) /* if pv is NULL, use findmethod */
- mov sp,itmp2
- add $((1+4+2)*4+sizestackframeinfo),itmp2 /* pass java sp */
- mov itmp2,2*4(sp)
- mov ((0+4+2)*4+sizestackframeinfo)(sp),itmp3 /* pass java ra */
- mov itmp3,3*4(sp)
- call stacktrace_create_inline_stackframeinfo
-
- mov (4+0)*4(sp),itmp1 /* pass method pointer */
- mov itmp1,0*4(sp)
- call jit_compile
- mov v0,(4+0)*4(sp) /* save return value */
-
- mov sp,itmp1 /* remove stackframe info */
- add $((4+2)*4),itmp1
- mov itmp1,0*4(sp) /* stackframeinfo pointer */
- call stacktrace_remove_stackframeinfo
-
- mov (4+0)*4(sp),v0 /* restore return value */
- mov (4+1)*4(sp),itmp3 /* restore address for method pointer */
-
- add $((4+2)*4+sizestackframeinfo),sp /* remove stack frame */
-
- test v0,v0 /* check for exception */
- je L_asm_call_jit_compiler_exception
-
- test itmp3,itmp3 /* was this a JIT call? */
- je L_call_method
-
- mov v0,(itmp3) /* save the new method pointer */
-
-L_call_method:
- jmp *v0 /* ...and now call the new method */
-
-L_asm_call_jit_compiler_exception:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
- call builtin_asm_get_exceptionptrptr
- mov v0,itmp2 /* v0 == itmp1 */
-#else
- lea _exceptionptr,itmp2
-#endif
- mov (itmp2),xptr /* get the exception pointer */
- movl $0,(itmp2) /* clear the exception pointer */
-
- pop xpc /* get return address */
- sub $2,xpc /* faulting address is ra - 2 */
- jmp L_asm_handle_exception
-
-