* src/vm/jit/codegen-common.c (codegen_generate_stub_compiler): New
authortwisti <none@none>
Thu, 12 Apr 2007 12:45:10 +0000 (12:45 +0000)
committertwisti <none@none>
Thu, 12 Apr 2007 12:45:10 +0000 (12:45 +0000)
function.

* src/vm/jit/codegen-common.h (createcompilerstub): Removed.
(codegen_generate_stub_compiler): Added.
* src/vm/jit_interface.h: Likewise.
* src/cacaoh/dummy.c: Likewise.

* src/vmcore/linker.c (link_class_intern): Replaced createcompilerstub
with codegen_generate_stub_compiler.

* src/vm/jit/alpha/codegen.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/s390/codegen.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/x86_64/codegen.c (COMPILERSTUB_DATASIZE)
(COMPILERSTUB_SIZE): Removed.
(createcompilerstub): Renamed to codegen_emit_stub_compiler and
changed signature.

* src/vm/jit/alpha/codegen.h,
src/vm/jit/arm/codegen.h,
src/vm/jit/i386/codegen.h,
src/vm/jit/m68k/codegen.h,
src/vm/jit/mips/codegen.h,
src/vm/jit/powerpc/codegen.h,
src/vm/jit/powerpc64/codegen.h,
src/vm/jit/s390/codegen.h,
src/vm/jit/sparc64/codegen.h,
src/vm/jit/x86_64/codegen.h (COMPILERSTUB_CODESIZE): Added.

25 files changed:
src/cacaoh/dummy.c
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/codegen.h
src/vm/jit/arm/codegen.c
src/vm/jit/arm/codegen.h
src/vm/jit/codegen-common.c
src/vm/jit/codegen-common.h
src/vm/jit/i386/codegen.c
src/vm/jit/i386/codegen.h
src/vm/jit/m68k/codegen.c
src/vm/jit/m68k/codegen.h
src/vm/jit/mips/codegen.c
src/vm/jit/mips/codegen.h
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/codegen.h
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/codegen.h
src/vm/jit/s390/codegen.c
src/vm/jit/s390/codegen.h
src/vm/jit/sparc64/codegen.c
src/vm/jit/sparc64/codegen.h
src/vm/jit/x86_64/codegen.c
src/vm/jit/x86_64/codegen.h
src/vm/jit_interface.h
src/vmcore/linker.c

index 6356d0f46b419d9986b2717e3f05d29817cde18c..9c307db32d32f0d01e8b78af4708f729f0cfe94c 100644 (file)
@@ -150,12 +150,12 @@ methodinfo *code_get_methodinfo_for_pv(u1 *pv)
 
 /* codegen ********************************************************************/
 
-codeinfo *codegen_createnativestub(functionptr f, methodinfo *m)
+u1 *codegen_generate_stub_compiler(methodinfo *m)
 {
        return NULL;
 }
 
-u1 *createcompilerstub(methodinfo *m)
+codeinfo *codegen_createnativestub(functionptr f, methodinfo *m)
 {
        return NULL;
 }
index e8e29f9d8e45d271ad447ac110e97a60adff2c24..c5980340aa9c4600481f0bb6c56aea85cf64ce7b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -3119,62 +3119,27 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emits a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    3 * 4
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;              /* code generation pointer            */
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
-
-       /* The codeinfo pointer is actually a pointer to the
-          methodinfo. This fakes a codeinfo structure. */
+       /* get required compiler data */
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       m  = jd->m;
+       cd = jd->cd;
 
        /* code for the stub */
 
        M_ALD(REG_ITMP1, REG_PV, -2 * 8);   /* load codeinfo pointer              */
        M_ALD(REG_PV, REG_PV, -3 * 8);      /* load pointer to the compiler       */
        M_JMP(REG_ZERO, REG_PV);            /* jump to the compiler               */
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index fb60d38f617914493e68f5c382ee6c5d4440579f..cf6b20901d35ec11f9674c28332fa5f32c8f903e 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    3 * 4
+
+
 /* macros to create code ******************************************************/
 
 #define REG   0
index 147798f55d79eda9aca29e7c83dc59dbfc07e75a..32b26b4e80db35e5d6eeb67a79a06eb088e718e0 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -2837,65 +2837,26 @@ bool codegen_emit(jitdata *jd)
 }
 
 
