/* src/vm/jit/inline/inline.c - method inlining
- Copyright (C) 1996-2005, 2006, 2007 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, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
#include "mm/memory.h"
-#include "threads/lock-common.h"
-#include "threads/threads-common.h"
+#include "threads/lock.hpp"
+#include "threads/mutex.hpp"
+#include "threads/thread.hpp"
#include "toolbox/logging.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.hpp"
#include "vm/global.h"
-#include "vm/initialize.h"
+#include "vm/initialize.hpp"
+#include "vm/method.h"
+#include "vm/options.h"
+#include "vm/statistics.h"
-#include "vm/jit/jit.h"
-#include "vm/jit/parse.h"
+#include "vm/jit/jit.hpp"
+#include "vm/jit/parse.hpp"
#include "vm/jit/reg.h"
-#include "vm/jit/show.h"
+#include "vm/jit/show.hpp"
#include "vm/jit/stack.h"
#include "vm/jit/inline/inline.h"
#include "vm/jit/verify/typecheck.h"
-#include "vmcore/class.h"
-#include "vmcore/method.h"
-#include "vmcore/options.h"
-#include "vmcore/statistics.h"
-
/* algorithm tuning constants *************************************************/
#if !defined(NDEBUG)
#define INLINE_VERBOSE
-#define DOLOG(code) do{ if (opt_TraceInlining) { code; } }while(0)
+#define DOLOG(code) do{ if (opt_TraceInlining >= 2) { code; } }while(0)
+#define DOLOG_SHORT(code) do{ if (opt_TraceInlining >= 1) { code; } }while(0)
#else
#define DOLOG(code)
#endif
/* call parse pass */
- DOLOG( log_message_class("Parsing ", m->class) );
+ DOLOG( log_message_class("Parsing ", m->clazz) );
if (!parse(jd)) {
return false;
}
/* enter a monitor on the method */
- LOCK_MONITOR_ENTER(m);
+ Mutex_lock(m->mutex);
/* allocate jitdata structure and fill it */
/* leave the monitor */
- LOCK_MONITOR_EXIT(m);
+ Mutex_unlock(m->mutex);
return r;
}
}
+#if 0
static void inline_add_blocknr_reference(inline_node *iln, s4 *nrp)
{
inline_target_ref *ref;
ref->next = iln->refs;
iln->refs = ref;
}
+#endif
static void inline_block_translation(inline_node *iln, basicblock *o_bptr, basicblock *n_bptr)
syncvar = inline_new_temp_variable(iln->ctx->resultjd, TYPE_ADR);
n_ins = inline_instruction(iln, ICMD_ACONST, o_iptr);
- n_ins->sx.val.c.cls = callee->m->class;
+ n_ins->sx.val.c.cls = callee->m->clazz;
n_ins->dst.varindex = syncvar;
n_ins->flags.bits |= INS_FLAG_CLASS;
}
n_ins = master->inlined_iinstr_cursor++;
if (iln->m->flags & ACC_STATIC) {
n_ins->opc = ICMD_ACONST;
- n_ins->sx.val.c.cls = iln->m->class;
+ n_ins->sx.val.c.cls = iln->m->clazz;
n_ins->flags.bits = INS_FLAG_CLASS;
}
else {
/* we need bigger free memory stacks (XXX these should not be allocated in reg_setup) */
n_jd->rd->freemem = DMNEW(s4, iln->ctx->maxinoutdepth + 1000) /* XXX max vars/block */;
-#if defined(HAS_4BYTE_STACKSLOT)
- n_jd->rd->freemem_2 = DMNEW(s4, iln->ctx->maxinoutdepth + 1000) /* XXX max vars/block */;
-#endif
#if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
if ( (n_jd->instructioncount >= opt_InlineMinSize)
&& (n_jd->instructioncount <= opt_InlineMaxSize))
{
- if (debug_counter <= opt_InlineCount)
+ if (debug_counter < opt_InlineCount)
#endif /* defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG) */
{
/* install the inlined result */
#if !defined(NDEBUG)
inline_stat_roots++;
- DOLOG(
+ DOLOG_SHORT(
printf("==== %d.INLINE ==================================================================\n",
debug_counter);
printf("\ninline tree:\n");