1 /* jit/inline.h - code inliner
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5 M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6 P. Tomsich, J. Wenninger
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: Dieter Thuernbeck
29 $Id: inline.h 1494 2004-11-12 13:34:26Z twisti $
38 #include "toolbox/list.h"
40 #define INLINING_MAXDEPTH 1
41 #define INLINING_MAXCODESIZE 32
42 #define INLINING_MAXMETHODS 8
63 } inlining_methodinfo;
69 /* saved static compiler variables */
73 /* restored through method */
75 /* int jcodelength; */
77 /* classinfo *class; */
79 /* descriptor never used */
80 /* maxstack used outside of main for loop */
81 /* maxlocals never used */
83 /* exceptiontablelength */
84 /* raw_extable used outside of main for loop */
85 /* mreturntype used outside of main for loop */
86 /* mparamcount used outside of main for loop */
87 /* mparamtypes used outside of main for loop */
89 /* local variables used in parse() */
91 int i; /* temporary for different uses (counters)*/
92 int p; /* java instruction counter */
93 int nextp; /* start of next java instruction */
94 int opcode; /* java opcode */
98 inlining_methodinfo *inlinfo;
100 } t_inlining_stacknode;
102 typedef struct t_inlining_globals { /* try in parse.h with struct not include */
103 bool isinlinedmethod;
104 int cumjcodelength; /* cumulative immediate intruction length */
106 int cumextablelength;
107 int cumlocals; /* was static */
108 int cummethods; /* was static */
109 list *inlining_stack; /* was static */
110 inlining_methodinfo *inlining_rootinfo;
116 } t_inlining_globals;
119 /* function prototypes*/
121 void inlining_setup(methodinfo *m, t_inlining_globals *inline_env);
122 void inlining_cleanup(t_inlining_globals *inline_env);
123 void inlining_push_compiler_variables(
124 int i, int p, int nextp, int opcode,
125 u2 lineindex,u2 currentline,u2 linepcchange,
126 inlining_methodinfo* inlinfo,
127 t_inlining_globals *inline_env);
128 void inlining_pop_compiler_variables(
129 int *i, int *p, int *nextp, int *opcode,
130 u2 *lineindex,u2 *currentline,u2 *linepcchange,
131 inlining_methodinfo **inlinfo,
132 t_inlining_globals *inline_env);
133 void inlining_set_compiler_variables_fun(methodinfo *m,
134 t_inlining_globals *inline_env);
135 classinfo *first_occurence(classinfo* class, utf* name, utf* desc);
136 bool is_unique_rec(classinfo *class, methodinfo *m, utf* name, utf* desc);
137 bool is_unique_method(classinfo *class, methodinfo *m, utf* name, utf* desc);
138 inlining_methodinfo *inlining_analyse_method(methodinfo *m,
140 int firstlocal, int maxstackdepth, t_inlining_globals *inline_env);
142 void print_t_inlining_globals (t_inlining_globals *g);
143 void print_inlining_stack ( list *s);
144 void print_inlining_methodinfo( inlining_methodinfo *r);
146 #define inlining_save_compiler_variables() \
147 inlining_push_compiler_variables(i,p,nextp,opcode, lineindex,currentline, \
148 linepcchange,inlinfo,inline_env)
150 #define inlining_restore_compiler_variables() \
151 inlining_pop_compiler_variables(&i, &p, &nextp, &opcode, \
152 &lineindex,¤tline,&linepcchange,&inlinfo, \
155 #define inlining_set_compiler_variables(i) \
158 inlining_set_compiler_variables_fun(i->method, inline_env); \
162 #endif /* _INLINE_H */
165 * These are local overrides for various environment variables in Emacs.
166 * Please do not remove this and leave it at the end of the file, where
167 * Emacs will automagically detect them.
168 * ---------------------------------------------------------------------
171 * indent-tabs-mode: t