* src/vm/jit/stubs.cpp: New file.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Thu, 21 Aug 2008 11:17:28 +0000 (13:17 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Thu, 21 Aug 2008 11:17:28 +0000 (13:17 +0200)
* src/vm/jit/stubs.hpp: Likewise.
* src/vm/jit/alpha/md-stubs.hpp,
src/vm/jit/arm/md-stubs.hpp,
src/vm/jit/i386/md-stubs.hpp,
src/vm/jit/m68k/md-stubs.hpp,
src/vm/jit/mips/md-stubs.hpp,
src/vm/jit/powerpc/md-stubs.hpp,
src/vm/jit/powerpc64/md-stubs.hpp,
src/vm/jit/s390/md-stubs.hpp,
src/vm/jit/sparc64/md-stubs.hpp,
src/vm/jit/x86_64/md-stubs.hpp: Likewise.
* src/vm/jit/alpha/Makefile.am,
src/vm/jit/arm/Makefile.am,
src/vm/jit/i386/Makefile.am,
src/vm/jit/m68k/Makefile.am,
src/vm/jit/mips/Makefile.am,
src/vm/jit/powerpc/Makefile.am,
src/vm/jit/powerpc64/Makefile.am,
src/vm/jit/s390/Makefile.am,
src/vm/jit/sparc64/Makefile.am,
src/vm/jit/x86_64/Makefile.am (libarch_la_SOURCES): Added
md-stubs.hpp.
* 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): Removed.
* src/vm/builtin.c,
src/vm/jit/Makefile.am,
src/vm/jit/abi.h,
src/vm/jit/codegen-common.c,
src/vm/jit/codegen-common.h,
src/vm/jit/dseg.h,
src/vm/jit/emit-common.h,
src/vm/jit/jit.c,
src/vm/jit/jit.h,
src/vm/jit/reg.h,
src/vm/linker.c,
src/vm/loader.c,
src/vm/method.c: Changes regarding new stub files.

45 files changed:
src/vm/builtin.c
src/vm/jit/Makefile.am
src/vm/jit/abi.h
src/vm/jit/alpha/Makefile.am
src/vm/jit/alpha/codegen.h
src/vm/jit/alpha/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/arm/Makefile.am
src/vm/jit/arm/codegen.h
src/vm/jit/arm/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/codegen-common.c
src/vm/jit/codegen-common.h
src/vm/jit/dseg.h
src/vm/jit/emit-common.h
src/vm/jit/i386/Makefile.am
src/vm/jit/i386/codegen.h
src/vm/jit/i386/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/jit.c
src/vm/jit/jit.h
src/vm/jit/m68k/Makefile.am
src/vm/jit/m68k/codegen.h
src/vm/jit/m68k/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/mips/Makefile.am
src/vm/jit/mips/codegen.h
src/vm/jit/mips/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/powerpc/Makefile.am
src/vm/jit/powerpc/codegen.h
src/vm/jit/powerpc/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/powerpc64/Makefile.am
src/vm/jit/powerpc64/codegen.h
src/vm/jit/powerpc64/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/reg.h
src/vm/jit/s390/Makefile.am
src/vm/jit/s390/codegen.h
src/vm/jit/s390/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/sparc64/Makefile.am
src/vm/jit/sparc64/codegen.h
src/vm/jit/sparc64/md-stubs.hpp [new file with mode: 0644]
src/vm/jit/stubs.cpp [new file with mode: 0644]
src/vm/jit/stubs.hpp [new file with mode: 0644]
src/vm/jit/x86_64/Makefile.am
src/vm/jit/x86_64/codegen.h
src/vm/jit/x86_64/md-stubs.hpp [new file with mode: 0644]
src/vm/linker.c
src/vm/loader.c
src/vm/method.c

index ddf665c7998c7a46e47ac7f29f9215ae2569b3e2..9e0b45dc4df34b09b0327ccd0a44582bea54fb1f 100644 (file)
@@ -75,6 +75,7 @@
 #include "vm/string.hpp"
 
 #include "vm/jit/asmpart.h"
+#include "vm/jit/stubs.hpp"
 #include "vm/jit/trace.hpp"
 
 #if defined(ENABLE_VMLOG)
@@ -182,7 +183,7 @@ static bool builtintable_init(void)
 
                if (bte->flags & BUILTINTABLE_FLAG_STUB) {
                        m = method_new_builtin(bte);
-                       codegen_generate_stub_builtin(m, bte);
+                       BuiltinStub_generate(m, bte);
                }
        }
 
@@ -209,7 +210,7 @@ static bool builtintable_init(void)
 
                if (bte->flags & BUILTINTABLE_FLAG_STUB) {
                        m = method_new_builtin(bte);
-                       codegen_generate_stub_builtin(m, bte);
+                       BuiltinStub_generate(m, bte);
                }
        }
 
index ef5b9e252334455605fe7ac44d203bb1727f34b0..ee480933eb62220fd2121587bb989503a9d45522 100644 (file)
@@ -182,6 +182,8 @@ libjit_la_SOURCES = \
        $(STACK_SOURCES) \
        stacktrace.cpp \
        stacktrace.hpp \
+       stubs.cpp \
+       stubs.hpp \
        trace.cpp \
        trace.hpp \
        $(TRAP_SOURCES) \
index 6a84ade40945d8609617f94385de998e6a2232d8..7a8cd9d6717cfb4d6adac69f4270d65145ec0514 100644 (file)
@@ -64,6 +64,10 @@ extern const s4    abi_registers_float_temporary[];
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* machine dependent descriptor function */
 void md_param_alloc(methoddesc *md);
 void md_param_alloc_native(methoddesc *md);
@@ -71,6 +75,10 @@ void md_param_alloc_native(methoddesc *md);
 /* machine dependent return value handling function */
 void md_return_alloc(jitdata *jd, stackelement_t *stackslot);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _ABI_H */
 
 
index d9ba3e434584689c3695ec832249380eed2b51aa..1424fc47a045b9960d3cc24ac043904115217d17 100644 (file)
@@ -55,6 +55,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index 30e43297bdc4ab5a668758af3b1feb685ea73066..641173bae2f1e90f2df3fe97508c2e995c54c6f9 100644 (file)
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    1 * 4
-
-
 /* macros to create code ******************************************************/
 
 /* M_MEM - memory instruction format *******************************************
diff --git a/src/vm/jit/alpha/md-stubs.hpp b/src/vm/jit/alpha/md-stubs.hpp
new file mode 100644 (file)
index 0000000..8ff379f
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/alpha/md-stubs.hpp - Alpha JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on an Alpha architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 1 * 4;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index de85844084064d535b394a210a82840bea7d23be..169c28ad96a410880f0a75c72e3acb86503b2580 100644 (file)
@@ -51,6 +51,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index 03318e831c348309e67895516d8519544a201e7a..448f99476b570afe6c8b40703c75e190f6161e56 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/arm/codegen.h - code generation macros and definitions for ARM
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    2 * 4
-
-
 /* lazy debugger **************************************************************/
 
 #if !defined(NDEBUG)
diff --git a/src/vm/jit/arm/md-stubs.hpp b/src/vm/jit/arm/md-stubs.hpp
new file mode 100644 (file)
index 0000000..1fb1147
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/arm/md-stubs.hpp - ARM JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on an ARM architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 2 * 4;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index 35b1bed9bc711e186fba9c8682220763dbc4de23..d4e27608045102988ed4d0dc3704f3efd71b8167 100644 (file)
@@ -693,369 +693,6 @@ 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             */
-       int32_t      dumpmarker;
-
-       /* mark dump memory */
-
-       DMARKER;
-
-       /* allocate required data structures */
-
-       jd = DNEW(jitdata);
-
-       jd->m     = m;
-       jd->cd    = DNEW(codegendata);
-       jd->flags = 0;
-
-       /* get required compiler data */
-
-       cd = jd->cd;
-
-#if !defined(JIT_COMPILER_VIA_SIGNAL)
-       /* 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);
-#else
-       /* Allocate code memory. */
-
-       c = CNEW(uint8_t, 2 * SIZEOF_VOID_P + COMPILERSTUB_CODESIZE);
-
-       /* Set pointers correctly. */
-
-       d = (ptrint *) c;
-
-       cd->mcodebase = c;
-
-       c = c + 2 * 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) m;
-       d[1] = (ptrint) &d[0];                                    /* fake code->m */
-
-       /* Emit the trap instruction. */
-
-       emit_trap_compiler(cd);
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               count_cstub_len += 2 * SIZEOF_VOID_P + COMPILERSTUB_CODESIZE;
-#endif
-
-       /* Flush caches. */
-
-       md_cacheflush(cd->mcodebase, 2 * SIZEOF_VOID_P + COMPILERSTUB_CODESIZE);
-#endif
-
-       /* release dump memory */
-
-       DRELEASE;
-
-       /* return native stub code */
-
-       return c;
-}
-
-
-/* codegen_generate_stub_builtin ***********************************************
-
-   Wrapper for codegen_emit_stub_native.
-
-*******************************************************************************/
-
-void codegen_generate_stub_builtin(methodinfo *m, builtintable_entry *bte)
-{
-       jitdata  *jd;
-       codeinfo *code;
-       int       skipparams;
-       int32_t   dumpmarker;
-
-       /* mark dump memory */
-
-       DMARKER;
-
-       /* Create JIT data structure. */
-
-       jd = jit_jitdata_new(m);
-
-       /* Get required compiler data. */
-
-       code = jd->code;
-
-       /* Stubs are non-leaf methods. */
-
-       code_unflag_leafmethod(code);
-
-       /* setup code generation stuff */
-
-       codegen_setup(jd);
-
-       /* Set the number of native arguments we need to skip. */
-
-       skipparams = 0;
-
-       /* generate the code */
-
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
-       if (!opt_intrp) {
-# endif
-               assert(bte->fp != NULL);
-               codegen_emit_stub_native(jd, bte->md, bte->fp, skipparams);
-# if defined(ENABLE_INTRP)
-       }
-# endif
-#endif
-
-       /* reallocate the memory and finish the code generation */
-
-       codegen_finish(jd);
-
-       /* set the stub entry point in the builtin table */
-
-       bte->stub = code->entrypoint;
-
-#if defined(ENABLE_STATISTICS)
-       if (opt_stat)
-               size_stub_native += code->mcodelength;
-#endif
-
-#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
-       /* disassemble native stub */
-
-       if (opt_DisassembleStubs) {
-               codegen_disassemble_stub(m,
-                                                                (u1 *) (ptrint) code->entrypoint,
-                                                                (u1 *) (ptrint) code->entrypoint + (code->mcodelength - jd->cd->dseglen));
-
-               /* show data segment */
-
-               if (opt_showddatasegment)
-                       dseg_display(jd);
-       }
-#endif /* !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER) */
-
-       /* release memory */
-
-       DRELEASE;
-}
-
-
-/* codegen_generate_stub_native ************************************************
-
-   Wrapper for codegen_emit_stub_native.
-
-   Returns:
-       the codeinfo representing the stub code.
-
-*******************************************************************************/
-
-codeinfo *codegen_generate_stub_native(methodinfo *m, functionptr f)
-{
-       jitdata     *jd;
-       codeinfo    *code;
-       methoddesc  *md;
-       methoddesc  *nmd;       
-       int          skipparams;
-       int32_t      dumpmarker;
-
-       /* mark dump memory */
-
-       DMARKER;
-
-       /* Create JIT data structure. */
-
-       jd = jit_jitdata_new(m);
-
-       /* Get required compiler data. */
-
-       code = jd->code;
-
-       /* Stubs are non-leaf methods. */
-
-       code_unflag_leafmethod(code);
-
-       /* set the flags for the current JIT run */
-
-#if defined(ENABLE_PROFILING)
-       if (opt_prof)
-               jd->flags |= JITDATA_FLAG_INSTRUMENT;
-#endif
-
-       if (opt_verbosecall)
-               jd->flags |= JITDATA_FLAG_VERBOSECALL;
-
-       /* setup code generation stuff */
-
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
-       if (!opt_intrp)
-# endif
-               reg_setup(jd);
-#endif
-
-       codegen_setup(jd);
-
-       /* create new method descriptor with additional native parameters */
-
-       md = m->parseddesc;
-
-       /* Set the number of native arguments we need to skip. */
-
-       if (m->flags & ACC_STATIC)
-               skipparams = 2;
-       else
-               skipparams = 1;
-       
-       nmd = (methoddesc *) DMNEW(u1, sizeof(methoddesc) - sizeof(typedesc) +
-                                                          md->paramcount * sizeof(typedesc) +
-                                                          skipparams * sizeof(typedesc));
-
-       nmd->paramcount = md->paramcount + skipparams;
-
-       nmd->params = DMNEW(paramdesc, nmd->paramcount);
-
-       nmd->paramtypes[0].type = TYPE_ADR; /* add environment pointer            */
-
-       if (m->flags & ACC_STATIC)
-               nmd->paramtypes[1].type = TYPE_ADR; /* add class pointer              */
-
-       MCOPY(nmd->paramtypes + skipparams, md->paramtypes, typedesc,
-                 md->paramcount);
-
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
-       if (!opt_intrp)
-# endif
-               /* pre-allocate the arguments for the native ABI */
-
-               md_param_alloc_native(nmd);
-#endif
-
-       /* generate the code */
-
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
-       if (opt_intrp)
-               intrp_createnativestub(f, jd, nmd);
-       else
-# endif
-               codegen_emit_stub_native(jd, nmd, f, skipparams);
-#else
-       intrp_createnativestub(f, jd, nmd);
-#endif
-
-       /* reallocate the memory and finish the code generation */
-
-       codegen_finish(jd);
-
-#if defined(ENABLE_STATISTICS)
-       /* must be done after codegen_finish() */
-
-       if (opt_stat)
-               size_stub_native += code->mcodelength;
-#endif
-
-#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
-       /* disassemble native stub */
-
-       if (opt_DisassembleStubs) {
-# if defined(ENABLE_DEBUG_FILTER)
-               if (m->filtermatches & SHOW_FILTER_FLAG_SHOW_METHOD)
-# endif
-               {
-                       codegen_disassemble_stub(m,
-                                                                        (u1 *) (ptrint) code->entrypoint,
-                                                                        (u1 *) (ptrint) code->entrypoint + (code->mcodelength - jd->cd->dseglen));
-
-                       /* show data segment */
-
-                       if (opt_showddatasegment)
-                               dseg_display(jd);
-               }
-       }
-#endif /* !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER) */
-
-       /* release memory */
-
-       DRELEASE;
-
-       /* return native stub code */
-
-       return code;
-}
-
-
-/* codegen_disassemble_nativestub **********************************************
-
-   Disassembles the generated builtin or native stub.
-
-*******************************************************************************/
-
-#if defined(ENABLE_DISASSEMBLER)
-void codegen_disassemble_stub(methodinfo *m, u1 *start, u1 *end)
-{
-       printf("Stub code: ");
-       if (m->clazz != NULL)
-               utf_fprint_printable_ascii_classname(stdout, m->clazz->name);
-       else
-               printf("NULL");
-       printf(".");
-       utf_fprint_printable_ascii(stdout, m->name);
-       utf_fprint_printable_ascii(stdout, m->descriptor);
-       printf("\nLength: %d\n\n", (s4) (end - start));
-
-       DISASSEMBLE(start, end);
-}
-#endif
-
-
 /* codegen_start_native_call ***************************************************
 
    Prepares the stuff required for a native (JNI) function call:
@@ -1299,34 +936,6 @@ java_object_t *codegen_finish_native_call(u1 *sp, u1 *pv)
 }
 
 
-/* removecompilerstub **********************************************************
-
-   Deletes a compilerstub from memory (simply by freeing it).
-
-*******************************************************************************/
-
-void removecompilerstub(u1 *stub)
-{
-       /* pass size 1 to keep the intern function happy */
-
-       CFREE((void *) stub, 1);
-}
-
-
-/* removenativestub ************************************************************
-
-   Removes a previously created native-stub from memory.
-    
-*******************************************************************************/
-
-void removenativestub(u1 *stub)
-{
-       /* pass size 1 to keep the intern function happy */
-
-       CFREE((void *) stub, 1);
-}
-
-
 /* codegen_reg_of_var **********************************************************
 
    This function determines a register, to which the result of an
index 4a4fea9e56f33b84db77005b89bb8931e06c0a16..3daee60923d3ffda65e5ac43aa475bfc7cd1b344 100644 (file)
@@ -212,6 +212,10 @@ struct linenumberref {
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void codegen_init(void);
 void codegen_setup(jitdata *jd);
 
@@ -247,29 +251,6 @@ void codegen_set_replacement_point(codegendata *cd);
 
 void codegen_finish(jitdata *jd);
 
-#if defined(ENABLE_DISASSEMBLER)
-void codegen_disassemble_stub(methodinfo *m, u1 *start, u1 *end);
-#endif
-
-/* stub functions */
-
-u1       *codegen_generate_stub_compiler(methodinfo *m);
-void      codegen_generate_stub_builtin(methodinfo *m, builtintable_entry *bte);
-codeinfo *codegen_generate_stub_native(methodinfo *m, functionptr f);
-
-#if !defined(JIT_COMPILER_VIA_SIGNAL)
-void      codegen_emit_stub_compiler(jitdata *jd);
-#endif
-void      codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int skipparams);
-
-#if defined(ENABLE_INTRP)
-u1 *intrp_createcompilerstub(methodinfo *m);
-u1 *intrp_createnativestub(functionptr f, jitdata *jd, methoddesc *md);
-#endif
-
-void removecompilerstub(u1 *stub);
-void removenativestub(u1 *stub);
-
 java_handle_t *codegen_start_native_call(u1 *currentsp, u1 *pv);
 java_object_t *codegen_finish_native_call(u1 *currentsp, u1 *pv);
 
@@ -280,6 +261,14 @@ s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum);
 void codegen_emit_phi_moves(jitdata *jd, basicblock *bptr);
 #endif
 
+// REMOVEME
+void codegen_emit_stub_compiler(jitdata *jd);
+void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int skipparams);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _CODEGEN_COMMON_H */
 
 
index c69406fc9d870a3841dda8854f039f95b440f3c0..c377ffd4e30a0546451c08140a99e050af75e7ad 100644 (file)
@@ -64,6 +64,10 @@ struct dsegentry {
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void dseg_finish(jitdata *jd);
 
 s4 dseg_add_unique_s4(codegendata *cd, s4 value);
@@ -90,6 +94,10 @@ void dseg_resolve_datareferences(jitdata *jd);
 void dseg_display(jitdata *jd);
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _DSEG_H */
 
 
index f0f854a03b92cac66d76eef33413c4257f5f9369..1b47d53ab3c62d5008de3ac8356be4e3d0e205c5 100644 (file)
 
 /* code generation functions **************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg);
 s4 emit_load_s1(jitdata *jd, instruction *iptr, s4 tempreg);
 s4 emit_load_s2(jitdata *jd, instruction *iptr, s4 tempreg);
@@ -186,6 +190,10 @@ void emit_patcher_traps(jitdata *jd);
 void emit_verbosecall_enter(jitdata *jd);
 void emit_verbosecall_exit(jitdata *jd);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _EMIT_COMMON_H */
 
 
index 044e950af353558577d4847c93b032600bf28ed5..044070caf81ba6a780d7ca8040367fb3bf121bb4 100644 (file)
@@ -58,6 +58,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index eb7ab8047fe76c0ef7479e827d5ee16aedff7b25..7a40b1b276cbeb793731909b74265b5c448f3821 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/i386/codegen.h - code generation macros and definitions for i386
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    6
-
-
 /* macros to create code ******************************************************/
 
 #define M_BYTE1(a) \
diff --git a/src/vm/jit/i386/md-stubs.hpp b/src/vm/jit/i386/md-stubs.hpp
new file mode 100644 (file)
index 0000000..c5ccf43
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/i386/md-stubs.hpp - i386 JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on an i386 architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 6;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index b76f51c51838e399088a42c84534642288331016..0b6a580b627a8707b50c4270350ec6f089466503 100644 (file)
@@ -63,6 +63,7 @@
 
 #include "vm/jit/show.h"
 #include "vm/jit/stack.h"
+#include "vm/jit/stubs.hpp"
 
 #if defined(ENABLE_OPAGENT)
 #include "vm/jit/oprofile-agent.hpp"
@@ -590,7 +591,7 @@ static u1 *jit_compile_intern(jitdata *jd)
                if (f == NULL)
                        return NULL;
 
-               code = codegen_generate_stub_native(m, f);
+               code = NativeStub_generate(m, f);
 
                /* Native methods are never recompiled. */
                
index 781452f4b78c251250b8e541f22b84baa2408172..acd608548ca1b93a9e12dc7535d645d9f0f5972b 100644 (file)
@@ -426,6 +426,10 @@ static inline bool basicblock_reached(const basicblock *bptr) {
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* compiler initialisation */
 void jit_init(void);
 
@@ -469,6 +473,10 @@ void intrp_md_init(void);
 
 void *md_jit_method_patch_address(void *pv, void *ra, void *mptr);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _JIT_H */
 
 
index 5799e1a78fe589732647e7916bcb4100b4de6c56..85da92d0836156c14b7e58d42d36fdf182d8f04a 100644 (file)
@@ -51,6 +51,7 @@ libarch_la_SOURCES = \
        emit.c \
        patcher.c \
        \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index b0add07bad577492e5beaca5875ae65c8d949245..0cb13d0fa215b61b8bb80eb7088e1586b4c96466 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/m68k/codegen.h
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
 
 #define PATCHER_CALL_SIZE      2
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE (2+2)
-
 
 /* coldfire instruction format:
  * -----------------------------
diff --git a/src/vm/jit/m68k/md-stubs.hpp b/src/vm/jit/m68k/md-stubs.hpp
new file mode 100644 (file)
index 0000000..e7f84f6
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/m68k/md-stubs.hpp - m68k JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on a m68k architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 2 + 2;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index 86ef145db86d6c49e85230466cfab5bfcd2b07bb..751957ff1fe7be62abad0efcd7bea12a2830425f 100644 (file)
@@ -57,6 +57,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index c759180bf28316a2f11b141726422f52f07c8cd9..3d096e5f67e95700f5867a3812630c00e7fa97d9 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/mips/codegen.h - code generation macros and definitions for MIPS
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    1 * 4
-
-
 /* macros to create code ******************************************************/
 
 /* code generation macros operands:
diff --git a/src/vm/jit/mips/md-stubs.hpp b/src/vm/jit/mips/md-stubs.hpp
new file mode 100644 (file)
index 0000000..7451d76
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/mips/md-stubs.hpp - MIPS JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on a MIPS architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 1 * 4;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index 448fdde343784cb376dd1b4d2ff457bae82b7679..730fb9d8f6cf74de04fea6cdd51418576b3b9105 100644 (file)
@@ -53,6 +53,7 @@ libarch_la_SOURCES = \
        emit.c \
        patcher.c \
        \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index ea6f9843546d91b19d233bc4ddc1d7abc1c85215..c1c0541293964adcfbd8506e91c896ea013facd8 100644 (file)
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    1 * 4
-
-
 /* macros to create code ******************************************************/
 
 #define M_OP3(opcode,y,oe,rc,d,a,b) \
diff --git a/src/vm/jit/powerpc/md-stubs.hpp b/src/vm/jit/powerpc/md-stubs.hpp
new file mode 100644 (file)
index 0000000..caf3cc6
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/powerpc/md-stubs.hpp - PowerPC JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on a PowerPC architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 1 * 4;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index a450512ac5942dca5904ad4c3be681234213b500..d61007a20e7fc08952f0892612d312901eca1fc6 100644 (file)
@@ -50,6 +50,7 @@ libarch_la_SOURCES = \
        emit.c \
        patcher.c \
        \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index 1ffe1bfd91a3c5d5aa975f92ea1ebf90e4d08795..6f7f6fcb7b0a021b0252a745072584c69645588e 100644 (file)
@@ -1,10 +1,8 @@
-/* src/vm/jit/powerpc64/codegen.h - code generation macros and definitions for
-                                 64-bit PowerPC
+/* src/vm/jit/powerpc64/codegen.h - code generation macros and
+                                    definitions for PowerPC64
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Andreas Krall
-            Stefan Ring
-            Christian Thalinger
-            Christian Ullrich
-
-
 */
 
 
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    1 * 4
-
-
 /* macros to create code ******************************************************/
 
 #define M_OP3(opcode,y,oe,rc,d,a,b) \
diff --git a/src/vm/jit/powerpc64/md-stubs.hpp b/src/vm/jit/powerpc64/md-stubs.hpp
new file mode 100644 (file)
index 0000000..5356f7f
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/powerpc64/md-stubs.hpp - PowerPC64 JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on a PowerPC64 architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 1 * 4;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index b4196b1f4477200aa59f08b2af57e931875f0a3a..6bb12627721797981f24a760441b74b9e77c54a2 100644 (file)
@@ -133,8 +133,16 @@ struct registerdata {
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void reg_setup(jitdata *jd);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _REG_H */
 
 
index 7e17c12f7efcedac2527c2c647fa199653a298c6..002ce18e8c3e5ead51b342003f0c852aceb47dad 100644 (file)
@@ -51,6 +51,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index 8e4bbb8c931a295449907e9156b5b74955f13170..33e945f89e8e1042d2eb7e9e4fbe56774e796745 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/s390/codegen.h - code generation macros for s390
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -63,9 +61,6 @@
                } \
        } while (0) 
 
-/* stub defines **************************************************************/
-
-#define COMPILERSTUB_CODESIZE    (SZ_AHI + SZ_L + SZ_L + SZ_BCR)
 
 /* *** BIG TODO ***
  * Make all this inline functions !!!!!!!!!!
diff --git a/src/vm/jit/s390/md-stubs.hpp b/src/vm/jit/s390/md-stubs.hpp
new file mode 100644 (file)
index 0000000..6fbe822
--- /dev/null
@@ -0,0 +1,58 @@
+/* src/vm/jit/s390/md-stubs.hpp - s390 JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+#include "vm/jit/s390/codegen.h"
+
+
+/**
+ * Return the code size of a compiler on a s390 architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return (SZ_AHI + SZ_L + SZ_L + SZ_BCR);
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index b45fe94c47364f004396caf63322ce29902a5a36..2fbeef9f5cd9d5a68b34229e3f6e060387ccc669 100644 (file)
@@ -57,6 +57,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index ade165128a665165191011b905ce4d3424039e77..749650670f06c4fa3fb477152eb0d5d67948670b 100644 (file)
@@ -1,10 +1,8 @@
-/* src/vm/jit/sparc64/codegen.h - code generation macros and definitions for
-                                  Sparc64
+/* src/vm/jit/sparc64/codegen.h - code generation macros and
+                                  definitions for SPARC64
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -72,11 +70,6 @@ s4 nat_argintregs[INT_NATARG_CNT];
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    4 * 4
-
-
 /* additional functions and macros to generate code ***************************/
 
 
diff --git a/src/vm/jit/sparc64/md-stubs.hpp b/src/vm/jit/sparc64/md-stubs.hpp
new file mode 100644 (file)
index 0000000..eb0dc65
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/sparc64/md-stubs.hpp - SPARC64 JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on a SPARC64 architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 4 * 4;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
diff --git a/src/vm/jit/stubs.cpp b/src/vm/jit/stubs.cpp
new file mode 100644 (file)
index 0000000..b4ecad7
--- /dev/null
@@ -0,0 +1,458 @@
+/* src/vm/jit/stubs.cpp - JIT stubs
+
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#include "config.h"
+
+#include <stdint.h>
+
+// Include machine dependent headers.
+#include "md.h"
+
+#include "mm/dumpmemory.h"
+
+#include "vm/method.h"
+#include "vm/options.h"
+
+#include "vm/jit/abi.h"
+#include "vm/jit/code.h"
+#include "vm/jit/codegen-common.h"
+#include "vm/jit/disass.h"
+#include "vm/jit/emit-common.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/show.h"
+#include "vm/jit/stubs.hpp"
+
+
+/**
+ * Wrapper for codegen_emit_stub_compiler.
+ *
+ * @param m Method object.
+ *
+ * @return Pointer to the compiler stub code.
+ */
+void* CompilerStub::generate(methodinfo *m)
+{
+       jitdata     *jd;
+       codegendata *cd;
+       ptrint      *d;                     /* pointer to data memory             */
+       u1          *c;                     /* pointer to code memory             */
+       int32_t      dumpmarker;
+
+       /* mark dump memory */
+
+       DMARKER;
+
+       /* allocate required data structures */
+
+       jd = DNEW(jitdata);
+
+       jd->m     = m;
+       jd->cd    = DNEW(codegendata);
+       jd->flags = 0;
+
+       /* get required compiler data */
+
+       cd = jd->cd;
+
+#if !defined(JIT_COMPILER_VIA_SIGNAL)
+       /* allocate code memory */
+
+       c = CNEW(u1, 3 * SIZEOF_VOID_P + get_code_size());
+
+       /* 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 + get_code_size();
+#endif
+
+       /* flush caches */
+
+       md_cacheflush(cd->mcodebase, 3 * SIZEOF_VOID_P + get_code_size());
+#else
+       /* Allocate code memory. */
+
+       c = CNEW(uint8_t, 2 * SIZEOF_VOID_P + get_code_size());
+
+       /* Set pointers correctly. */
+
+       d = (ptrint *) c;
+
+       cd->mcodebase = c;
+
+       c = c + 2 * 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) m;
+       d[1] = (ptrint) &d[0];                                    /* fake code->m */
+
+       /* Emit the trap instruction. */
+
+       emit_trap_compiler(cd);
+
+#if defined(ENABLE_STATISTICS)
+       if (opt_stat)
+               count_cstub_len += 2 * SIZEOF_VOID_P + get_code_size();
+#endif
+
+       /* Flush caches. */
+
+       md_cacheflush(cd->mcodebase, 2 * SIZEOF_VOID_P + get_code_size());
+#endif
+
+       /* release dump memory */
+
+       DRELEASE;
+
+       /* return native stub code */
+
+       return c;
+}
+
+
+/**
+ * Free a compiler stub from memory.
+ *
+ * @param 
+ */
+void CompilerStub::remove(void* stub)
+{
+       // Pass size 1 to keep the intern function happy.
+       CFREE(stub, 1);
+}
+
+
+/* codegen_disassemble_nativestub **********************************************
+
+   Disassembles the generated builtin or native stub.
+
+*******************************************************************************/
+
+#if defined(ENABLE_DISASSEMBLER)
+static void codegen_disassemble_stub(methodinfo *m, u1 *start, u1 *end)
+{
+       printf("Stub code: ");
+       if (m->clazz != NULL)
+               utf_fprint_printable_ascii_classname(stdout, m->clazz->name);
+       else
+               printf("NULL");
+       printf(".");
+       utf_fprint_printable_ascii(stdout, m->name);
+       utf_fprint_printable_ascii(stdout, m->descriptor);
+       printf("\nLength: %d\n\n", (s4) (end - start));
+
+       DISASSEMBLE(start, end);
+}
+#endif
+
+
+/**
+ * Wrapper for codegen_emit_stub_native.
+ *
+ * @param m   Method object.
+ * @param bte Builtin function structure.
+ */
+void BuiltinStub::generate(methodinfo* m, builtintable_entry* bte)
+{
+       jitdata  *jd;
+       codeinfo *code;
+       int       skipparams;
+       int32_t   dumpmarker;
+
+       /* mark dump memory */
+
+       DMARKER;
+
+       /* Create JIT data structure. */
+
+       jd = jit_jitdata_new(m);
+
+       /* Get required compiler data. */
+
+       code = jd->code;
+
+       /* Stubs are non-leaf methods. */
+
+       code_unflag_leafmethod(code);
+
+       /* setup code generation stuff */
+
+       codegen_setup(jd);
+
+       /* Set the number of native arguments we need to skip. */
+
+       skipparams = 0;
+
+       /* generate the code */
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (!opt_intrp) {
+# endif
+               assert(bte->fp != NULL);
+               codegen_emit_stub_native(jd, bte->md, bte->fp, skipparams);
+# if defined(ENABLE_INTRP)
+       }
+# endif
+#endif
+
+       /* reallocate the memory and finish the code generation */
+
+       codegen_finish(jd);
+
+       /* set the stub entry point in the builtin table */
+
+       bte->stub = code->entrypoint;
+
+#if defined(ENABLE_STATISTICS)
+       if (opt_stat)
+               size_stub_native += code->mcodelength;
+#endif
+
+#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
+       /* disassemble native stub */
+
+       if (opt_DisassembleStubs) {
+               codegen_disassemble_stub(m,
+                                                                (u1 *) (ptrint) code->entrypoint,
+                                                                (u1 *) (ptrint) code->entrypoint + (code->mcodelength - jd->cd->dseglen));
+
+               /* show data segment */
+
+               if (opt_showddatasegment)
+                       dseg_display(jd);
+       }
+#endif /* !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER) */
+
+       /* release memory */
+
+       DRELEASE;
+}
+
+
+/**
+ * Wrapper for codegen_emit_stub_native.
+ *
+ * @param m Method object of the native function.
+ * @param f Native function pointer.
+ *
+ * @return The codeinfo representing the stub code.
+ */
+codeinfo* NativeStub::generate(methodinfo* m, functionptr f)
+{
+       jitdata     *jd;
+       codeinfo    *code;
+       methoddesc  *md;
+       methoddesc  *nmd;       
+       int          skipparams;
+       int32_t      dumpmarker;
+
+       /* mark dump memory */
+
+       DMARKER;
+
+       /* Create JIT data structure. */
+
+       jd = jit_jitdata_new(m);
+
+       /* Get required compiler data. */
+
+       code = jd->code;
+
+       /* Stubs are non-leaf methods. */
+
+       code_unflag_leafmethod(code);
+
+       /* set the flags for the current JIT run */
+
+#if defined(ENABLE_PROFILING)
+       if (opt_prof)
+               jd->flags |= JITDATA_FLAG_INSTRUMENT;
+#endif
+
+       if (opt_verbosecall)
+               jd->flags |= JITDATA_FLAG_VERBOSECALL;
+
+       /* setup code generation stuff */
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (!opt_intrp)
+# endif
+               reg_setup(jd);
+#endif
+
+       codegen_setup(jd);
+
+       /* create new method descriptor with additional native parameters */
+
+       md = m->parseddesc;
+
+       /* Set the number of native arguments we need to skip. */
+
+       if (m->flags & ACC_STATIC)
+               skipparams = 2;
+       else
+               skipparams = 1;
+       
+       nmd = (methoddesc *) DMNEW(u1, sizeof(methoddesc) - sizeof(typedesc) +
+                                                          md->paramcount * sizeof(typedesc) +
+                                                          skipparams * sizeof(typedesc));
+
+       nmd->paramcount = md->paramcount + skipparams;
+
+       nmd->params = DMNEW(paramdesc, nmd->paramcount);
+
+       nmd->paramtypes[0].type = TYPE_ADR; /* add environment pointer            */
+
+       if (m->flags & ACC_STATIC)
+               nmd->paramtypes[1].type = TYPE_ADR; /* add class pointer              */
+
+       MCOPY(nmd->paramtypes + skipparams, md->paramtypes, typedesc,
+                 md->paramcount);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (!opt_intrp)
+# endif
+               /* pre-allocate the arguments for the native ABI */
+
+               md_param_alloc_native(nmd);
+#endif
+
+       /* generate the code */
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               intrp_createnativestub(f, jd, nmd);
+       else
+# endif
+               codegen_emit_stub_native(jd, nmd, f, skipparams);
+#else
+       intrp_createnativestub(f, jd, nmd);
+#endif
+
+       /* reallocate the memory and finish the code generation */
+
+       codegen_finish(jd);
+
+#if defined(ENABLE_STATISTICS)
+       /* must be done after codegen_finish() */
+
+       if (opt_stat)
+               size_stub_native += code->mcodelength;
+#endif
+
+#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
+       /* disassemble native stub */
+
+       if (opt_DisassembleStubs) {
+# if defined(ENABLE_DEBUG_FILTER)
+               if (m->filtermatches & SHOW_FILTER_FLAG_SHOW_METHOD)
+# endif
+               {
+                       codegen_disassemble_stub(m,
+                                                                        (u1 *) (ptrint) code->entrypoint,
+                                                                        (u1 *) (ptrint) code->entrypoint + (code->mcodelength - jd->cd->dseglen));
+
+                       /* show data segment */
+
+                       if (opt_showddatasegment)
+                               dseg_display(jd);
+               }
+       }
+#endif /* !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER) */
+
+       /* release memory */
+
+       DRELEASE;
+
+       /* return native stub code */
+
+       return code;
+}
+
+
+/**
+ * Free a native stub from memory.
+ *
+ * @param stub Pointer to stub memory.
+ */    
+void NativeStub::remove(void* stub)
+{
+       // Pass size 1 to keep the intern function happy.
+       CFREE(stub, 1);
+}
+
+
+// Legacy C interface.
+
+extern "C" {
+       void*     CompilerStub_generate(methodinfo* m) { return CompilerStub::generate(m); }
+       void      CompilerStub_remove(void* stub) { CompilerStub::remove(stub); }
+
+       void      BuiltinStub_generate(methodinfo* m, builtintable_entry* bte) { BuiltinStub::generate(m, bte); }
+
+       codeinfo* NativeStub_generate(methodinfo* m, functionptr f) { return NativeStub::generate(m, f); }
+       void      NativeStub_remove(void* stub) { NativeStub::remove(stub); }
+}
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
diff --git a/src/vm/jit/stubs.hpp b/src/vm/jit/stubs.hpp
new file mode 100644 (file)
index 0000000..764eee1
--- /dev/null
@@ -0,0 +1,100 @@
+/* src/vm/jit/stubs.hpp - JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _STUBS_HPP
+#define _STUBS_HPP
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "vm/method.h"
+
+#include "vm/jit/code.h"
+
+
+#ifdef __cplusplus
+
+/**
+ * Class for compiler stub generation.
+ */
+class CompilerStub {
+public:
+       static inline int get_code_size();
+
+       static void* generate(methodinfo* m);
+       static void  remove(void* stub);
+};
+
+
+/**
+ * Class for builtin stub generation.
+ */
+class BuiltinStub {
+public:
+       static void generate(methodinfo* m, builtintable_entry* bte);
+};
+
+
+/**
+ * Class for native stub generation.
+ */
+class NativeStub {
+public:
+       static codeinfo* generate(methodinfo* m, functionptr f);
+       static void      remove(void* stub);
+};
+
+
+// Include machine dependent implementation.
+#include "md-stubs.hpp"
+
+#else
+
+// Legacy C interface.
+
+void*     CompilerStub_generate(methodinfo* m);
+void*     CompilerStub_remove(void* stub);
+void      BuiltinStub_generate(methodinfo* m, builtintable_entry* bte);
+codeinfo* NativeStub_generate(methodinfo* m, functionptr f);
+void      NativeStub_remove(void* stub);
+
+#endif
+
+#endif // _STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index 338afc1829057be135aa6146e8f525e7043f1f88..354c92ec1f3ca273b4dde3dacf3d225f1a381498 100644 (file)
@@ -57,6 +57,7 @@ libarch_la_SOURCES = \
        \
        md-abi.c \
        md-abi.h \
+       md-stubs.hpp \
        md-trap.h \
        md.c \
        md.h
index 17d4edbd748369d93070e0fa29d4b40922262ddf..452992ce1cd089151a4570e80b302e917d20b601 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/x86_64/codegen.h - code generation macros for x86_64
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
     } while (0)
 
 
-/* stub defines ***************************************************************/
-
-#define COMPILERSTUB_CODESIZE    8
-
-
 /* macros to create code ******************************************************/
 
 #define M_BYTE1(a) \
diff --git a/src/vm/jit/x86_64/md-stubs.hpp b/src/vm/jit/x86_64/md-stubs.hpp
new file mode 100644 (file)
index 0000000..521a814
--- /dev/null
@@ -0,0 +1,56 @@
+/* src/vm/jit/x86_64/md-stubs.hpp - x86_64 JIT stubs
+
+   Copyright (C) 2008 Theobroma Systems Ltd.
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _MD_STUBS_HPP
+#define _MD_STUBS_HPP
+
+#include "config.h"
+
+
+/**
+ * Return the code size of a compiler on a x86_64 architecture.
+ *
+ * @return Code size in bytes.
+ */
+int CompilerStub::get_code_size()
+{
+       return 8;
+}
+
+#endif // _MD_STUBS_HPP
+
+
+/*
+ * 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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index 21c026aee70cf15e10521fe8dbc7c0c89ba9a1b0..6845ecb96481cfe08d977a0bb55df93b4319e1d6 100644 (file)
@@ -53,6 +53,7 @@
 #include "vm/vm.hpp"
 
 #include "vm/jit/asmpart.h"
+#include "vm/jit/stubs.hpp"
 
 
 /* debugging macros ***********************************************************/