-/* createcompilerstub **********************************************************
-
-   creates a stub routine which calls the compiler
+/* codegen_emit_stub_compiler **************************************************
 
+   Emits a stub routine which calls the compiler.
+       
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    2 * 4
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;              /* code generation pointer            */
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
+       /* get required compiler data */
 
-       /* The codeinfo pointer is actually a pointer to the
-          methodinfo. This fakes a codeinfo structure. */
-       
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       m  = jd->m;
+       cd = jd->cd;
 
        /* code for the stub */
 
        M_LDR_INTERN(REG_ITMP1, REG_PC, -(2 * 4 + 2 * SIZEOF_VOID_P));
        M_LDR_INTERN(REG_PC, REG_PC, -(3 * 4 + 3 * SIZEOF_VOID_P));
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE * 4;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       /* synchronize instruction and data cache */
-
-       md_cacheflush(s, cd->mcodeptr - (u1 *) d);
-
-       return s;
 }
 
 
index bd7ea006c6b5bbb304255657a42778fbe599bbe8..6ef5437145bfd3498fc0646a690f7f5fc1b90f16 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Michael Starzinger
-            Christian Thalinger
-
-   $Id: codegen.h 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    2 * 4
+
+
 /* lazy debugger **************************************************************/
 
 #if !defined(NDEBUG)
index c268be2d272e7cdfabed9cf4d3a784c6fdc1c33c..5622d4e842ac5265a442d2f8033e5341581f83ec 100644 (file)
@@ -39,7 +39,7 @@
    memory. All functions writing values into the data area return the offset
    relative the begin of the code area (start of procedure).   
 
-   $Id: codegen-common.c 7684 2007-04-11 08:11:49Z twisti $
+   $Id: codegen-common.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -943,6 +943,82 @@ void codegen_finish(jitdata *jd)
 }
 
 
+/* codegen_generate_stub_compiler **********************************************
+
+   Wrapper for codegen_emit_stub_compiler.
+
+   Returns:
+       pointer to the compiler stub code.
+
+*******************************************************************************/
+
+u1 *codegen_generate_stub_compiler(methodinfo *m)
+{
+       jitdata     *jd;
+       codegendata *cd;
+       ptrint      *d;                     /* pointer to data memory             */
+       u1          *c;                     /* pointer to code memory             */
+       s4           dumpsize;
+
+       /* mark dump memory */
+
+       dumpsize = dump_size();
+
+       /* allocate required data structures */
+
+       jd = DNEW(jitdata);
+
+       jd->m     = m;
+       jd->cd    = DNEW(codegendata);
+       jd->flags = 0;
+
+       /* get required compiler data */
+
+       cd = jd->cd;
+
+       /* allocate code memory */
+
+       c = CNEW(u1, 3 * SIZEOF_VOID_P + COMPILERSTUB_CODESIZE);
+
+       /* set pointers correctly */
+
+       d = (ptrint *) c;
+
+       cd->mcodebase = c;
+
+       c = c + 3 * SIZEOF_VOID_P;
+       cd->mcodeptr = c;
+
+       /* NOTE: The codeinfo pointer is actually a pointer to the
+          methodinfo (this fakes a codeinfo structure). */
+
+       d[0] = (ptrint) asm_call_jit_compiler;
+       d[1] = (ptrint) m;
+       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+
+       /* call the emit function */
+
+       codegen_emit_stub_compiler(jd);
+
+#if defined(ENABLE_STATISTICS)
+       if (opt_stat)
+               count_cstub_len += 3 * SIZEOF_VOID_P + COMPILERSTUB_CODESIZE;
+#endif
+
+       /* flush caches */
+
+       md_cacheflush(cd->mcodebase, 3 * SIZEOF_VOID_P + COMPILERSTUB_CODESIZE);
+
+       /* release dump memory */
+
+       dump_release(dumpsize);
+
+       /* return native stub code */
+
+       return c;
+}
+
+
 /* codegen_createnativestub ****************************************************
 
    Wrapper for createnativestub.
index 11612d10b242aee4682cc5d965612f189c38bc07..47527769e2c3199a2ab561532c50360022b26e3f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen-common.h 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen-common.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -314,11 +314,12 @@ codeinfo *codegen_createnativestub(functionptr f, methodinfo *m);
 void codegen_disassemble_nativestub(methodinfo *m, u1 *start, u1 *end);
 #endif
 
-void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra);
-java_objectheader *codegen_finish_native_call(u1 *datasp);
+/* stub functions */
+
+u1   *codegen_generate_stub_compiler(methodinfo *m);
+u1   *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd);
 
-u1 *createcompilerstub(methodinfo *m);
-u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd);
+void  codegen_emit_stub_compiler(jitdata *jd);
 
 #if defined(ENABLE_INTRP)
 u1 *intrp_createcompilerstub(methodinfo *m);
@@ -328,6 +329,9 @@ u1 *intrp_createnativestub(functionptr f, jitdata *jd, methoddesc *md);
 void removecompilerstub(u1 *stub);
 void removenativestub(u1 *stub);
 
+void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra);
+java_objectheader *codegen_finish_native_call(u1 *datasp);
+
 s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum);
 s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum);
 
index 638684c44d82c3bc0dd597eabb6064d304ee6db1..5c3574c3671139cdb629f39802508dfd693cf8d9 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -3691,62 +3691,28 @@ void cg_move(codegendata *cd, s4 type, s4 src_regoff, s4 src_flags,
 }
 #endif /* defined(ENABLE_SSA) */
 
-/* createcompilerstub **********************************************************
 
-   Creates a stub routine which calls the compiler.
+/* codegen_emit_stub_compiler **************************************************
+
+   Emit a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    12
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
-
-       /* The codeinfo pointer is actually a pointer to the
-          methodinfo. This fakes a codeinfo structure. */
+       /* get required compiler data */
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       m  = jd->m;
+       cd = jd->cd;
 
        /* code for the stub */
 
-       M_MOV_IMM(m, REG_ITMP1);            /* method info                        */
+       M_MOV_IMM(m, REG_ITMP1);
        M_MOV_IMM(asm_call_jit_compiler, REG_ITMP3);
        M_JMP(REG_ITMP3);
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-       
-       return s;
 }
 
 
index ccd69f58c5590d16b2a20059e634d45b4cdff6af..114d7c05823fcf4d49c6d8f33856fbf8ebed1ea1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    12
+
+
 /* macros to create code ******************************************************/
 
 #define M_ILD(a,b,disp)         emit_mov_membase_reg(cd, (b), (disp), (a))
index 844ed7825bd377764bc1bcabd2061bd30a9325cc..13507cb788182d4a9d8e6d2d2f0883302c5c71cb 100644 (file)
@@ -23,6 +23,7 @@
    02110-1301, USA.
 
    $Id: codegen.c 7564 2007-03-23 23:36:17Z twisti $
+
 */
 
 
@@ -1906,6 +1907,32 @@ nowperformreturn:
        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 */
+
+       M_AMOV_IMM(m, REG_ATMP1);
+       M_AMOV_IMM(asm_call_jit_compiler, REG_ATMP3);
+       M_JMP_IMM(asm_call_jit_compiler);
+       M_RET;
+}
+
+
 /* createnativestub ************************************************************
 
    Creates a stub routine which calls a native method.
@@ -2118,53 +2145,3 @@ u1* createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        return code->entrypoint;
 }
-
-/* createcompilerstub **********************************************************
-
-   Creates a stub routine which calls the compiler.
-       
-*******************************************************************************/
-
-#define COMPILERSTUB_DATASIZE (3 * SIZEOF_VOID_P)
-#define COMPILERSTUB_CODESIZE (6+6+6+2)
-#define COMPILERSTUB_SIZE (COMPILERSTUB_DATASIZE +  COMPILERSTUB_CODESIZE)
-u1* createcompilerstub(methodinfo *m) 
-{ 
-       u1          *s;
-       ptrint      *d;
-       codegendata *cd;
-       s4          dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-       
-       /* set data and code pointer */
-       d = (ptrint *)s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-       dumpsize = dump_size();
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
-
-       /* Store codeinfo pointer in the same place as in the
-        * methodheader for compiled methods */
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];          /* fake code->m */
-
-       M_AMOV_IMM(m, REG_ATMP1);
-       M_AMOV_IMM(asm_call_jit_compiler, REG_ATMP3);
-       M_JMP_IMM(asm_call_jit_compiler);
-       M_RET;
-       
-       md_cacheflush((u1 *) d, COMPILERSTUB_SIZE);
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-       dump_release(dumpsize);
-
-       return s;
-}
index 736707d573cbaf73058851bcef0cffa7c47fed33..90d42e0169e74dd46f4e4e519a6999236872f075 100644 (file)
@@ -45,8 +45,7 @@
     } while (0)
 
 
