1 /* vm/jit/replace.h - on-stack replacement of methods
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, 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., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Edwin Steiner
41 #include "vm/method.h"
45 typedef struct rplalloc rplalloc;
47 /* `rplalloc` is a compact struct for register allocation info */
50 unsigned int index:16; /* register index / stack slot offset */
51 unsigned int flags:4; /* OR of (INMEMORY,...) */
52 int type:4; /* TYPE_... constant */
53 unsigned int next:1; /* if true, switch to next local */
57 #error value of INMEMORY is too big to fit in rplalloc.flags
60 /* An `rplpoint` represents a replacement point in a compiled method */
63 u1 *pc; /* machine code PC of this point */
64 u1 *outcode; /* pointer to replacement-out code*/
65 rplpoint *hashlink; /* chain to next rplpoint in hash */ /* XXX needed? */
66 codeinfo *code; /* codeinfo this point belongs to */
67 rplpoint *target; /* target of the replacement */
68 u8 mcode; /* saved maching code for patching*/
69 rplalloc *regalloc; /* pointer to register index table*/
70 s4 regalloccount;/* number of local allocations */
73 /* An `executionsstate` represents the state of a thread as it reached */
74 /* an replacement point or is about to enter one. */
76 struct executionstate {
77 u1 *pc; /* program counter */
78 u1 *sp; /* stack pointer within method */
80 u8 intregs[INT_REG_CNT]; /* register values */
81 u8 fltregs[FLT_REG_CNT]; /* register values */
84 /* `sourcestate` will probably only be used for debugging */
90 u8 *javalocals; /* indexed by (i*5 + type) */
93 u8 savedintregs[INT_SAV_CNT + 1]; /* XXX */
94 u8 savedfltregs[FLT_SAV_CNT + 1]; /* XXX */
97 /*** prototypes ********************************************************/
99 bool replace_create_replacement_points(codeinfo *code,registerdata *rd);
100 void replace_free_replacement_points(codeinfo *code);
102 void replace_activate_replacement_point(rplpoint *rp,rplpoint *target);
103 void replace_deactivate_replacement_point(rplpoint *rp);
104 void replace_activate(codeinfo *code,codeinfo *target);
106 void replace_me(rplpoint *rp,executionstate *es);
109 void replace_show_replacement_points(codeinfo *code);
110 void replace_replacement_point_println(rplpoint *rp);
111 void replace_executionstate_println(executionstate *es,codeinfo *code);
112 void replace_sourcestate_println(sourcestate *ss);
115 /* machine dependent functions (code in ARCH_DIR/md.c) */
117 #if defined(ENABLE_JIT)
118 void md_patch_replacement_point(rplpoint *rp);
124 * These are local overrides for various environment variables in Emacs.
125 * Please do not remove this and leave it at the end of the file, where
126 * Emacs will automagically detect them.
127 * ---------------------------------------------------------------------
130 * indent-tabs-mode: t
134 * vim:noexpandtab:sw=4:ts=4: