1 /* src/vm/jit/patcher.h - code patching functions
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Thalinger
31 $Id: patcher.h 3392 2005-10-10 13:40:11Z twisti $
40 #include "vm/global.h"
43 /* patcher macros *************************************************************/
45 #if defined(USE_THREADS)
47 #define PATCHER_MONITORENTER \
48 /* enter a monitor on the patching position */ \
50 builtin_monitorenter(o); \
52 /* check if the position has already been patched */ \
55 builtin_monitorexit(o); \
61 #define PATCHER_MONITOREXIT \
62 /* leave the monitor on the patching position */ \
64 builtin_monitorexit(o);
67 #define PATCHER_MARK_PATCHED_MONITOREXIT \
68 /* mark position as patched */ \
70 o->vftbl = (vftbl_t *) 1; \
76 #define PATCHER_MONITORENTER /* nop */
77 #define PATCHER_MONITOREXIT /* nop */
78 #define PATCHER_MARK_PATCHED_MONITOREXIT /* nop */
80 #endif /* defined(USE_THREADS) */
83 /* function prototypes ********************************************************/
85 bool patcher_get_putstatic(u1 *sp);
86 #define PATCHER_get_putstatic (functionptr) patcher_get_putstatic
90 bool patcher_getfield(u1 *sp);
91 #define PATCHER_getfield (functionptr) patcher_getfield
93 bool patcher_putfield(u1 *sp);
94 #define PATCHER_putfield (functionptr) patcher_putfield
98 bool patcher_get_putfield(u1 *sp);
99 #define PATCHER_get_putfield (functionptr) patcher_get_putfield
101 #endif /* defined(__I386__) */
103 #if defined(__I386__) || defined(__X86_64__)
105 bool patcher_putfieldconst(u1 *sp);
106 #define PATCHER_putfieldconst (functionptr) patcher_putfieldconst
108 #endif /* defined(__I386__) || defined(__X86_64__) */
110 bool patcher_builtin_new(u1 *sp);
111 #define PATCHER_builtin_new (functionptr) patcher_builtin_new
113 bool patcher_builtin_newarray(u1 *sp);
114 #define PATCHER_builtin_newarray (functionptr) patcher_builtin_newarray
116 bool patcher_builtin_multianewarray(u1 *sp);
117 #define PATCHER_builtin_multianewarray (functionptr) patcher_builtin_multianewarray
119 bool patcher_builtin_arraycheckcast(u1 *sp);
120 #define PATCHER_builtin_arraycheckcast (functionptr) patcher_builtin_arraycheckcast
122 bool patcher_builtin_arrayinstanceof(u1 *sp);
123 #define PATCHER_builtin_arrayinstanceof (functionptr) patcher_builtin_arrayinstanceof
125 bool patcher_invokestatic_special(u1 *sp);
126 #define PATCHER_invokestatic_special (functionptr) patcher_invokestatic_special
128 bool patcher_invokevirtual(u1 *sp);
129 #define PATCHER_invokevirtual (functionptr) patcher_invokevirtual
131 bool patcher_invokeinterface(u1 *sp);
132 #define PATCHER_invokeinterface (functionptr) patcher_invokeinterface
135 /* only for interpreter */
136 bool patcher_checkcast_instanceof(u1 *sp);
137 #define PATCHER_checkcast_instanceof (functionptr) patcher_checkcast_instanceof
140 bool patcher_checkcast_instanceof_flags(u1 *sp);
141 #define PATCHER_checkcast_instanceof_flags (functionptr) patcher_checkcast_instanceof_flags
143 bool patcher_checkcast_instanceof_interface(u1 *sp);
144 #define PATCHER_checkcast_instanceof_interface (functionptr) patcher_checkcast_instanceof_interface
146 #if defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__)
148 bool patcher_checkcast_class(u1 *sp);
149 #define PATCHER_checkcast_class (functionptr) patcher_checkcast_class
151 bool patcher_instanceof_class(u1 *sp);
152 #define PATCHER_instanceof_class (functionptr) patcher_instanceof_class
154 #else /* defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) */
156 bool patcher_checkcast_instanceof_class(u1 *sp);
157 #define PATCHER_checkcast_instanceof_class (functionptr) patcher_checkcast_instanceof_class
159 #endif /* defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) */
161 bool patcher_clinit(u1 *sp);
162 #define PATCHER_clinit (functionptr) patcher_clinit
164 bool patcher_athrow_areturn(u1 *sp);
165 #define PATCHER_athrow_areturn (functionptr) patcher_athrow_areturn
167 #if !defined(ENABLE_STATICVM)
168 bool patcher_resolve_native(u1 *sp);
169 #define PATCHER_resolve_native (functionptr) patcher_resolve_native
170 #endif /* !defined(ENABLE_STATICVM) */
172 #endif /* _PATCHER_H */
176 * These are local overrides for various environment variables in Emacs.
177 * Please do not remove this and leave it at the end of the file, where
178 * Emacs will automagically detect them.
179 * ---------------------------------------------------------------------
182 * indent-tabs-mode: t
186 * vim:noexpandtab:sw=4:ts=4: