1 /* src/vm/jit/jitcache.h - jit compiler output caching
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 #if defined(ENABLE_JITCACHE)
34 #include "vm/jit/patcher-common.h"
36 #include "vmcore/class.h"
37 #include "vmcore/method.h"
39 typedef enum cachedreftype {
43 CRT_CODEGEN_FINISH_NATIVE_CALL,
44 CRT_ASM_HANDLE_EXCEPTION, /* 4 */
45 CRT_ASM_HANDLE_NAT_EXCEPTION,
50 CRT_CLASSINFO, /* 10 */
52 CRT_CLASSINFO_INTERFACETABLE,
54 CRT_METHODINFO_STUBROUTINE, /* 14 */
56 CRT_METHODINFO_INTERFACETABLE,
57 CRT_METHODINFO_METHODOFFSET,
58 CRT_FIELDINFO_VALUE, /* 18 */
60 CRT_FIELDINFO_OFFSET_HIGH,
61 CRT_JUMPREFERENCE /* 21 */
64 /* cachedref_t *****************************************************************
66 A cached reference contains information about a code or data position
67 which needs patching after restoring the it from disk.
69 *******************************************************************************/
71 typedef struct cachedref_t {
72 cachedreftype type; /* type of the cached reference */
73 s4 md_patch; /* machine dependent back patching */
74 s4 disp; /* displacement of ref in the data segment */
75 voidptr ref; /* reference passed */
80 typedef struct mru_entry_t {
86 /* typedefs *******************************************************************/
88 typedef void (*serializerfptr) (int, patchref_t *, methodinfo *);
89 typedef void (*deserializerfptr) (patchref_t *, int, methodinfo *);
91 /* jitcache_patcher_function_list_t typedef ***********************************/
93 typedef struct jitcache_patcher_function_list_t {
95 serializerfptr serializer;
96 deserializerfptr deserializer;
97 } jitcache_patcher_function_list_t;
99 /* function prototypes ********************************************************/
101 void jitcache_list_create(codeinfo *code);
103 void jitcache_list_reset(codeinfo *code);
105 void jitcache_list_free(codeinfo *code);
107 void jitcache_add_cached_ref_jd(jitdata *jd, cachedreftype type, voidptr ref);
109 void jitcache_add_cached_ref_md_jd(jitdata *jd, cachedreftype type, s4 md_patch, voidptr ref);
111 void jitcache_add_cached_ref(codeinfo *code, cachedreftype type, voidptr ref, s4 disp);
113 void jitcache_store(methodinfo *m);
115 u1 jitcache_load(methodinfo *m);
117 void jitcache_handle_cached_ref(cachedref_t *cr, codeinfo *code);
119 void jitcache_quit();
121 void jitcache_freeclass(classinfo *);
123 #define JITCACHE_ADD_CACHED_REF_JD(jd, type, ref) \
124 (jitcache_add_cached_ref_jd(jd, type, ref))
126 #define JITCACHE_ADD_CACHED_REF_JD_COND(jd, type, ref, COND) \
128 (jitcache_add_cached_ref_jd(jd, type, ref))
130 #define JITCACHE_ADD_CACHED_REF_MD_JD(jd, type, md_patch, ref) \
131 (jitcache_add_cached_ref_md_jd(jd, type, md_patch, ref))
133 #define JITCACHE_ADD_CACHED_REF(code, type, ref, disp) \
134 (jitcache_add_cached_ref(code, type, ref, disp))
136 #define JITCACHE_ADD_CACHED_REF_COND(code, type, ref, disp, COND) \
138 jitcache_add_cached_ref(code, type, ref, disp)
142 #define JITCACHE_ADD_CACHED_REF_JD(jd, type, ref) \
145 #define JITCACHE_ADD_CACHED_REF_JD_COND(jd, type, ref, COND) \
148 #define JITCACHE_ADD_CACHED_REF_MD_JD(jd, type, md_patch, ref) \
151 #define JITCACHE_ADD_CACHED_REF(code, type, ref, disp) \
154 #define JITCACHE_ADD_CACHED_REF_COND(code, type, ref, disp, COND) \
157 #endif /* ENABLE_JITCACHE */
159 #endif /* _LINENUMBERTABLE_H */
163 * These are local overrides for various environment variables in Emacs.
164 * Please do not remove this and leave it at the end of the file, where
165 * Emacs will automagically detect them.
166 * ---------------------------------------------------------------------
169 * indent-tabs-mode: t
173 * vim:noexpandtab:sw=4:ts=4: