* src/vm/jit/jit.c (TRACECOMPILERCALLS): New macro.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 28 Sep 2007 08:47:38 +0000 (10:47 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 28 Sep 2007 08:47:38 +0000 (10:47 +0200)
(jit_compile): Use TRACECOMPILERCALLS.
(jit_compile_intern): Removed some DEBUG_JIT_COMPILEVERBOSE.

* src/vmcore/options.c (opt_TraceCompilerCalls): New variable.
(options_xx): Handle opt_TraceCompilerCalls.
* src/vmcore/options.h (opt_TraceCompilerCalls): Added.

src/vm/jit/jit.c
src/vmcore/options.c
src/vmcore/options.h

index 08b5fdb2c893cfabeccd7c3be7e48edead6281db..9ed1fc0aa6eec8af6057757e64b95c4501402603 100644 (file)
 /* debug macros ***************************************************************/
 
 #if !defined(NDEBUG)
-#define DEBUG_JIT_COMPILEVERBOSE(x) \
-    do { \
-        if (compileverbose) { \
-            log_message_method(x, m); \
-        } \
+#define DEBUG_JIT_COMPILEVERBOSE(x)                            \
+    do {                                                                               \
+        if (compileverbose) {                                  \
+            log_message_method(x, m);                  \
+        }                                                                              \
     } while (0)
 #else
 #define DEBUG_JIT_COMPILEVERBOSE(x)    /* nothing */
 #endif
 
+#if !defined(NDEBUG)
+# define TRACECOMPILERCALLS()                                                          \
+       do {                                                                                                    \
+               if (opt_TraceCompilerCalls) {                                           \
+                       log_start();                                                                    \
+                       log_print("[JIT compiler started: method=");    \
+                       method_print(m);                                                                \
+                       log_print("]");                                                                 \
+                       log_finish();                                                                   \
+               }                                                                                                       \
+       } while (0)
+#else
+# define TRACECOMPILERCALLS()
+#endif
+
+
 /* the ICMD table ************************************************************/
 
 #if !defined(NDEBUG)
@@ -1025,6 +1040,8 @@ u1 *jit_compile(methodinfo *m)
                return m->code->entrypoint;
        }
 
+       TRACECOMPILERCALLS();
+
        STATISTICS(count_methods++);
 
 #if defined(ENABLE_STATISTICS)
@@ -1277,10 +1294,6 @@ static u1 *jit_compile_intern(jitdata *jd)
        code = jd->code;
        cd   = jd->cd;
        
-       /* print log message for compiled method */
-
-       DEBUG_JIT_COMPILEVERBOSE("Compiling: ");
-
 #if defined(ENABLE_DEBUG_FILTER)
        show_filters_apply(jd->m);
 #endif
@@ -1532,8 +1545,6 @@ static u1 *jit_compile_intern(jitdata *jd)
        }
 #endif
 
-       DEBUG_JIT_COMPILEVERBOSE("Compiling done: ");
-
        /* switch to the newly generated code */
 
        assert(code);
index 5e8483fd1ca6db49928f0219aa937c7cf77890a7..d613ed9d409fc411a2fc2afa14a0f37dc9a85e0f 100644 (file)
@@ -196,6 +196,7 @@ FILE    *opt_ProfileMemoryUsageGNUPlot = NULL;
 int      opt_TestReplacement           = 0;
 #endif
 int32_t  opt_ThreadStackSize           = 0;
+int      opt_TraceCompilerCalls        = 0;
 int32_t  opt_TraceExceptions           = 0;
 int32_t  opt_TraceJavaCalls            = 0;
 int32_t  opt_TraceJNICalls             = 0;
@@ -231,6 +232,7 @@ enum {
        OPT_ProfileMemoryUsageGNUPlot,
        OPT_TestReplacement,
        OPT_ThreadStackSize,
+       OPT_TraceCompilerCalls,
        OPT_TraceExceptions,
        OPT_TraceJavaCalls,
        OPT_TraceJNICalls,
@@ -266,6 +268,7 @@ option_t options_XX[] = {
        { "TestReplacement"          , OPT_TestReplacement,           OPT_TYPE_BOOLEAN, "activate all replacement points during code generation" },
 #endif
        { "ThreadStackSize",           OPT_ThreadStackSize,           OPT_TYPE_VALUE,   "TODO" },
+       { "TraceCompilerCalls",        OPT_TraceCompilerCalls,        OPT_TYPE_BOOLEAN, "trace JIT compiler calls" },
        { "TraceExceptions",           OPT_TraceExceptions,           OPT_TYPE_BOOLEAN, "trace Exception throwing" },
        { "TraceJavaCalls",            OPT_TraceJavaCalls,            OPT_TYPE_BOOLEAN, "trace Java method calls" },
        { "TraceJNICalls",             OPT_TraceJNICalls,             OPT_TYPE_BOOLEAN, "trace JNI method calls" },
@@ -632,6 +635,10 @@ void options_xx(JavaVMInitArgs *vm_args)
                        /* currently ignored */
                        break;
 
+               case OPT_TraceCompilerCalls:
+                       opt_TraceCompilerCalls = enable;
+                       break;
+
                case OPT_TraceExceptions:
                        opt_TraceExceptions = enable;
                        break;
index 134c3e7d629b1e87c827164b722c53ae18f51228..7aeb4253658fde39fab2ef24102af39cadb0ff9e 100644 (file)
@@ -211,6 +211,7 @@ extern FILE    *opt_ProfileMemoryUsageGNUPlot;
 extern int      opt_TestReplacement;
 #endif
 extern int32_t  opt_ThreadStackSize;
+extern int      opt_TraceCompilerCalls;
 extern int32_t  opt_TraceExceptions;
 extern int32_t  opt_TraceJavaCalls;
 extern int32_t  opt_TraceJNICalls;