/* src/vm/jit/inline/inline.c - code inliner
- Copyright (C) 1996-2005 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 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
This file is part of CACAO.
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., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
- Contact: cacao@complang.tuwien.ac.at
+ Contact: cacao@cacaojvm.org
Authors: Dieter Thuernbeck
- $Id: inline.c 2788 2005-06-22 16:08:51Z edwin $
+ Changes: Christian Thalinger
+
+ $Id: inline.c 4357 2006-01-22 23:33:38Z twisti $
*/
#include "vm/global.h"
#include "vm/linker.h"
#include "vm/loader.h"
-#include "vm/tables.h"
#include "vm/options.h"
#include "vm/resolve.h"
#include "vm/statistics.h"
printf("<j%i/l%i/s%i/(p)%i>\t", \
(mm)->jcodelength,(mm)->maxlocals, \
(mm)->maxstack, (mm)->paramcount); \
- method_display_w_class(mm); }
+ method_println(mm); }
#define METHINFOx(mm) \
{ \
printf("<c%i/m%i/p%i>\t", \
(mm)->class->classUsed,(mm)->methodUsed, (mm)->monoPoly); \
- method_display_w_class(mm); }
+ method_println(mm); }
#define METHINFO(m) \
- method_display_w_class(m);
+ method_println(m);
#define IMETHINFO(m) \
utf_display(m->class->name); printf("."); fflush(stdout); \
- method_display(m); fflush(stdout); \
+ method_println(m); fflush(stdout); \
printf("\tm->jcodelength=%i; ",m->jcodelength); fflush(stdout); \
printf("m->jcode=%p;\n",m->jcode); fflush(stdout); \
printf("\tm->maxlocals=%i; ",m->maxlocals); fflush(stdout); \
inline_env->inlining_stack = NULL;
inline_env->inlining_rootinfo = NULL;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (in_stats1) {
int ii;
for (ii=0; ii<512; ii++) count_in_not[ii]=0;
/* t_inlining_globals *inline_env = DNEW(t_inlining_globals); */
inlining_init0(m,inline_env);
-/* define in options.h; Used in main.c, jit.c & inline.c */
-#ifdef INAFTERMAIN
-if ((utf_new_char("main") == m->name) && (useinliningm)) {
- useinlining = true;
- }
-#endif
-
if (useinlining)
{
#ifdef DEBUGi
((opcode != JAVA_INVOKEVIRTUAL) ||
(opcode != JAVA_INVOKEINTERFACE)) ) &&
(inlineexceptions || (imi->exceptiontablelength == 0))) {
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in++;
if (inlinevirtuals) {
if (opcode == JAVA_INVOKEVIRTUAL) {
if (imi->flags & ACC_NATIVE) return can;
if (imi->flags & ACC_ABSTRACT) return can;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_rejected++;
#endif
if (opt_verbose)
if (!(inlineoutsiders) && (m->class->name != imr->classref->name)) {
/*** if ((!mult) && (whycannot > 0)) mult = true; *** First time not needed ***/
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_outsiders++;
#endif
whycannot = whycannot | IN_OUTSIDERS; /* outsider */
}
if (inline_env->cummethods >= INLINING_MAXMETHODS) {
if ((!mult) && (whycannot > 0)) mult = true;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_maxDepth++;
#endif
whycannot = whycannot | IN_MAXDEPTH;
if (uniqueVirt ) {
/* so know why (and that) a unique virtual was rejected for another reason */
if (opcode == JAVA_INVOKEVIRTUAL) {
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_uniqueVirt_not_inlined++;
#endif
whycannot = whycannot | IN_UNIQUEVIRT;
}
else {
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_uniqueInterface_not_inlined++;
#endif
whycannot = whycannot | IN_UNIQUE_INTERFACE;
if (inlineoutsiders && (m->class->name != imr->classref->name)) {
whycannot = whycannot | IN_OUTSIDERS; /* outsider */
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_outsiders++;
#endif
}
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
if (mult)
count_in_rejected_mult++;
#endif
log_text("Inline Whynot is too large???");
assert(0);
}
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_not[whycannot]++;
#endif
}
if (opt_stat) {
if ((!isnotrootlevel) && !maxdepthHit) {
maxdepthHit = true;
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
count_in_maxDepth++;
#endif
}
if (opcode ==JAVA_INVOKEINTERFACE) {
imr = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
+ if (!imr)
+ return NULL;
if (!resolve_classref(m,imr->classref,resolveEager,true, true,&imrclass)) {
log_text("Could not resolve class reference");
assert(0);
} else {
imr = class_getconstant(m->class, i, CONSTANT_Methodref);
+ if (!imr)
+ return NULL;
if (!resolve_classref(m,imr->classref,resolveEager,true, true,&imrclass)) {
log_text("Could not resolve class reference");
assert(0);
if (r->method != NULL) {
utf_display(r->method->class->name); printf("."); fflush(stdout); \
- method_display(r->method); fflush(stdout); \
+ method_println(r->method); fflush(stdout); \
}
else {
printf(" NULL!!!!!\n");fflush(stdout);