-#define PATCHER_NOPS \
-       do { M_TPFL; M_TPF; M_TPF } while (0);
+/* branch defines *************************************************************/
 
 #define BRANCH_NOPS \
     do { \
     } while (0)
 
 
+/* patcher defines ************************************************************/
+
+#define PATCHER_NOPS \
+       do { M_TPFL; M_TPF; M_TPF } while (0);
+
+
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE (6+6+6+2)
+
+
 /* coldfire instruction format:
  * -----------------------------
  * | Op Word                    |
index 637de3856fb5485aa6ad49568e7480c2bb90b0a3..aad9984e6b94a89ecc9ea60af83ced3a8b960041 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7682 2007-04-10 21:24:14Z twisti $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -3719,63 +3719,28 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emits a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    4 * 4
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
+       /* get required compiler data */
 
-       /* The codeinfo pointer is actually a pointer to the
-          methodinfo. This fakes a codeinfo structure. */
+       m  = jd->m;
+       cd = jd->cd;
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       /* code for the stub */
 
        M_ALD_INTERN(REG_ITMP1, REG_PV, -2 * SIZEOF_VOID_P);  /* codeinfo pointer */
        M_ALD_INTERN(REG_PV, REG_PV, -3 * SIZEOF_VOID_P);  /* pointer to compiler */
        M_JMP(REG_PV);
        M_NOP;
-
-       md_cacheflush(s, (s4) (cd->mcodeptr - (u1 *) d));
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index 24e2cb9767a5d5742fa14ad4d79d2210157c2715..b305542804bd84b5078fde28bdf252b92c734b4f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 7677 2007-04-09 11:51:25Z twisti $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    4 * 4
+
+
 /* macros to create code ******************************************************/
 
 /* code generation macros operands:
index e1a10ca9216eeddeed3b0302a10261c17035c7c5..b7aa80a349011eb8d01558e424024a87d8f63481 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -2974,63 +2974,28 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emits a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    4 * 4
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
+       /* get required compiler data */
 
-       /* The codeinfo pointer is actually a pointer to the
-          methodinfo. This fakes a codeinfo structure. */
+       m  = jd->m;
+       cd = jd->cd;
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       /* code for the stub */
 
        M_ALD_INTERN(REG_ITMP1, REG_PV, -2 * SIZEOF_VOID_P);
        M_ALD_INTERN(REG_PV, REG_PV, -3 * SIZEOF_VOID_P);
        M_MTCTR(REG_PV);
        M_RTS;
-
-       md_cacheflush((u1 *) d, COMPILERSTUB_SIZE);
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index 01c32ba66eb4b1c0990ef7aa2e29af6b715b8b23..b7f4056aaa1a718492e9d40b138a5073d5ab01d5 100644 (file)
@@ -23,7 +23,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    4 * 4
+
+
 /* macros to create code ******************************************************/
 
 #define M_OP3(opcode,y,oe,rc,d,a,b) \
index baa30d41362a1f131864e6486161419e08d49852..3d7c0dc8a67a0522b3f496898e65bb2bbdd76c5f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7687 2007-04-11 16:39:22Z tbfg $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -2629,63 +2629,28 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emits a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    4 * 4
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
+       /* get required compiler data */
 
-       /* Store the codeinfo pointer in the same place as in the
-          methodheader for compiled methods. */
+       m  = jd->m;
+       cd = jd->cd;
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       /* code for the stub */
 
        M_ALD_INTERN(REG_ITMP1, REG_PV, -2 * SIZEOF_VOID_P);
        M_ALD_INTERN(REG_PV, REG_PV, -3 * SIZEOF_VOID_P);
        M_MTCTR(REG_PV);
        M_RTS;
-
-       md_cacheflush((u1 *) d, COMPILERSTUB_SIZE);
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index a049348fa2745dc264d97c83e262aebdad3ba06d..3159c16aabee6b7bb5c7c6de1101b3c9de3abdba 100644 (file)
@@ -1,7 +1,7 @@
 /* src/vm/jit/powerpc64/codegen.h - code generation macros and definitions for
                                  64-bit PowerPC
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 2007 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
@@ -30,7 +30,7 @@
             Christian Thalinger
             Christian Ullrich
 
-   $Id: codegen.h 7687 2007-04-11 16:39:22Z tbfg $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    4 * 4
+
+
 /* macros to create code ******************************************************/
 
 #define M_OP3(opcode,y,oe,rc,d,a,b) \
