* src/cacaoh/cacaoh.c (main): Removed linkverbose.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Tue, 18 Sep 2007 13:50:31 +0000 (15:50 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Tue, 18 Sep 2007 13:50:31 +0000 (15:50 +0200)
* src/vm/vm.c (vm_printconfig): Made static.
(vm_create): Call vm_printconfig after the VM is initialized.
* src/vm/vm.h (vm_printconfig): Removed.

* src/vmcore/linker.c (TRACELINKCLASS): New macro.
(link_class_intern): Use TRACELINKCLASS.

* src/vmcore/options.c (linkverbose): Removed.
(opt_TraceLinkClass): Added.
(options_xx): OPT_PrintConfig: Don't call vm_printconfig,
OPT_TraceLinkClass: Added.
* src/vmcore/options.h (linkverbose): Removed.
(opt_TraceLinkClass): Added.

src/cacaoh/cacaoh.c
src/vm/vm.c
src/vm/vm.h
src/vmcore/linker.c
src/vmcore/options.c
src/vmcore/options.h

index 8590feb5ee2f7357739adb3869911fd8c224d5d4..91177b244e28f822f038e7e21d7fc2c7aa551bea 100644 (file)
@@ -247,7 +247,6 @@ int main(int argc, char **argv)
                case OPT_VERBOSE:
                        opt_verbose = true;
                        loadverbose = true;
-                       linkverbose = true;
                        break;
 
                default:
index 991ee4a4ad0c6383be0158f482e1d58e5deeab1c..41d5a75bba1b901a43c7c037d356549c96bb2181 100644 (file)
@@ -634,7 +634,7 @@ static void fullversion(void)
 }
 
 
-void vm_printconfig(void)
+static void vm_printconfig(void)
 {
        puts("Configure/Build options:\n");
        puts("  ./configure: "VERSION_CONFIGURE_ARGS"");
@@ -1639,6 +1639,14 @@ bool vm_create(JavaVMInitArgs *vm_args)
 
        vm_initializing = false;
 
+#if !defined(NDEBUG)
+       /* Print the VM configuration after all stuff is set and the VM is
+          initialized. */
+
+       if (opt_PrintConfig)
+               vm_printconfig();
+#endif
+
        /* everything's ok */
 
        return true;
index 7f1a46771fd5111eed44c8e28df456fda78ce760..997636a3e15fef75cfdb4c0b4efd5b5af563c9de 100644 (file)
@@ -61,7 +61,6 @@ extern u1 *intrp_main_stack;
 /* function prototypes ********************************************************/
 
 void usage(void);
-void vm_printconfig(void);
 
 bool vm_createjvm(JavaVM **p_vm, void **p_env, void *vm_args);
 bool vm_create(JavaVMInitArgs *vm_args);
index 0c9f34af1121b6a16ff003ce24a5cc6e8fdb221f..fa58ea474037edef5def1385860352c75c63ce04 100644 (file)
 #include "vmcore/options.h"
 #include "vmcore/rt-timing.h"
 
+
+/* debugging macros ***********************************************************/
+
+#if !defined(NDEBUG)
+# define TRACELINKCLASS(c) \
+    do { \
+        if (opt_TraceLinkClass) { \
+            log_start(); \
+            log_print("[Linking "); \
+            class_print((c)); \
+            log_print("]"); \
+            log_finish(); \
+        } \
+    } while (0)
+#else
+# define TRACELINKCLASS(c)
+#endif
+
+
 /* #include "vm/resolve.h" */
 /* copied prototype to avoid bootstrapping problem: */
 classinfo *resolve_classref_or_classinfo_eager(classref_or_classinfo cls, bool checkaccess);
@@ -518,10 +537,7 @@ static classinfo *link_class_intern(classinfo *c)
 
        RT_TIMING_GET_TIME(time_start);
 
-#if !defined(NDEBUG)
-       if (linkverbose)
-               log_message_class("Linking class: ", c);
-#endif
+       TRACELINKCLASS(c);
 
        /* the class must be loaded */
 
@@ -930,11 +946,6 @@ static classinfo *link_class_intern(classinfo *c)
                FREE(wi, method_worklist);
        }
 
-#if !defined(NDEBUG)
-       if (linkverbose)
-               log_message_class("Linking done class: ", c);
-#endif
-
        RT_TIMING_TIME_DIFF(time_start        ,time_resolving    ,RT_TIMING_LINK_RESOLVE);
        RT_TIMING_TIME_DIFF(time_resolving    ,time_compute_vftbl,RT_TIMING_LINK_C_VFTBL);
        RT_TIMING_TIME_DIFF(time_compute_vftbl,time_abstract     ,RT_TIMING_LINK_ABSTRACT);
index 71a94838b7bcdaa0e38f8123b3fe1f0b63edf2d0..b6435373f38741ed0b9fcbb46ea71e803369692c 100644 (file)
@@ -75,7 +75,6 @@ bool opt_debugcolor = false;  /* use ANSI terminal sequences                */
 bool compileall = false;
 
 bool loadverbose = false;
-bool linkverbose = false;
 bool initverbose = false;
 
 bool opt_verboseclass     = false;
@@ -198,6 +197,7 @@ int32_t  opt_TraceExceptions           = 0;
 int32_t  opt_TraceJavaCalls            = 0;
 int32_t  opt_TraceJNICalls             = 0;
 int32_t  opt_TraceJVMCalls             = 0;
+int32_t  opt_TraceLinkClass            = 0;
 #if defined(ENABLE_REPLACEMENT)
 int32_t  opt_TraceReplacement          = 0;
 #endif
@@ -230,6 +230,7 @@ enum {
        OPT_TraceJavaCalls,
        OPT_TraceJNICalls,
        OPT_TraceJVMCalls,
+       OPT_TraceLinkClass,
        OPT_TraceReplacement
 };
 
@@ -260,6 +261,7 @@ option_t options_XX[] = {
        { "TraceJavaCalls",            OPT_TraceJavaCalls,            OPT_TYPE_BOOLEAN, "trace Java method calls" },
        { "TraceJNICalls",             OPT_TraceJNICalls,             OPT_TYPE_BOOLEAN, "trace JNI method calls" },
        { "TraceJVMCalls",             OPT_TraceJVMCalls,             OPT_TYPE_BOOLEAN, "TODO" },
+       { "TraceLinkClass",            OPT_TraceLinkClass,            OPT_TYPE_BOOLEAN, "trace class linking" },
 #if defined(ENABLE_REPLACEMENT)
        { "TraceReplacement",          OPT_TraceReplacement,          OPT_TYPE_VALUE,   "trace on-stack replacement with the given verbosity level (default: 1)" },
 #endif
@@ -567,7 +569,7 @@ void options_xx(JavaVMInitArgs *vm_args)
                        break;
 
                case OPT_PrintConfig:
-                       vm_printconfig();
+                       opt_PrintConfig = enable;
                        break;
 
                case OPT_ProfileGCMemoryUsage:
@@ -625,6 +627,10 @@ void options_xx(JavaVMInitArgs *vm_args)
                        opt_TraceJVMCalls = enable;
                        break;
 
+       case OPT_TraceLinkClass:
+               opt_TraceLinkClass = enable;
+               break;
+
 #if defined(ENABLE_REPLACEMENT)
                case OPT_TraceReplacement:
                        if (value == NULL)
index bd289bd53f0c995971b61c08b9c456ddd60ab0a4..15dbbd9d030854bdb1eedc8c6d0747d0acfada54 100644 (file)
@@ -90,7 +90,6 @@ extern bool opt_debugcolor;
 extern bool compileall;
 
 extern bool loadverbose;         /* Print debug messages during loading */
-extern bool linkverbose;
 extern bool initverbose;         /* Log class initialization */ 
 
 extern bool opt_verboseclass;
@@ -213,6 +212,7 @@ extern int32_t  opt_TraceExceptions;
 extern int32_t  opt_TraceJavaCalls;
 extern int32_t  opt_TraceJNICalls;
 extern int32_t  opt_TraceJVMCalls;
+extern int32_t  opt_TraceLinkClass;
 #if defined(ENABLE_REPLACEMENT)
 extern int32_t  opt_TraceReplacement;
 #endif