@@ -846,7 +847,7 @@ static classinfo *link_class_intern(classinfo *c)
                        m->stubroutine = intrp_createcompilerstub(m);
                else
 #endif
-                       m->stubroutine = codegen_generate_stub_compiler(m);
+                       m->stubroutine = CompilerStub_generate(m);
 #else
                m->stubroutine = intrp_createcompilerstub(m);
 #endif
index 218f695cba1023f50ded78d09dc44be2a58d3d3a..7564a136773c3e1d0307a364428bbae665c230de 100644 (file)
@@ -2180,7 +2180,7 @@ classinfo *load_newly_created_array(classinfo *c, classloader_t *loader)
        if (!descriptor_params_from_paramtypes(clonedesc, clone->flags))
                return false;
 
-       clone->code = codegen_generate_stub_native(clone, BUILTIN_clone);
+       clone->code = NativeStub_generate(clone, BUILTIN_clone);
 
        /* XXX: field: length? */
 
index 08171f1d9ded027446a89e163e0caf3cb26db619..016ba715c9cd81da6809e43cb93a8195bb9a3e93 100644 (file)
@@ -54,6 +54,7 @@
 
 #include "vm/jit/code.h"
 #include "vm/jit/methodheader.h"
+#include "vm/jit/stubs.hpp"
 
 
 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
@@ -537,10 +538,10 @@ void method_free(methodinfo *m)
 
        if (m->stubroutine) {
                if (m->flags & ACC_NATIVE) {
-                       removenativestub(m->stubroutine);
-
-               else {
-                       removecompilerstub(m->stubroutine);
+                       NativeStub_remove(m->stubroutine);
+               }
+               else {
+                       CompilerStub_remove(m->stubroutine);
                }
        }
 }