index 6880e972ff50573d502d6076eec3591b6a243655..29ba614f688e87be1a21bf46434c9e718e376765 100644 (file)
@@ -1,6 +1,6 @@
-/* src/vm/jit/x86_64/codegen.c - machine code generator for x86_64
+/* src/vm/jit/s390/codegen.c - machine code generator for s390
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 2007 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
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Andreas Krall
-            Christian Thalinger
-            Christian Ullrich
-            Edwin Steiner
-
-   $Id: codegen.c 7680 2007-04-10 05:02:20Z pm $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -3241,48 +3234,21 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emits a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    (3 * SIZEOF_VOID_P)
-#define COMPILERSTUB_CODESIZE    (SZ_AHI + SZ_L + SZ_L + SZ_BCR)
-
-#define COMPILERSTUB_SIZE        (COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE)
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
-       codeinfo    *code;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
 
-       dumpsize = dump_size();
-
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
-
-       /* Store the codeinfo pointer in the same place as in the
-          methodheader for compiled methods. */
-
-       code = code_codeinfo_new(m);
+       /* get required compiler data */
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) code;
+       m  = jd->m;
+       cd = jd->cd;
 
        /* code for the stub */
 
@@ -3294,17 +3260,6 @@ u1 *createcompilerstub(methodinfo *m)
        /* TODO where is methodpointer loaded into itmp2? is it already inside? */
        M_ILD(REG_PV, REG_PV, 0 * 4); /* compiler pointer */
        N_BR(REG_PV);
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index 3fa484793b1fc31f8871f145319954c2ce8823fc..8e4fa4ed3605296328856483fa20cb2e50a0b368 100644 (file)
@@ -1,6 +1,6 @@
-/* src/vm/jit/x86_64/codegen.h - code generation macros for x86_64
+/* src/vm/jit/s390/codegen.h - code generation macros for s390
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 2007 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
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Andreas Krall
-            Christian Thalinger
-
-   $Id: codegen.h 7680 2007-04-10 05:02:20Z pm $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
 
 #define PATCHER_NOPS_SKIP   12 
 
+
+ /* stub defines **************************************************************/
+
+#define COMPILERSTUB_CODESIZE    (SZ_AHI + SZ_L + SZ_L + SZ_BCR)
+
+
 /* *** BIG TODO ***
  * Make all this inline functions !!!!!!!!!!
  */
index a5d4732f1f4d32fd5011b9221cbec38743f37031..e7c8d765ef91320ed65a33e8fc1ccba878687ae0 100644 (file)
@@ -2913,66 +2913,29 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emits a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    4 * 4
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1     *s;                          /* memory to hold the stub            */
-       ptrint      *d;
-       codeinfo    *code;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-       
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
-
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
-       
-       /* Store the codeinfo pointer in the same place as in the
-          methodheader for compiled methods. */
 
-       code = code_codeinfo_new(m);
+       /* get required compiler data */
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) code;
+       m  = jd->m;
+       cd = jd->cd;
 
        /* code for the stub */
+
        /* no window save yet, user caller's PV */
        M_ALD_INTERN(REG_ITMP1, REG_PV_CALLER, -2 * SIZEOF_VOID_P);  /* codeinfo pointer */
        M_ALD_INTERN(REG_PV_CALLER, REG_PV_CALLER, -3 * SIZEOF_VOID_P);  /* pointer to compiler */
        M_JMP(REG_ZERO, REG_PV_CALLER, REG_ZERO);  /* jump to the compiler, RA is wasted */
        M_NOP;
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index 3978324a55638fd08eb730c4bdbd373b21348a1f..03bb05c12e2473a65aa5fcc791d63d776a71086a 100644 (file)
@@ -1,6 +1,7 @@
-/* vm/jit/sparc64/codegen.h - code generation macros and definitions for Sparc
+/* src/vm/jit/sparc64/codegen.h - code generation macros and definitions for
+                                  Sparc64
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 2007 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
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Andreas Krall
-            Reinhard Grafl
-            Alexander Jordan
-
-   Changes:
-
    $Id: codegen.h 4722 2006-04-03 15:36:00Z twisti $
 
 */
