* src/toolbox/logging.cpp,
authorAndreas HUBERT <andreas.hubert@gmx.at>
Fri, 24 Oct 2008 11:55:59 +0000 (13:55 +0200)
committerAndreas HUBERT <andreas.hubert@gmx.at>
Fri, 24 Oct 2008 11:55:59 +0000 (13:55 +0200)
  src/toolbox/logging.hpp: Switched to C++.

--HG--
rename : src/toolbox/logging.c => src/toolbox/logging.cpp
rename : src/toolbox/logging.h => src/toolbox/logging.hpp

64 files changed:
src/mm/cacao-gc/compact.c
src/mm/cacao-gc/copy.c
src/mm/cacao-gc/gc.c
src/mm/cacao-gc/heap.c
src/mm/cacao-gc/mark.c
src/mm/cacao-gc/region.c
src/mm/cacao-gc/rootset.c
src/mm/gc-boehm.cpp
src/mm/gc-none.cpp
src/mm/memory.c
src/native/jni.cpp
src/native/jvmti/cacaodbg.c
src/native/jvmti/jvmti.c
src/native/localref.cpp
src/native/native.cpp
src/native/vm/cldc1.1/java_lang_Thread.cpp
src/native/vm/gnuclasspath/gnu_classpath_jdwp_VMFrame.c
src/native/vm/gnuclasspath/gnu_classpath_jdwp_VMVirtualMachine.c
src/native/vm/gnuclasspath/gnu_java_lang_management_VMClassLoadingMXBeanImpl.cpp
src/native/vm/gnuclasspath/gnu_java_lang_management_VMThreadMXBeanImpl.cpp
src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp
src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.cpp
src/native/vm/gnuclasspath/sun_reflect_ConstantPool.cpp
src/native/vm/openjdk/jvm.cpp
src/native/vm/openjdk/management.cpp
src/threads/posix/thread-posix.cpp
src/threads/threadlist.cpp
src/toolbox/Makefile.am
src/toolbox/avl.c
src/toolbox/logging.c [deleted file]
src/toolbox/logging.cpp [new file with mode: 0644]
src/toolbox/logging.h [deleted file]
src/toolbox/logging.hpp [new file with mode: 0644]
src/vm/annotation.c
src/vm/class.cpp
src/vm/classcache.cpp
src/vm/jit/allocator/liveness.c
src/vm/jit/allocator/lsra.c
src/vm/jit/arm/emit.c
src/vm/jit/builtin.cpp
src/vm/jit/builtin.hpp
src/vm/jit/codegen-common.cpp
src/vm/jit/inline/inline.cpp
src/vm/jit/intrp/dynamic-super.c
src/vm/jit/jit.cpp
src/vm/jit/loop/analyze.c
src/vm/jit/loop/graph.c
src/vm/jit/loop/loop.c
src/vm/jit/optimizing/lsra.c
src/vm/jit/parse.cpp
src/vm/jit/patcher-common.cpp
src/vm/jit/replace.cpp
src/vm/jit/stack.c
src/vm/jit/stacktrace.cpp
src/vm/jit/trace.cpp
src/vm/jit/trap.c
src/vm/jit/verify/typecheck-typeinferer.cpp
src/vm/jit/verify/typecheck.cpp
src/vm/jit/verify/typeinfo.cpp
src/vm/linker.cpp
src/vm/loader.cpp
src/vm/statistics.c
src/vm/suck.cpp
src/vm/vm.cpp

index 5e384d3978a53a5ab79d9cdb588a6074eff1fbff..80ff5a1bb4e2e4b7809bf0ab3f654b780cf57fb2 100644 (file)
@@ -32,7 +32,7 @@
 #include "heap.h"
 #include "mark.h"
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 
 /* Threading macros ***********************************************************/
index 425da5872b5a50a2c2eb464d16c9a5e773462ee6..7eea339f787a1042e1f9bef2557a16d6b2edc51c 100644 (file)
@@ -34,7 +34,7 @@
 #include "region.h"
 #include "rootset.h"
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "vm/global.h"
 
 
index deb86675a4c02c0a704ea0031c35524434fb3457..cda5c05791a0f77edbe306af58f76bf438f14ace 100644 (file)
@@ -42,7 +42,7 @@
 #include "region.h"
 #include "rootset.h"
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/finalizer.hpp"
 #include "vm/rt-timing.h"
index 22ce0691738fe9c8f42399c8e1be3bd1964972dc..649a59bab49ff2bca0bf591a9f6fbcb4bc273439 100644 (file)
@@ -36,7 +36,7 @@
 #include "mm/memory.h"
 #include "native/include/java_lang_String.h"
 #include "native/llni.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/global.h"
 #include "vm/options.h"
index fedfb9abb750990dd7b339b972510ad343280603..9c81d10d52d024f90c1b86a5fdca11b6701fd327 100644 (file)
@@ -31,7 +31,7 @@
 #include "mark.h"
 #include "rootset.h"
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/global.h"
 #include "vm/linker.hpp"
index 44a443d1ce7f3e0f61c4e62ea903cb9a72928c7d..d625fd5f9b4a41edde1f01d20e54539936580152 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "region.h"
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 
 /* region_init *****************************************************************
index 7761fa8089b0050309df666fa9c841c577b7058a..757468ad1064f67e9348417be27124645f860fde 100644 (file)
@@ -35,7 +35,7 @@
 #include "threads/threadlist.h"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/global.h"
 #include "vm/jit/replace.hpp"
index c8dc49ba2ea09abfb77200cbd93ce35cd60ea07b..7737541bf1262a8325555ef25baf49cbbec0103c 100644 (file)
@@ -41,7 +41,7 @@
 #include "mm/gc.hpp"
 #include "mm/memory.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index d0a488d2ae205a9b300eb038df3b07cdda3e9dc7..2c3a18d07723d4a04741832dd17d476784a17d6e 100644 (file)
@@ -38,7 +38,7 @@
 #include "mm/gc.hpp"
 #include "mm/memory.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/global.h"
index 0774aee016228547abfe7b8d919478d22a72dc4a..4462b8c15e356d5148e2ed7fc6360fd96f4feaae 100644 (file)
@@ -45,7 +45,7 @@
 #include "threads/lock.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/global.h"
 #include "vm/string.hpp"
index 674f3b8b0d4e51084dbb7eb0b7570289fc029a55..21269a989086418d17ddb7a0f14b05b660ea4791 100644 (file)
@@ -47,7 +47,7 @@
 #include "threads/mutex.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/array.hpp"
 #include "vm/jit/builtin.hpp"
index eb29c6f7b5313c27252ea99087e8647816281fd3..85c4f8774414b790f0a60d7002de46a87803de1d 100644 (file)
@@ -32,7 +32,7 @@
 #include "vm/jit/builtin.hpp"
 #include "vm/jit/asmpart.h"
 #include "vm/string.hpp"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "threads/mutex.h"
 #include "threads/thread.hpp"
 
index e152104dc03727f421198320dcd9683368b92726..8aba6633291fb909060f2326b0850275993aa735 100644 (file)
@@ -48,7 +48,7 @@
 #include "vm/class.hpp"
 #include "vm/classcache.hpp"
 #include "mm/gc.hpp"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "vm/options.h"
 #include "vm/string.hpp"
 #include "mm/memory.h"
index d236afb5148224eadcb44773702bf07a12ce969f..3619e0df3660307eef1c7388738d1e6b5ed9bcab 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/options.h"
 #include "vm/vm.hpp"
index 7f0f078ba55f0bd3cfb029a05def1836b3408198..a53f8415239be4fad01430d32aa759f86d4c2cff 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "threads/mutex.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index 99a7393a06f78562a9a4d75d263a9600a63560f7..ce86f79aaa52408606f57d200e3934615a01eb69 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/javaobjects.hpp"
index 9276ebb8feebcbf5fec468178da435e9fc36cf48..4897589cba18cafff294c07586fc88d03aafab10 100644 (file)
@@ -32,7 +32,7 @@
 #include "native/include/java_lang_Object.h"
 #include "native/include/gnu_classpath_jdwp_VMFrame.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 
 /*
index eaf47e6301c3cfea38b5233c8360fbd5f19c5cb4..63e253b7cfaf41545f6874aa484d6d839400b9e6 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "native/jni.hpp"
 #include "native/include/java_lang_Thread.h"
 #include "native/include/java_nio_ByteBuffer.h"
index c706681c933a4dbe55691df719b83d62a2fb10a0..c00c3e9a45402de02189d21b77698ece61da2cfd 100644 (file)
@@ -36,7 +36,7 @@
 # include "native/vm/include/gnu_java_lang_management_VMClassLoadingMXBeanImpl.h"
 #endif
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/classcache.hpp"
 #include "vm/utf8.h"
index f04140ff3851ccf8a8e11ba35278b614af15f778..359931c254fe82d3b79a60699afaa6a63c062460 100644 (file)
@@ -36,7 +36,7 @@
 # include "native/vm/include/gnu_java_lang_management_VMThreadMXBeanImpl.h"
 #endif
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/classcache.hpp"
 #include "vm/utf8.h"
index 7e2c0b8359a2536f3a634e57d743ba1f983c16d0..cab192f8a1cfec4fe8be1299a827916577024e39 100644 (file)
@@ -39,7 +39,7 @@
 # include "native/vm/include/java_lang_VMClassLoader.h"
 #endif
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "toolbox/list.hpp"
 
 #if defined(ENABLE_ASSERTION)
index 10f450dd13daffeca9c4bed8dab1571ebbb335e0..23400775965991fd8ab821e8198ef71ecb437a75 100644 (file)
@@ -36,7 +36,7 @@
 # include "native/vm/include/java_lang_management_VMManagementFactory.h"
 #endif
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/globals.hpp"
 #include "vm/vm.hpp"
index b56ca42c33cccf37f72773295d448dfaa4e5823f..c454823053967732266cafca80bb6b3418887ff3 100644 (file)
@@ -51,7 +51,7 @@
 
 #include "native/vm/reflection.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/class.hpp"
 #include "vm/exceptions.hpp"
index 9b393d3bf53ab69f17260117462762223109a0e9..1e27cfdea6a8c77155ef7193de4bdd4dc7ababc4 100644 (file)
@@ -63,7 +63,7 @@
 #include "threads/lock.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "toolbox/list.hpp"
 
 #include "vm/array.hpp"
index 3884893992643f7db617e5a40869d99a73964348..5bfb6c63b8eb90392fb66924bb50aa6f5be14697 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "native/vm/openjdk/management.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/os.hpp"
 #include "vm/vm.hpp"
index 9629b004ef99a50225ed4982ed3f64bde589fd04..29d0767ce2536ce15d72b3ce15d740815f9b2dfa 100644 (file)
@@ -58,7 +58,7 @@
 #include "threads/threadlist.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index bcf7f0e18e80cf06709307d497fade4484eb7a8a..18720899ccb23d577cade9c0b2f17b7a60efc149 100644 (file)
@@ -34,7 +34,7 @@
 #include "threads/thread.hpp"
 
 #include "toolbox/list.hpp"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/stacktrace.hpp"
 
index c5c2cae128d049c22d2c0a37dde36f5f7a120854..32048a75bf17805cf61706ae06da40afcdad8991 100644 (file)
@@ -36,8 +36,8 @@ libtoolbox_la_SOURCES = \
        hashtable.c \
        hashtable.h \
        list.hpp \
-       logging.c \
-       logging.h \
+       logging.cpp \
+       logging.hpp \
        set.h \
        set.c \
        util.c \
index 404328c05dba516049198abc7f42db81b3fa7332..cb247f110ce95154e08ac0cf0ff4ba12d1ca3e00 100644 (file)
@@ -34,7 +34,7 @@
 #include "threads/mutex.hpp"
 
 #include "toolbox/avl.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/global.h"
 #include "vm/vm.hpp"
diff --git a/src/toolbox/logging.c b/src/toolbox/logging.c
deleted file mode 100644 (file)
index 7ff7f1b..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/* src/toolbox/logging.c - contains logging functions
-
-   Copyright (C) 1996-2005, 2006, 2007, 2008
-   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   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., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-*/
-
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "vm/types.h"
-
-#include "mm/memory.h"
-
-#include "threads/thread.hpp"
-
-#include "toolbox/logging.h"
-#include "toolbox/util.h"
-
-#include "vm/global.h"
-
-#if defined(ENABLE_STATISTICS)
-# include "vm/statistics.h"
-#endif
-
-
-/***************************************************************************
-                        LOG FILE HANDLING 
-***************************************************************************/
-
-FILE *logfile = NULL;
-
-
-void log_init(const char *fname)
-{
-       if (fname) {
-               if (fname[0]) {
-                       logfile = fopen(fname, "w");
-               }
-       }
-}
-
-
-/* log_start *******************************************************************
-
-   Writes the preleading LOG: text to the protocol file (if opened) or
-   to stdout.
-
-*******************************************************************************/
-
-void log_start(void)
-{
-#if defined(ENABLE_THREADS)
-       ptrint tid;
-
-       tid = threads_get_current_tid();
-#endif
-
-       if (logfile) {
-#if defined(ENABLE_THREADS)
-# if SIZEOF_VOID_P == 8
-               fprintf(logfile, "[0x%016lx] ", tid );
-# else
-               fprintf(logfile, "[0x%08x] ", tid);
-# endif
-#endif
-       }
-       else {
-#if defined(ENABLE_THREADS)
-# if SIZEOF_VOID_P == 8
-               fprintf(stdout, "LOG: [0x%016lx] ", tid);
-# else
-               fprintf(stdout, "LOG: [0x%08x] ", tid);
-# endif
-#else
-               fputs("LOG: ", stdout);
-#endif
-       }
-}
-
-
-/* log_vprint ******************************************************************
-
-   Writes logtext to the protocol file (if opened) or to stdout.
-
-*******************************************************************************/
-
-void log_vprint(const char *text, va_list ap)
-{
-       if (logfile)
-               vfprintf(logfile, text, ap);
-       else
-               vfprintf(stdout, text, ap);
-}
-
-
-/* log_print *******************************************************************
-
-   Writes logtext to the protocol file (if opened) or to stdout.
-
-*******************************************************************************/
-
-void log_print(const char *text, ...)
-{
-       va_list ap;
-
-       va_start(ap, text);
-       log_vprint(text, ap);
-       va_end(ap);
-}
-
-
-/* log_println *****************************************************************
-
-   Writes logtext to the protocol file (if opened) or to stdout with a
-   trailing newline.
-
-*******************************************************************************/
-
-void log_println(const char *text, ...)
-{
-       va_list ap;
-
-       log_start();
-
-       va_start(ap, text);
-       log_vprint(text, ap);
-       va_end(ap);
-
-       log_finish();
-}
-
-
-/* log_finish ******************************************************************
-
-   Finishes a logtext line with trailing newline and a fflush.
-
-*******************************************************************************/
-
-void log_finish(void)
-{
-       if (logfile) {
-               fputs("\n", logfile);
-               fflush(logfile);
-       }
-       else {
-               fputs("\n", stdout);
-               fflush(stdout);
-       }
-}
-
-
-/* log_message_utf *************************************************************
-
-   Outputs log text like this:
-
-   LOG: Creating class: java/lang/Object
-
-*******************************************************************************/
-
-void log_message_utf(const char *msg, utf *u)
-{
-       char *buf;
-       s4    len;
-
-       len = strlen(msg) + utf_bytes(u) + strlen("0");
-
-       buf = MNEW(char, len);
-
-       strcpy(buf, msg);
-       utf_cat(buf, u);
-
-       log_text(buf);
-
-       MFREE(buf, char, len);
-}
-
-
-/* log_message_class ***********************************************************
-
-   Outputs log text like this:
-
-   LOG: Loading class: java/lang/Object
-
-*******************************************************************************/
-
-void log_message_class(const char *msg, classinfo *c)
-{
-       log_message_utf(msg, c->name);
-}
-
-
-/* log_message_class_message_class *********************************************
-
-   Outputs log text like this:
-
-   LOG: Initialize super class java/lang/Object from java/lang/VMThread
-
-*******************************************************************************/
-
-void log_message_class_message_class(const char *msg1, classinfo *c1,
-                                                                        const char *msg2, classinfo *c2)
-{
-       char *buf;
-       s4    len;
-
-       len =
-               strlen(msg1) + utf_bytes(c1->name) +
-               strlen(msg2) + utf_bytes(c2->name) + strlen("0");
-
-       buf = MNEW(char, len);
-
-       strcpy(buf, msg1);
-       utf_cat_classname(buf, c1->name);
-       strcat(buf, msg2);
-       utf_cat_classname(buf, c2->name);
-
-       log_text(buf);
-
-       MFREE(buf, char, len);
-}
-
-
-/* log_message_method **********************************************************
-
-   Outputs log text like this:
-
-   LOG: Compiling: java.lang.Object.clone()Ljava/lang/Object;
-
-*******************************************************************************/
-
-void log_message_method(const char *msg, methodinfo *m)
-{
-       char *buf;
-       s4    len;
-
-       len = strlen(msg) + utf_bytes(m->clazz->name) + strlen(".") +
-               utf_bytes(m->name) + utf_bytes(m->descriptor) + strlen("0");
-
-       buf = MNEW(char, len);
-
-       strcpy(buf, msg);
-       utf_cat_classname(buf, m->clazz->name);
-       strcat(buf, ".");
-       utf_cat(buf, m->name);
-       utf_cat(buf, m->descriptor);
-
-       log_text(buf);
-
-       MFREE(buf, char, len);
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
diff --git a/src/toolbox/logging.cpp b/src/toolbox/logging.cpp
new file mode 100644 (file)
index 0000000..a16c802
--- /dev/null
@@ -0,0 +1,287 @@
+/* src/toolbox/logging.c - contains logging functions
+
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   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., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "vm/types.h"
+
+#include "mm/memory.h"
+
+#include "threads/thread.hpp"
+
+#include "toolbox/logging.hpp"
+#include "toolbox/util.h"
+
+#include "vm/global.h"
+
+#if defined(ENABLE_STATISTICS)
+# include "vm/statistics.h"
+#endif
+
+
+/***************************************************************************
+                        LOG FILE HANDLING 
+***************************************************************************/
+
+FILE *logfile = NULL;
+
+
+void log_init(const char *fname)
+{
+       if (fname) {
+               if (fname[0]) {
+                       logfile = fopen(fname, "w");
+               }
+       }
+}
+
+
+/* log_start *******************************************************************
+
+   Writes the preleading LOG: text to the protocol file (if opened) or
+   to stdout.
+
+*******************************************************************************/
+
+void log_start(void)
+{
+#if defined(ENABLE_THREADS)
+       ptrint tid;
+
+       tid = threads_get_current_tid();
+#endif
+
+       if (logfile) {
+#if defined(ENABLE_THREADS)
+# if SIZEOF_VOID_P == 8
+               fprintf(logfile, "[0x%016lx] ", tid );
+# else
+               fprintf(logfile, "[0x%08x] ", tid);
+# endif
+#endif
+       }
+       else {
+#if defined(ENABLE_THREADS)
+# if SIZEOF_VOID_P == 8
+               fprintf(stdout, "LOG: [0x%016lx] ", tid);
+# else
+               fprintf(stdout, "LOG: [0x%08x] ", tid);
+# endif
+#else
+               fputs("LOG: ", stdout);
+#endif
+       }
+}
+
+
+/* log_vprint ******************************************************************
+
+   Writes logtext to the protocol file (if opened) or to stdout.
+
+*******************************************************************************/
+
+void log_vprint(const char *text, va_list ap)
+{
+       if (logfile)
+               vfprintf(logfile, text, ap);
+       else
+               vfprintf(stdout, text, ap);
+}
+
+
+/* log_print *******************************************************************
+
+   Writes logtext to the protocol file (if opened) or to stdout.
+
+*******************************************************************************/
+
+void log_print(const char *text, ...)
+{
+       va_list ap;
+
+       va_start(ap, text);
+       log_vprint(text, ap);
+       va_end(ap);
+}
+
+
+/* log_println *****************************************************************
+
+   Writes logtext to the protocol file (if opened) or to stdout with a
+   trailing newline.
+
+*******************************************************************************/
+
+void log_println(const char *text, ...)
+{
+       va_list ap;
+
+       log_start();
+
+       va_start(ap, text);
+       log_vprint(text, ap);
+       va_end(ap);
+
+       log_finish();
+}
+
+
+/* log_finish ******************************************************************
+
+   Finishes a logtext line with trailing newline and a fflush.
+
+*******************************************************************************/
+
+void log_finish(void)
+{
+       if (logfile) {
+               fputs("\n", logfile);
+               fflush(logfile);
+       }
+       else {
+               fputs("\n", stdout);
+               fflush(stdout);
+       }
+}
+
+
+/* log_message_utf *************************************************************
+
+   Outputs log text like this:
+
+   LOG: Creating class: java/lang/Object
+
+*******************************************************************************/
+
+void log_message_utf(const char *msg, utf *u)
+{
+       char *buf;
+       s4    len;
+
+       len = strlen(msg) + utf_bytes(u) + strlen("0");
+
+       buf = MNEW(char, len);
+
+       strcpy(buf, msg);
+       utf_cat(buf, u);
+
+       log_text(buf);
+
+       MFREE(buf, char, len);
+}
+
+
+/* log_message_class ***********************************************************
+
+   Outputs log text like this:
+
+   LOG: Loading class: java/lang/Object
+
+*******************************************************************************/
+
+void log_message_class(const char *msg, classinfo *c)
+{
+       log_message_utf(msg, c->name);
+}
+
+
+/* log_message_class_message_class *********************************************
+
+   Outputs log text like this:
+
+   LOG: Initialize super class java/lang/Object from java/lang/VMThread
+
+*******************************************************************************/
+
+void log_message_class_message_class(const char *msg1, classinfo *c1,
+                                                                        const char *msg2, classinfo *c2)
+{
+       char *buf;
+       s4    len;
+
+       len =
+               strlen(msg1) + utf_bytes(c1->name) +
+               strlen(msg2) + utf_bytes(c2->name) + strlen("0");
+
+       buf = MNEW(char, len);
+
+       strcpy(buf, msg1);
+       utf_cat_classname(buf, c1->name);
+       strcat(buf, msg2);
+       utf_cat_classname(buf, c2->name);
+
+       log_text(buf);
+
+       MFREE(buf, char, len);
+}
+
+
+/* log_message_method **********************************************************
+
+   Outputs log text like this:
+
+   LOG: Compiling: java.lang.Object.clone()Ljava/lang/Object;
+
+*******************************************************************************/
+
+void log_message_method(const char *msg, methodinfo *m)
+{
+       char *buf;
+       s4    len;
+
+       len = strlen(msg) + utf_bytes(m->clazz->name) + strlen(".") +
+               utf_bytes(m->name) + utf_bytes(m->descriptor) + strlen("0");
+
+       buf = MNEW(char, len);
+
+       strcpy(buf, msg);
+       utf_cat_classname(buf, m->clazz->name);
+       strcat(buf, ".");
+       utf_cat(buf, m->name);
+       utf_cat(buf, m->descriptor);
+
+       log_text(buf);
+
+       MFREE(buf, char, len);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
diff --git a/src/toolbox/logging.h b/src/toolbox/logging.h
deleted file mode 100644 (file)
index eed61bd..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* src/toolbox/logging.h - contains logging functions
-
-   Copyright (C) 1996-2005, 2006, 2007, 2008
-   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   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., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-*/
-
-
-#ifndef _LOGGING_H
-#define _LOGGING_H
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "vm/class.hpp"
-#include "vm/method.hpp"
-#include "vm/utf8.h"
-
-
-/* function prototypes ********************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void log_init(const char *fname);
-
-void log_start(void);
-
-void log_vprint(const char *text, va_list ap);
-void log_print(const char *text, ...);
-void log_println(const char *text, ...);
-
-void log_finish(void);
-
-
-/* log message functions */
-void log_message_utf(const char *msg, utf *u);
-void log_message_class(const char *msg, classinfo *c);
-void log_message_class_message_class(const char *msg1, classinfo *c1,
-                                                                        const char *msg2, classinfo *c2);
-void log_message_method(const char *msg, methodinfo *m);
-
-#define log_text(s) log_println("%s", (s))
-#define dolog log_println
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LOGGING_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
diff --git a/src/toolbox/logging.hpp b/src/toolbox/logging.hpp
new file mode 100644 (file)
index 0000000..eed61bd
--- /dev/null
@@ -0,0 +1,84 @@
+/* src/toolbox/logging.h - contains logging functions
+
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   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., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _LOGGING_H
+#define _LOGGING_H
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "vm/class.hpp"
+#include "vm/method.hpp"
+#include "vm/utf8.h"
+
+
+/* function prototypes ********************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void log_init(const char *fname);
+
+void log_start(void);
+
+void log_vprint(const char *text, va_list ap);
+void log_print(const char *text, ...);
+void log_println(const char *text, ...);
+
+void log_finish(void);
+
+
+/* log message functions */
+void log_message_utf(const char *msg, utf *u);
+void log_message_class(const char *msg, classinfo *c);
+void log_message_class_message_class(const char *msg1, classinfo *c1,
+                                                                        const char *msg2, classinfo *c2);
+void log_message_method(const char *msg, methodinfo *m);
+
+#define log_text(s) log_println("%s", (s))
+#define dolog log_println
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOGGING_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index bbca2affd6a91c3ea451921106e39e0e587af835..373187ea08704c01c15103f17f971139dcd75564 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "mm/memory.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/annotation.h"
 #include "vm/array.hpp"
index aca2115c827e6a1758e9a57d7e073896705b9891..ec8a9538bf336cf5b4036f90ea5999307c7edec9 100644 (file)
@@ -41,7 +41,7 @@
 #include "threads/lock.hpp"
 #include "threads/mutex.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/array.hpp"
 #include "vm/jit/builtin.hpp"
index 93db61a9b4eeaafbbf5bc37a6ad168a4d1473cc8..7f128a4ebced0ac1ab24d45a1d7bb1ee1de93397 100644 (file)
@@ -35,7 +35,7 @@
 #include "threads/mutex.hpp"
 
 #include "toolbox/hashtable.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/classcache.hpp"
 #include "vm/exceptions.hpp"
index de94a0f44dec49e543d95311902a3a1898488ea5..7b97c66c51db00adfbabe133c5ac23d7cc7943bf 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "mm/memory.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "toolbox/worklist.h"
 
 #include "vm/jit/builtin.hpp"
index bfe0e16662bf4ef9b86bf1cfe99063b58e75e062..6e650a9d3d0ef915addf4c8466497b05b2f10d07 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "mm/memory.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index a30de77364a166ce0da50c490da268a9341e4e6c..df595f0230da0c8245a42e771e232d3b151af188 100644 (file)
@@ -49,7 +49,7 @@
 #include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
-#include "toolbox/logging.h" /* XXX for debugging only */
+#include "toolbox/logging.hpp" /* XXX for debugging only */
 
 
 /* emit_load *******************************************************************
index 62fa58212ce04c02417e945ad0ca2d2fffd88e04..088dcdf3534b8d2b4479f7760a7c46e9bcec048f 100644 (file)
@@ -56,7 +56,7 @@
 #include "threads/mutex.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "toolbox/util.h"
 
 #include "vm/array.hpp"
index df4f73af20b5315861ce0b736bf46f7acd347858..fdb958d7d6977bed27a500e6417cc44239a9c355 100644 (file)
@@ -36,7 +36,7 @@ typedef struct builtintable_entry builtintable_entry;
 #include "arch.h"
 #include "md-abi.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/descriptor.hpp"
 #include "vm/utf8.h"
index dd1768e588f642b96a4e26bfeaf306bb0f45de03..606cb2f059f94ab3d14c18bb8e05d767a454d820 100644 (file)
@@ -55,7 +55,7 @@
 
 #include "toolbox/avl.h"
 #include "toolbox/list.hpp"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "native/llni.h"
 #include "native/localref.hpp"
index 73c8667d2ee95dca23bd2a420fbfb9ef18c4da3b..a796ae2485f0b4098b4e60cfc5d55a7c56dddda5 100644 (file)
@@ -38,7 +38,7 @@
 #include "threads/mutex.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.hpp"
index 78f75df0204b50835800cfbf1058069c7e1998d5..dba9173bf0863318d7f389b70474824751a7a146 100644 (file)
@@ -41,7 +41,7 @@
 #include "threads/lock.hpp"
 
 #include "toolbox/hashtable.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/options.h"
 
index baaf5900f62eeedcb16ce7aee9dbaa6e9ce91ac1..ffd51344b0f3bcf65345c402e790b31eb28f4cfe 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/native.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "threads/mutex.hpp"
 
index 211e492bde7e519dbeb908ffbeac72f5714d2c5a..fe4d4996bfd165d3629c60525d07f887356c878f 100644 (file)
@@ -33,7 +33,7 @@
 #include "vm/types.h"
 
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/jit.hpp"
 #include "vm/jit/stack.h"
index 91f580d4bdcf3a21cfdbad0d4ac9a610df44bc66..7e26d34336c32be6e36b597149c0eca270d654be 100644 (file)
@@ -37,7 +37,7 @@
 #include <assert.h>
 
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "vm/jit/jit.hpp"
 #include "vm/jit/loop/graph.h"
 #include "vm/jit/loop/loop.h"
index 56d4ee09ffd0cf9f9b3ac7d722471b09209b49c3..db7a0ebe6cf86ae77fb33d5f70371bd29cde8c16 100644 (file)
@@ -41,7 +41,7 @@
 #include <stdlib.h>
 
 #include "mm/memory.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "vm/global.h" 
 #include "vm/jit/jit.hpp"      
 #include "vm/jit/loop/loop.h"
index 5ea6e55d1b46cf7a14cd8f3237cec715788c69b2..147b8e03f0d96589fb3f52d04e58f942f1717633 100644 (file)
@@ -49,7 +49,7 @@
 
 #include "vm/jit/optimizing/lsra.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 extern const char *string_java_lang_InternalError;
 /* function prototypes */
index 63a15bb8960880051544123019bd3abda7a0e836..528b7ed1feb9dfa88347d85a5700b6f13ba961b7 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "threads/lock.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index b4799b3138184ab603afefb94ae348f42dab2a79..f443af0ade3b42fd2ca31e533437441b26d24b80 100644 (file)
@@ -40,7 +40,7 @@
 #include "native/native.hpp"
 
 #include "toolbox/list.hpp"
-#include "toolbox/logging.h"           /* XXX remove me! */
+#include "toolbox/logging.hpp"           /* XXX remove me! */
 
 #include "vm/exceptions.hpp"
 #include "vm/initialize.hpp"
index 427f0746a9228bf04242c82e96af16aaaa0098fc..b0644f1317f091dcfdba349001fd68507eb2ac39 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/classcache.hpp"
 #include "vm/globals.hpp"
index 8c7ad97c3c9bab8c95dca5327998f05532f08eeb..4f464039161473e25028d8e90f3dc5be987bdd32 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "native/native.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index 9b63c7e176ea5e99c2af50f6fa33346d91ca674f..d39ca2938413e7988ceb84ed2fe2903d25ed2d89 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/array.hpp"
 #include "vm/jit/builtin.hpp"
index 91a36557323fa150643bce6d55e14576d0fed7b9..ad0bd72a92829868401c4cbafec5e09756af96be 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/global.h"
 #include "vm/globals.hpp"
index 1ac7ffe7e71e6d016b8d3a8594b75da78803f214..396f2db62a947d8944669e1e334b8b2e09af2a07 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/llni.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/exceptions.hpp"
 #include "vm/options.h"
index 7626890762e3150811d039daf9e155ccc5bb11c3..51d60932c414c75d2cb2ea474adc8587509fc6ab 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "native/native.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/access.hpp"
 #include "vm/array.hpp"
index d63c422007abe0180f8f967c261d7f63df2d2489..0e0967bec5db166af817c68e2ff9e770dd517390 100644 (file)
@@ -145,7 +145,7 @@ error reporting.
 
 #include "native/native.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/access.hpp"
 #include "vm/array.hpp"
index f36ea24d31fe30071c3cba8a05dc98377c276b36..cbc6e5ca85c9547c72a3460da2ee3bf6d4b7f7b9 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "mm/memory.h"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/array.hpp"
 #include "vm/class.hpp"
index 809165047be741e6474a30311f05a4ba7de36a55..91946c1d163055f471e5d353e44a5a45e23647ba 100644 (file)
@@ -37,7 +37,7 @@
 #include "threads/lock.hpp"
 #include "threads/mutex.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/access.hpp"
 #include "vm/array.hpp"
index 81ab0ad8594bd06ec0cd27cb3a0c5f6401db6209..5fe8d61b72636990c399ef95295b1536907b5140 100644 (file)
@@ -39,7 +39,7 @@
 #include "threads/mutex.hpp"
 
 #include "toolbox/hashtable.h"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/classcache.hpp"
index 27926b52e5fb1f2e5f08bc42de808c80f50eceb3..9c07ef78b47af9ea09433e58e58bb31a1d9a0b6e 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "mm/gc.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/class.hpp"
 #include "vm/field.hpp"
index 1c1664a7ed4dfb94c2a78762701ddf57ff6668fc..c109080221d54b9ad36a4e6aec8252df511926fe 100644 (file)
@@ -37,7 +37,7 @@
 #include "threads/mutex.hpp"
 
 #include "toolbox/list.hpp"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 #include "toolbox/util.h"
 
 #include "vm/exceptions.hpp"
index b5a4cc27e14ed54b9a4330ed86e12fd25f0e43a4..a1fae8b9fc8cc13e2d36d326a16557c8976daaaa 100644 (file)
@@ -55,7 +55,7 @@
 #include "threads/lock.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
 #include "vm/array.hpp"