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.
/* 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;
}
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 $
*/
}
-/* 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;
}
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
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 $
*/
}
-/* 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;
}
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)
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 $
*/
}
+/* 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.
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 $
*/
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);
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);
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 $
*/
}
#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;
}
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))
02110-1301, USA.
$Id: codegen.c 7564 2007-03-23 23:36:17Z twisti $
+
*/
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.
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;
-}
} 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 |
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 $
*/
}
-/* 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;
}
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:
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 $
*/
}
-/* 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;
}
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) \
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 $
*/
}
-/* 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;
}
/* 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
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) \
-/* 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 $
*/
}
-/* 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 */
/* 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;
}
-/* 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 !!!!!!!!!!
*/
}
-/* 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;
}
-/* 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 $
*/
} while (0)
+/* stub defines ***************************************************************/
+
+#define COMPILERSTUB_CODESIZE 4 * 4
+
+
/* additional functions and macros to generate code ***************************/
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 $
*/
}
-/* 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;
}
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))
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 $
*/
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);
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 $
*/
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