* src/vm/jit/s390/arch.h (JIT_COMPILER_VIA_SIGNAL): defined.
authorPeter Molnar <pm@complang.tuwien.ac.at>
Wed, 24 Oct 2007 21:30:39 +0000 (21:30 +0000)
committerPeter Molnar <pm@complang.tuwien.ac.at>
Wed, 24 Oct 2007 21:30:39 +0000 (21:30 +0000)
* src/vm/jit/s390/asmpart.S (asm_call_jit_compiler): removed.
* src/vm/jit/s390/codegen.c (codegen_emit_stub_compiler): removed.
* src/vm/jit/s390/emit.c (emit_trap_compiler): new function.
* src/vm/jit/s390/md.c (md_signal_handler_sigill): adapted for compiler call via signal.

src/vm/jit/s390/arch.h
src/vm/jit/s390/asmpart.S
src/vm/jit/s390/codegen.c
src/vm/jit/s390/emit.c
src/vm/jit/s390/md.c

index 14626e8f6d23955661e3a6d02b39626db63c5b61..1ec084914b51d266b2bdca94c431c77473074b80 100644 (file)
 /* #define HAS_4BYTE_STACKSLOT */
 #define SUPPORT_COMBINE_INTEGER_REGISTERS
 
+#define JIT_COMPILER_VIA_SIGNAL
+
 #endif /* _ARCH_H */
 
 
index 9026e5236199dd0b36d3318e7e555627b64c6534..48c31fb8af2aa5c2b755954690f7e7c2232b27c7 100644 (file)
@@ -47,8 +47,6 @@
        .globl asm_vm_call_method_exception_handler
        .globl asm_vm_call_method_end
 
-       .globl asm_call_jit_compiler
-
        .globl asm_handle_exception
        .globl asm_handle_nat_exception
 
@@ -194,83 +192,6 @@ asm_vm_call_method_exception_handler:
 asm_vm_call_method_end:
        brc   0,0       
 
-/****************** function asm_call_jit_compiler *****************************
-*                                                                              *
-*   invokes the compiler for untranslated JavaVM methods.                      *
-*                                                                              *
-*   itmp3: methodinfo pointer                                                  *
-*   itmp1: method pointer                                                      *
-*                                                                              *
-*******************************************************************************/
-
-/*
-
-argument registers: arguments (like in JIT)
-
-        arguments on stack (like in JIT)
-------------------------------------------------------------- <- SP on entry
-
-        saved return address                                           \
-        stored volatile (in terms of C ABI) floag argument registers   | 
-96      stored volatile (in terms of C ABI) integer argument registers | ACJC_STACKFRAME
-0 - 96  register save area (C ABI)                                     /
--------------------------------------------------- <- SP for jit_asm_compile
-*/
-
-/* This is called from a compiler stub.
- * Arguments are already in registers and the stack is setup like in CACAO.
- */
-
-asm_call_jit_compiler:
-L_asm_call_jit_compiler:
-
-#      define ACJC_STACKFRAME ((2 * 4) + (4 * 4) + (2 * 8) + 96)
-
-       ahi     sp,-ACJC_STACKFRAME        /* allocate stack space */
-
-       stm         %r2,%r5,96(sp)             /* store volatile int arg regs */
-       std     %f0,96+16(sp)              /* store volatile float arg regs */
-       std     %f2,96+24(sp)              
-       st      %r12,96+32(sp)             /* store %r12, used as GOT pointer */
-       st      %r14,96+36(sp)             /* store return address */
-
-       /* load arguments */
-
-       lr      a0,itmp3                   /* pass methodinfo pointer            */
-       lr      a1,mptr                    /* pass method pointer                */
-       la      a2,ACJC_STACKFRAME(sp)     /* pass java sp                       */
-       la      a3,0(%r14)                 /* pass return address, make sure bit 32 is 0 */
-
-       CALL_PIC(jit_asm_compile, acjc)
-
-       lr      pv, v0                     /* save return value */
-
-       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 */
-
-       ltr     pv,pv
-       je      L_asm_call_jit_compiler_exception
-
-       l       %r12,96+32(sp)             /* restore %r12 */
-       l       %r14,96+36(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:
-
-       CALL_PIC(exceptions_get_and_clear_exception, acjce)
-
-       lr      xptr, %r2
-       l       xpc,96+36(sp)              /* restore return address */
-       l       %r12,96+32(sp)             /* restore %r12 */
-       ahi     sp, ACJC_STACKFRAME        /* remove stack frame */
-       j       L_asm_handle_nat_exception
-
-
 /* asm_handle_exception ********************************************************
 *                                                                              *
 *   This function handles an exception. It does not use the usual calling      *
index 79001bdbf2ecda9cdf437634dcc6129c414f545a..f6f1d2d6b125412e43bd2f8b8f2f6549c66ebf4a 100644 (file)
@@ -3458,36 +3458,6 @@ gen_method:
        return true;
 }
 
-
-/* codegen_emit_stub_compiler **************************************************
-
-   Emits a stub routine which calls the compiler.
-       
-*******************************************************************************/
-
-void codegen_emit_stub_compiler(jitdata *jd)
-{
-       methodinfo  *m;
-       codegendata *cd;
-
-       /* get required compiler data */
-
-       m  = jd->m;
-       cd = jd->cd;
-
-       /* code for the stub */
-
-       /* don't touch ITMP2 as it cointains the return address */
-
-       M_AADD_IMM(N_PV_OFFSET, REG_PV); /* suppress negative displacements */
-
-       /* REG_METHODPTR (REG_ITMP1) already used */
-       M_ILD_DSEG(REG_ITMP3, -2 * SIZEOF_VOID_P); /* methodinfo  */
-       M_ILD_DSEG(REG_PV, -3 * SIZEOF_VOID_P); /* compiler pointer */
-       N_BR(REG_PV);
-}
-
-
 /* codegen_emit_stub_native ****************************************************
 
    Emits a stub routine which calls a native method.
index c7d5c0bf5281f85e2db75408c833fb47c941b8ef..51f74648f3e499ac082de57481d129329cefe2fe 100644 (file)
@@ -800,6 +800,17 @@ void emit_restore_pv(codegendata *cd) {
        }
 }
 
+/* emit_trap_compiler **********************************************************
+
+   Emit a trap instruction which calls the JIT compiler.
+
+*******************************************************************************/
+
+void emit_trap_compiler(codegendata *cd)
+{
+       M_ILL2(REG_METHODPTR, EXCEPTION_HARDWARE_COMPILER);
+}
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index 431b6e9e26bfdbbc04adbaf845183ce5a7e5851d..626f382349d2a094da487cd131ea13722a6b67f8 100644 (file)
@@ -236,17 +236,38 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
                sp = (u1 *)_mc->gregs[REG_SP];
                val = (ptrint)_mc->gregs[reg];
 
+               if (EXCEPTION_HARDWARE_COMPILER == type) {
+                       /* The PV from the compiler stub is equal to the XPC. */
+
+                       pv = xpc;
+
+                       /* The return address in is REG_RA */
+
+                       ra = (u1 *)_mc->gregs[REG_RA];
+               }
+
                /* Handle the type. */
 
                p = signal_handle(type, val, pv, sp, ra, xpc, _p);
 
-               if (p != NULL) {
-                       _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) p;
-                       _mc->gregs[REG_ITMP1_XPC]  = (intptr_t) xpc;
-                       _mc->psw.addr              = (intptr_t) asm_handle_exception;
-               }
-               else {
-                       _mc->psw.addr              = (intptr_t) xpc;
+               if (EXCEPTION_HARDWARE_COMPILER == type) {
+                       if (NULL == p) {
+                               _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) builtin_retrieve_exception();
+                               _mc->gregs[REG_ITMP1_XPC]  = (intptr_t) xpc;
+                               _mc->psw.addr              = (intptr_t) asm_handle_exception;
+                       } else {
+                               _mc->gregs[REG_PV]         = (intptr_t) p;
+                               _mc->psw.addr              = (intptr_t) p;
+                       }
+               } else {
+                       if (p != NULL) {
+                               _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) p;
+                               _mc->gregs[REG_ITMP1_XPC]  = (intptr_t) xpc;
+                               _mc->psw.addr              = (intptr_t) asm_handle_exception;
+                       }
+                       else {
+                               _mc->psw.addr              = (intptr_t) xpc;
+                       }
                }
        } else {
 #if !defined(NDEBUG)