@@ -73,6 +66,11 @@ s4 nat_argintregs[INT_NATARG_CNT];
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    4 * 4
+
+
 /* additional functions and macros to generate code ***************************/
 
 
index 0ddd91b45c04af339de29cb7e4da6f24eb75574f..2a562c3e33ccb112c3050be2b66863dd4151d81b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -2910,62 +2910,27 @@ gen_method:
 }
 
 
-/* createcompilerstub **********************************************************
+/* codegen_emit_stub_compiler **************************************************
 
-   Creates a stub routine which calls the compiler.
+   Emit a stub routine which calls the compiler.
        
 *******************************************************************************/
 
-#define COMPILERSTUB_DATASIZE    3 * SIZEOF_VOID_P
-#define COMPILERSTUB_CODESIZE    7 + 7 + 3
-
-#define COMPILERSTUB_SIZE        COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
-
-
-u1 *createcompilerstub(methodinfo *m)
+void codegen_emit_stub_compiler(jitdata *jd)
 {
-       u1          *s;                     /* memory to hold the stub            */
-       ptrint      *d;
+       methodinfo  *m;
        codegendata *cd;
-       s4           dumpsize;
-
-       s = CNEW(u1, COMPILERSTUB_SIZE);
-
-       /* set data pointer and code pointer */
-
-       d = (ptrint *) s;
-       s = s + COMPILERSTUB_DATASIZE;
-
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
 
-       cd = DNEW(codegendata);
-       cd->mcodeptr = s;
-
-       /* The codeinfo pointer is actually a pointer to the
-          methodinfo. This fakes a codeinfo structure. */
+       /* get required compiler data */
 
-       d[0] = (ptrint) asm_call_jit_compiler;
-       d[1] = (ptrint) m;
-       d[2] = (ptrint) &d[1];                                    /* fake code->m */
+       m  = jd->m;
+       cd = jd->cd;
 
        /* code for the stub */
 
        M_ALD(REG_ITMP1, RIP, -(7 * 1 + 2 * SIZEOF_VOID_P));       /* methodinfo  */
        M_ALD(REG_ITMP3, RIP, -(7 * 2 + 3 * SIZEOF_VOID_P));  /* compiler pointer */
        M_JMP(REG_ITMP3);
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += COMPILERSTUB_SIZE;
-#endif
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return s;
 }
 
 
index 2e81403807bfd93b24d52c01424ef3643201efb2..ea29b9851debc3795e86e05c9b330579187ef8f3 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.h 7596 2007-03-28 21:05:53Z twisti $
+   $Id: codegen.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
     } while (0)
 
 
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE    7 + 7 + 3
+
+
 /* macros to create code ******************************************************/
 
 #define M_MOV(a,b)              emit_mov_reg_reg(cd, (a), (b))
index bc5cca4e1e3a9ab95bb3ba96c152b69a2a0e9e5b..28cc9f0e5e9ee95bca50e40e692ad1130a7473bf 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jit_interface.h 7486 2007-03-08 13:50:07Z twisti $
+   $Id: jit_interface.h 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -42,7 +42,7 @@ methodinfo *code_get_methodinfo_for_pv(u1 *pv);
 
 codeinfo *codegen_createnativestub(functionptr f, methodinfo *m);
 
-u1 *createcompilerstub(methodinfo *m);
+u1 *codegen_generate_stub_compiler(methodinfo *m);
 
 #if defined(ENABLE_INTRP)
 u1 *intrp_createcompilerstub(methodinfo *m);
index 1cfcfe91537ed96974a0950959a57277f212683e..ab287448ed55148340c6cf0f253fbdc7c1d852cf 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: linker.c 7675 2007-04-05 14:23:04Z michi $
+   $Id: linker.c 7691 2007-04-12 12:45:10Z twisti $
 
 */
 
@@ -927,7 +927,7 @@ static classinfo *link_class_intern(classinfo *c)
                        m->stubroutine = intrp_createcompilerstub(m);
                else
 #endif
-                       m->stubroutine = createcompilerstub(m);
+                       m->stubroutine = codegen_generate_stub_compiler(m);
 #else
                m->stubroutine = intrp_createcompilerstub(m);
 #endif