dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 7219 2007-01-16 22:18:57Z pm $
+dnl $Id: configure.ac 7228 2007-01-19 01:13:48Z edwin $
dnl Process this file with autoconf to produce a configure script.
fi
+dnl check for inlining debug options
+AC_MSG_CHECKING(whether method inlining debug options should be enabled)
+AC_ARG_ENABLE([inlining-debug],
+ [AS_HELP_STRING(--enable-inlining-debug,enable method inlining debug options [[default=no]])],
+ [case "${enableval}" in
+ yes) ENABLE_INLINING_DEBUG=yes;;
+ *) ENABLE_INLINING_DEBUG=no;;
+ esac],
+ [ENABLE_INLINING_DEBUG=no])
+AC_MSG_RESULT(${ENABLE_INLINING_DEBUG})
+AM_CONDITIONAL([ENABLE_INLINING_DEBUG], test x"${ENABLE_INLINING_DEBUG}" = "xyes")
+
+if test x"${ENABLE_INLINING_DEBUG}" = "xyes"; then
+ AC_DEFINE([ENABLE_INLINING_DEBUG], 1, [enable method inlining debug options])
+fi
+
+
dnl check for replacement
AC_MSG_CHECKING(whether on-stack replacement should be supported)
AC_ARG_ENABLE([replacement],
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: headers.c 7218 2007-01-16 12:59:51Z twisti $
+ $Id: headers.c 7228 2007-01-19 01:13:48Z edwin $
*/
#endif
-#if !defined(NDEBUG)
-/* dummy variable */
-bool inline_debug_log = false;
-#endif
-
-
/* for raising exceptions from native methods *********************************/
#if !defined(ENABLE_THREADS)
Authors: Christian Thalinger
Edwin Steiner
- $Id: exceptions.c 6598 2007-01-11 14:28:47Z twisti $
+ $Id: exceptions.c 7228 2007-01-19 01:13:48Z edwin $
*/
char *msg;
s4 msglen;
- useinlining = false; /* at least until sure inlining works with exceptions*/
-
/* calculate exception message length */
msglen = 0;
Changes:
- $Id: inline.c 7209 2007-01-13 22:30:25Z edwin $
+ $Id: inline.c 7228 2007-01-19 01:13:48Z edwin $
*/
#if !defined(NDEBUG)
#define INLINE_VERBOSE
-bool inline_debug_log = 0;
-bool inline_debug_log_names = 0;
-int inline_debug_start_counter = 0;
-int inline_debug_max_size = INT_MAX;
-int inline_debug_min_size = 0;
-int inline_debug_end_counter = INT_MAX;
-#define DOLOG(code) do{ if (inline_debug_log) { code; } }while(0)
+#define DOLOG(code) do{ if (opt_inline_debug_log) { code; } }while(0)
#else
#define DOLOG(code)
#endif
+#if defined(ENABLE_VERIFIER) && !defined(NDEBUG)
+/* Define this to verify the resulting code after inlining. */
+/* Note: This is only useful for development and may require patches to the */
+/* verifier code. */
+/* #define INLINE_VERIFY_RESULT */
+#endif
+
/* types **********************************************************************/
codegendata *n_cd;
jitdata *n_jd;
s4 i;
-
-
-#if !defined(NDEBUG)
- static int debug_verify_inlined_code = 1; /* XXX */
- static int debug_compile_inlined_code_counter = 0;
+#if defined(INLINE_VERIFY_RESULT)
+ static int debug_verify_inlined_code = 1;
+#endif
+#if defined(ENABLE_INLINING_DEBUG)
+ static int debug_counter = 0;
#endif
DOLOG( dump_inline_tree(iln, 0); );
n_jd->localcount = n_jd->vartop;
- /* extra variables for verification (DEBUG) */
+ /* extra variables for verification (debugging) */
-#if !defined(NDEBUG)
+#if defined(INLINE_VERIFY_RESULT)
if (debug_verify_inlined_code) {
n_jd->vartop += VERIFIER_EXTRA_LOCALS + VERIFIER_EXTRA_VARS + 100 /* XXX m->maxstack */;
if (n_jd->vartop > n_jd->varcount) {
n_jd->varcount = n_jd->vartop;
}
}
-#endif
+#endif /* defined(INLINE_VERIFY_RESULT) */
/* write inlined code */
inline_interface_variables(iln);
-#if defined(ENABLE_VERIFIER) && !defined(NDEBUG) && 0
+ /* for debugging, verify the inlined result */
+
+#if defined(INLINE_VERIFY_RESULT)
if (debug_verify_inlined_code) {
debug_verify_inlined_code = 0;
DOLOG( printf("VERIFYING INLINED RESULT...\n"); fflush(stdout); );
}
debug_verify_inlined_code = 1;
}
-#endif /* defined(ENABLE_VERIFIER) */
+#endif /* defined(INLINE_VERIFY_RESULT) */
/* we need bigger free memory stacks (XXX these should not be allocated in reg_setup) */
n_jd->rd->freemem_2 = DMNEW(s4, iln->ctx->maxinoutdepth + 1000) /* XXX max vars/block */;
#endif
-#if !defined(NDEBUG)
- if (n_jd->instructioncount >= inline_debug_min_size
- && n_jd->instructioncount <= inline_debug_max_size)
+#if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
+ if ( (n_jd->instructioncount >= opt_inline_debug_min_size)
+ && (n_jd->instructioncount <= opt_inline_debug_max_size))
{
- if (debug_compile_inlined_code_counter >= inline_debug_start_counter
- && debug_compile_inlined_code_counter <= inline_debug_end_counter)
-#endif /* NDEBUG */
+ if (debug_counter <= opt_inline_debug_end_counter)
+#endif /* defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG) */
{
/* install the inlined result */
n_jd->code = jd->code;
*jd = *n_jd;
+ /* statistics and logging */
+
#if !defined(NDEBUG)
inline_stat_roots++;
- /* inline_debug_log++; */
DOLOG(
- printf("==== %d.INLINE ==================================================================\n", debug_compile_inlined_code_counter);
+ printf("==== %d.INLINE ==================================================================\n",
+ debug_counter);
printf("\ninline tree:\n");
dump_inline_tree(iln, 0);
n_jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE | JITDATA_FLAG_SHOWDISASSEMBLE;
printf("-------- DONE -----------------------------------------------------------\n");
fflush(stdout);
);
- /* inline_debug_log--; */
#endif
}
-#if !defined(NDEBUG)
- debug_compile_inlined_code_counter++;
+#if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
+ debug_counter++;
}
#endif
return true;
Christian Thalinger
Christian Ullrich
- $Id: jit.c 7210 2007-01-13 22:37:26Z edwin $
+ $Id: jit.c 7228 2007-01-19 01:13:48Z edwin $
*/
jd->flags |= JITDATA_FLAG_IFCONV;
#endif
+#if defined(ENABLE_INLINING) && defined(ENABLE_INLINING_DEBUG)
+ if (opt_inlining && opt_inline_debug_all)
+ jd->flags |= JITDATA_FLAG_INLINE;
+#endif
+
if (opt_showintermediate)
jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
Edwin Steiner
Christian Thalinger
- $Id: linker.c 6251 2006-12-27 23:15:56Z twisti $
+ $Id: linker.c 7228 2007-01-19 01:13:48Z edwin $
*/
#if !defined(NDEBUG) && defined(ENABLE_INLINING)
-extern bool inline_debug_log;
-#define INLINELOG(code) do { if (inline_debug_log) { code } } while (0)
+#define INLINELOG(code) do { if (opt_inline_debug_log) { code } } while (0)
#else
#define INLINELOG(code)
#endif
Edwin Steiner
Christian Thalinger
- $Id: method.c 6273 2007-01-03 22:20:25Z edwin $
+ $Id: method.c 7228 2007-01-19 01:13:48Z edwin $
*/
#if !defined(NDEBUG) && defined(ENABLE_INLINING)
-extern bool inline_debug_log;
-#define INLINELOG(code) do { if (inline_debug_log) { code } } while (0)
+#define INLINELOG(code) do { if (opt_inline_debug_log) { code } } while (0)
#else
#define INLINELOG(code)
#endif
Changes:
- $Id: options.c 5922 2006-11-05 21:43:09Z twisti $
+ $Id: options.c 7228 2007-01-19 01:13:48Z edwin $
*/
#include "config.h"
#include <string.h>
+#include <limits.h>
#include "vm/types.h"
bool opt_showexceptionstubs = false;
bool opt_shownativestub = false;
-bool useinlining = false; /* use method inlining */
-bool inlinevirtuals = false; /* inline unique virtual methods */
-bool inlineexceptions = false; /* inline methods, that contain excptions */
-bool inlineparamopt = false; /* optimize parameter passing to inlined methods */
-bool inlineoutsiders = false; /* inline methods, that are not member of the invoker's class */
-
bool checkbounds = true; /* check array bounds */
bool checknull = true; /* check null pointers */
bool opt_noieee = false; /* don't implement ieee compliant floats */
#endif
+/* inlining options ***********************************************************/
+
+#if defined(ENABLE_INLINING)
+bool opt_inlining = false;
+#if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
+s4 opt_replace_verbose = 0;
+s4 opt_inline_debug_min_size = 0;
+s4 opt_inline_debug_max_size = INT_MAX;
+s4 opt_inline_debug_end_counter = INT_MAX;
+bool opt_inline_debug_all = false;
+#endif /* defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG) */
+#if !defined(NDEBUG)
+bool opt_inline_debug_log = false;
+#endif /* !defined(NDEBUG) */
+#endif /* defined(ENABLE_INLINING) */
+
+
/* optimization options *******************************************************/
#if defined(ENABLE_IFCONV)
Changes:
- $Id: options.h 5922 2006-11-05 21:43:09Z twisti $
+ $Id: options.h 7228 2007-01-19 01:13:48Z edwin $
*/
extern bool opt_showexceptionstubs;
extern bool opt_shownativestub;
-extern bool useinlining;
-extern bool inlinevirtuals;
-extern bool inlineexceptions;
-extern bool inlineparamopt;
-extern bool inlineoutsiders;
-
extern bool checkbounds;
extern bool checknull;
extern bool opt_noieee;
extern bool opt_prof_bb;
#endif
+/* inlining options ***********************************************************/
+
+#if defined(ENABLE_INLINING)
+extern bool opt_inlining;
+#if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
+extern s4 opt_replace_verbose;
+extern s4 opt_inline_debug_min_size;
+extern s4 opt_inline_debug_max_size;
+extern s4 opt_inline_debug_end_counter;
+extern bool opt_inline_debug_all;
+#endif /* defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG) */
+#if !defined(NDEBUG)
+extern bool opt_inline_debug_log;
+#endif /* !defined(NDEBUG) */
+#endif /* defined(ENABLE_INLINING) */
+
/* optimization options *******************************************************/
#if defined(ENABLE_INLINING)
OPT_INLINING,
-#endif
+#if !defined(NDEBUG)
+ OPT_INLINE_LOG,
+#endif
+#if defined(ENABLE_INLINING_DEBUG)
+ OPT_INLINE_DEBUG_ALL,
+ OPT_INLINE_DEBUG_END,
+ OPT_INLINE_DEBUG_MIN,
+ OPT_INLINE_DEBUG_MAX,
+ OPT_INLINE_REPLACE_VERBOSE,
+ OPT_INLINE_REPLACE_VERBOSE2,
+#endif /* defined(ENABLE_INLINING_DEBUG) */
+#endif /* defined(ENABLE_INLINING) */
#if defined(ENABLE_INTRP)
/* interpreter options */
{ "Xprof", false, OPT_PROF },
#endif
- /* keep these at the end of the list */
+ /* inlining options */
#if defined(ENABLE_INLINING)
- { "i", true, OPT_INLINING },
+#if defined(ENABLE_INLINING_DEBUG)
+ { "ia", false, OPT_INLINE_DEBUG_ALL },
+ { "ii", true, OPT_INLINE_DEBUG_MIN },
+ { "im", true, OPT_INLINE_DEBUG_MAX },
+ { "ie", true, OPT_INLINE_DEBUG_END },
+ { "ir", false, OPT_INLINE_REPLACE_VERBOSE },
+ { "iR", false, OPT_INLINE_REPLACE_VERBOSE2 },
+#endif /* defined(ENABLE_INLINING_DEBUG) */
+#if !defined(NDEBUG)
+ { "il", false, OPT_INLINE_LOG },
#endif
+ { "i", false, OPT_INLINING },
+#endif /* defined(ENABLE_INLINING) */
+
+ /* keep these at the end of the list */
#if !defined(NDEBUG)
{ "m", true, OPT_METHOD },
puts(" (n)ative disassembled native stubs");
#endif
puts(" (d)atasegment data segment listing");
+
#if defined(ENABLE_INLINING)
- puts(" -i n(line) activate inlining");
- puts(" v(irtual) inline virtual methods (uses/turns rt option on)");
- puts(" e(exception) inline methods with exceptions");
- puts(" p(aramopt) optimize argument renaming");
- puts(" o(utsiders) inline methods of foreign classes");
+ puts(" -i activate inlining");
+#if !defined(NDEBUG)
+ puts(" -il log inlining");
+#endif
+#if defined(ENABLE_INLINING_DEBUG)
+ puts(" -ia use inlining for all methods");
+ puts(" -ii <size> set minimum size for inlined result");
+ puts(" -im <size> set maximum size for inlined result");
+ puts(" -ie <number> stop inlining after the given number of roots");
+ puts(" -ir log on-stack replacement");
+ puts(" -iR log on-stack replacement, more verbose");
+#endif /* defined(ENABLE_INLINING_DEBUG) */
#endif /* defined(ENABLE_INLINING) */
+
#if defined(ENABLE_IFCONV)
puts(" -ifconv use if-conversion");
#endif
#endif
#if defined(ENABLE_INLINING)
+#if defined(ENABLE_INLINING_DEBUG)
+ case OPT_INLINE_DEBUG_ALL:
+ opt_inline_debug_all = true;
+ break;
+ case OPT_INLINE_DEBUG_END:
+ opt_inline_debug_end_counter = atoi(opt_arg);
+ break;
+ case OPT_INLINE_DEBUG_MIN:
+ opt_inline_debug_min_size = atoi(opt_arg);
+ break;
+ case OPT_INLINE_DEBUG_MAX:
+ opt_inline_debug_max_size = atoi(opt_arg);
+ break;
+ case OPT_INLINE_REPLACE_VERBOSE:
+ opt_replace_verbose = 1;
+ break;
+ case OPT_INLINE_REPLACE_VERBOSE2:
+ opt_replace_verbose = 2;
+ break;
+#endif /* defined(ENABLE_INLINING_DEBUG) */
+#if !defined(NDEBUG)
+ case OPT_INLINE_LOG:
+ opt_inline_debug_log = true;
+ break;
+#endif /* !defined(NDEBUG) */
+
case OPT_INLINING:
- for (i = 0; i < strlen(opt_arg); i++) {
- switch (opt_arg[i]) {
- case 'n':
- /* define in options.h; Used in main.c, jit.c
- & inline.c inlining is currently
- deactivated */
- break;
- case 'v':
- inlinevirtuals = true;
- break;
- case 'e':
- inlineexceptions = true;
- break;
- case 'p':
- inlineparamopt = true;
- break;
- case 'o':
- inlineoutsiders = true;
- break;
- default:
- usage();
- }
- }
+ opt_inlining = true;
break;
#endif /* defined(ENABLE_INLINING) */