* src/vm/jit/trace.c: Moved to .cpp.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Mon, 21 Jul 2008 15:10:42 +0000 (17:10 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Mon, 21 Jul 2008 15:10:42 +0000 (17:10 +0200)
* src/vm/jit/trace.h: Likewise.
* src/vm/jit/trace.cpp: New file.
* src/vm/jit/trace.hpp: Likewise.
* src/vm/jit/Makefile.am (libjit_la_SOURCES): Changed filenames.
* src/vm/builtin.c,
src/vm/exceptions.c,
src/vm/jit/alpha/emit.c,
src/vm/jit/arm/emit.c,
src/vm/jit/codegen-common.c,
src/vm/jit/i386/emit.c,
src/vm/jit/m68k/emit.c,
src/vm/jit/powerpc/emit.c,
src/vm/jit/powerpc64/emit.c,
src/vm/jit/s390/emit.c,
src/vm/jit/x86_64/emit.c (vm/jit/trace.h): Changed to
vm/jit/trace.hpp.

--HG--
rename : src/vm/jit/trace.c => src/vm/jit/trace.cpp
rename : src/vm/jit/trace.h => src/vm/jit/trace.hpp

16 files changed:
src/vm/builtin.c
src/vm/exceptions.c
src/vm/jit/Makefile.am
src/vm/jit/alpha/emit.c
src/vm/jit/arm/emit.c
src/vm/jit/codegen-common.c
src/vm/jit/i386/emit.c
src/vm/jit/m68k/emit.c
src/vm/jit/powerpc/emit.c
src/vm/jit/powerpc64/emit.c
src/vm/jit/s390/emit.c
src/vm/jit/trace.c [deleted file]
src/vm/jit/trace.cpp [new file with mode: 0644]
src/vm/jit/trace.h [deleted file]
src/vm/jit/trace.hpp [new file with mode: 0644]
src/vm/jit/x86_64/emit.c

index 578ef8ed58ab5fca201dc452b4ab148f0b35fad7..cf1cc0fe7e43bfacab82c8d03a344d3b0970503e 100644 (file)
@@ -69,7 +69,7 @@
 #include "vm/stringlocal.h"
 
 #include "vm/jit/asmpart.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 
 #include "vmcore/class.h"
 #include "vmcore/globals.hpp"
index 5333ca5863d3dae7bbe44f80744b46bb4d806f6c..7de6e3b52bcefe02bd1135b005035597810dd8e3 100644 (file)
@@ -62,7 +62,7 @@
 #include "vm/jit/patcher-common.h"
 #include "vm/jit/show.h"
 #include "vm/jit/stacktrace.hpp"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 
 #include "vmcore/class.h"
 #include "vmcore/globals.hpp"
index 00fbda82c4278b7f0c87c4aa9dae33ad337f4215..ae59305d12d05f669a3928da97724cc31b858970 100644 (file)
@@ -176,8 +176,8 @@ libjit_la_SOURCES = \
        $(STACK_SOURCES) \
        stacktrace.cpp \
        stacktrace.hpp \
-       trace.c \
-       trace.h \
+       trace.cpp \
+       trace.hpp \
        $(TRAP_SOURCES)
 
 libjit_la_SOURCES += \
index f0d1b7c8967e54335b258afce0b2c0e1d0265fc5..adbdf45582715dbace822694c35e3f96417de6cb 100644 (file)
@@ -45,7 +45,7 @@
 #include "vm/jit/jit.h"
 #include "vm/jit/patcher-common.h"
 #include "vm/jit/replace.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vmcore/options.h"
index 293731cfc473c70f509f46f2cbaf1f5fe3e475f9..b43c98987c075b69a3522365d2ef6af0cadf444e 100644 (file)
@@ -47,7 +47,7 @@
 #include "vm/jit/jit.h"
 #include "vm/jit/patcher-common.h"
 #include "vm/jit/replace.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "toolbox/logging.h" /* XXX for debugging only */
index 506f9c3063b5f3ffaaed56f363e2b7063676423d..25219932000538ed1196f6639ffa312788c6aeae 100644 (file)
 # include "vm/jit/optimizing/ssa.h"
 #endif
 #include "vm/jit/stacktrace.hpp"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 
 #if defined(ENABLE_INTRP)
 #include "vm/jit/intrp/intrp.h"
index 7c61037afcaf40aa14b4b3befe25e6f81290c25b..1141c5c839b1ed48cb0412bb3e565bae64e7f52d 100644 (file)
@@ -46,7 +46,7 @@
 #include "vm/jit/jit.h"
 #include "vm/jit/patcher-common.h"
 #include "vm/jit/replace.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vmcore/options.h"
index 0b48ac636c1af9d0872cc588e17954fd0e7466a9..1d7393ebf9cd7b4907b6e0e7077e3496692eaaeb 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/m68k/emit.c
 
-   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.
 
@@ -39,7 +37,7 @@
 
 #include "vm/jit/asmpart.h"
 #include "vm/jit/emit-common.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 
index 65927bb8a8260ff856c2d51345e403f4cda7d747..5d1458c912ea2a043b47a1f5ebb9e294dc8c57b6 100644 (file)
@@ -47,7 +47,7 @@
 #include "vm/jit/emit-common.h"
 #include "vm/jit/jit.h"
 #include "vm/jit/replace.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vmcore/options.h"
index 83f95ab4af80abb910de6f6b915eee381d54a5c1..b2dc3b6e2ca0568a7aababea149d249b567dce7f 100644 (file)
@@ -43,7 +43,7 @@
 #include "vm/jit/asmpart.h"
 #include "vm/jit/emit-common.h"
 #include "vm/jit/jit.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vmcore/options.h"
index 9ac259c71ff7dc7482dd32e287c9999803ea023e..f56c14737e6c7ece154fd078dfbaaf5f276af3dd 100644 (file)
@@ -48,7 +48,7 @@
 #include "vm/jit/jit.h"
 #include "vm/jit/patcher-common.h"
 #include "vm/jit/replace.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vmcore/options.h"
diff --git a/src/vm/jit/trace.c b/src/vm/jit/trace.c
deleted file mode 100644 (file)
index 9585234..0000000
+++ /dev/null
@@ -1,644 +0,0 @@
-/* src/vm/jit/trace.c - Functions for tracing from java code.
-
-   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 "arch.h"
-#include "md-abi.h"
-
-#include "mm/memory.h"
-
-#include "native/jni.h"
-#include "native/llni.h"
-
-#include "native/include/java_lang_String.h"
-#include "native/include/java_lang_Throwable.h"
-
-#include "threads/thread.h"
-
-#include "toolbox/logging.h"
-
-#include "vm/global.h"
-#include "vm/stringlocal.h"
-#include "vm/jit/argument.h"
-#include "vm/jit/codegen-common.h"
-#include "vm/jit/trace.h"
-#include "vm/jit/show.h"
-
-#include "vmcore/globals.hpp"
-#include "vmcore/options.h"
-#include "vmcore/utf8.h"
-
-
-#if !defined(NDEBUG)
-
-
-/* global variables ***********************************************************/
-
-#if !defined(ENABLE_THREADS)
-s4 _no_threads_tracejavacallindent = 0;
-u4 _no_threads_tracejavacallcount= 0;
-#endif
-
-
-/* trace_java_call_print_argument **********************************************
-
-   XXX: Document me!
-
-*******************************************************************************/
-
-static char *trace_java_call_print_argument(methodinfo *m, char *logtext, s4 *logtextlen, typedesc *paramtype, imm_union imu)
-{
-       java_object_t *o;
-       classinfo     *c;
-       utf           *u;
-       u4             len;
-
-       switch (paramtype->type) {
-       case TYPE_INT:
-               sprintf(logtext + strlen(logtext), "%d (0x%08x)", (int32_t)imu.l, (int32_t)imu.l);
-               break;
-
-       case TYPE_LNG:
-#if SIZEOF_VOID_P == 4
-               sprintf(logtext + strlen(logtext), "%lld (0x%016llx)", imu.l, imu.l);
-#else
-               sprintf(logtext + strlen(logtext), "%ld (0x%016lx)", imu.l, imu.l);
-#endif
-               break;
-
-       case TYPE_FLT:
-               sprintf(logtext + strlen(logtext), "%g (0x%08x)", imu.f, imu.i);
-               break;
-
-       case TYPE_DBL:
-#if SIZEOF_VOID_P == 4
-               sprintf(logtext + strlen(logtext), "%g (0x%016llx)", imu.d, imu.l);
-#else
-               sprintf(logtext + strlen(logtext), "%g (0x%016lx)", imu.d, imu.l);
-#endif
-               break;
-
-       case TYPE_ADR:
-#if SIZEOF_VOID_P == 4
-               sprintf(logtext + strlen(logtext), "0x%08x", (ptrint) imu.l);
-#else
-               sprintf(logtext + strlen(logtext), "0x%016lx", (ptrint) imu.l);
-#endif
-
-               /* Workaround for sun.misc.Unsafe methods.  In the future
-                  (exact GC) we should check if the address is on the GC
-                  heap. */
-
-               if ((m->clazz       != NULL) &&
-                       (m->clazz->name == utf_new_char("sun/misc/Unsafe")))
-                       break;
-
-               /* Cast to java.lang.Object. */
-
-               o = (java_object_t *) (ptrint) imu.l;
-
-               /* Check return argument for java.lang.Class or
-                  java.lang.String. */
-
-               if (o != NULL) {
-                       if (o->vftbl->clazz == class_java_lang_String) {
-                               /* get java.lang.String object and the length of the
-                                  string */
-
-                               u = javastring_toutf(o, false);
-
-                               len = strlen(" (String = \"") + utf_bytes(u) + strlen("\")");
-
-                               /* realloc memory for string length */
-
-                               logtext = DMREALLOC(logtext, char, *logtextlen, *logtextlen + len);
-                               *logtextlen += len;
-
-                               /* convert to utf8 string and strcat it to the logtext */
-
-                               strcat(logtext, " (String = \"");
-                               utf_cat(logtext, u);
-                               strcat(logtext, "\")");
-                       }
-                       else {
-                               if (o->vftbl->clazz == class_java_lang_Class) {
-                                       /* if the object returned is a java.lang.Class
-                                          cast it to classinfo structure and get the name
-                                          of the class */
-
-                                       c = (classinfo *) o;
-
-                                       u = c->name;
-                               }
-                               else {
-                                       /* if the object returned is not a java.lang.String or
-                                          a java.lang.Class just print the name of the class */
-
-                                       u = o->vftbl->clazz->name;
-                               }
-
-                               len = strlen(" (Class = \"") + utf_bytes(u) + strlen("\")");
-
-                               /* realloc memory for string length */
-
-                               logtext = DMREALLOC(logtext, char, *logtextlen, *logtextlen + len);
-                               *logtextlen += len;
-
-                               /* strcat to the logtext */
-
-                               strcat(logtext, " (Class = \"");
-                               utf_cat_classname(logtext, u);
-                               strcat(logtext, "\")");
-                       }
-               }
-       }
-
-       return logtext;
-}
-
-/* trace_java_call_enter ******************************************************
-   Traces an entry into a java method.
-
-   arg_regs: Array containing all argument registers as int64_t values in
-   the same order as listed in m->methoddesc. The array is usually allocated
-   on the stack and used for restoring the argument registers later.
-
-   stack: Pointer to first on stack argument in the same format passed to 
-   asm_vm_call_method.
-
-*******************************************************************************/
-
-void trace_java_call_enter(methodinfo *m, uint64_t *arg_regs, uint64_t *stack)
-{
-       methoddesc *md;
-       imm_union   arg;
-       char       *logtext;
-       s4          logtextlen;
-       s4          i;
-       s4          pos;
-       int32_t     dumpmarker;
-
-       /* We don't trace builtin functions here because the argument
-          passing happens via the native ABI and does not fit these
-          functions. */
-
-       if (method_is_builtin(m))
-               return;
-
-#if defined(ENABLE_DEBUG_FILTER)
-       if (!show_filters_test_verbosecall_enter(m))
-               return;
-#endif
-
-#if defined(ENABLE_VMLOG)
-       vmlog_cacao_enter_method(m);
-       return;
-#endif
-
-       md = m->parseddesc;
-
-       /* calculate message length */
-
-       logtextlen =
-               strlen("4294967295 ") +
-               strlen("-2147483647-") +        /* INT_MAX should be sufficient       */
-               TRACEJAVACALLINDENT +
-               strlen("called: ") +
-               ((m->clazz == NULL) ? strlen("NULL") : utf_bytes(m->clazz->name)) +
-               strlen(".") +
-               utf_bytes(m->name) +
-               utf_bytes(m->descriptor);
-
-       /* Actually it's not possible to have all flags printed, but:
-          safety first! */
-
-       logtextlen +=
-               strlen(" PUBLIC") +
-               strlen(" PRIVATE") +
-               strlen(" PROTECTED") +
-               strlen(" STATIC") +
-               strlen(" FINAL") +
-               strlen(" SYNCHRONIZED") +
-               strlen(" VOLATILE") +
-               strlen(" TRANSIENT") +
-               strlen(" NATIVE") +
-               strlen(" INTERFACE") +
-               strlen(" ABSTRACT") +
-               strlen(" METHOD_BUILTIN");
-
-       /* add maximal argument length */
-
-       logtextlen +=
-               strlen("(") +
-               strlen("-9223372036854775808 (0x123456789abcdef0), ") * md->paramcount +
-               strlen("...(255)") +
-               strlen(")");
-
-       /* allocate memory */
-
-       DMARKER;
-
-       logtext = DMNEW(char, logtextlen);
-
-       TRACEJAVACALLCOUNT++;
-
-       sprintf(logtext, "%10d ", TRACEJAVACALLCOUNT);
-       sprintf(logtext + strlen(logtext), "-%d-", TRACEJAVACALLINDENT);
-
-       pos = strlen(logtext);
-
-       for (i = 0; i < TRACEJAVACALLINDENT; i++)
-               logtext[pos++] = '\t';
-
-       strcpy(logtext + pos, "called: ");
-
-       if (m->clazz != NULL)
-               utf_cat_classname(logtext, m->clazz->name);
-       else
-               strcat(logtext, "NULL");
-       strcat(logtext, ".");
-       utf_cat(logtext, m->name);
-       utf_cat(logtext, m->descriptor);
-
-       if (m->flags & ACC_PUBLIC)         strcat(logtext, " PUBLIC");
-       if (m->flags & ACC_PRIVATE)        strcat(logtext, " PRIVATE");
-       if (m->flags & ACC_PROTECTED)      strcat(logtext, " PROTECTED");
-       if (m->flags & ACC_STATIC)         strcat(logtext, " STATIC");
-       if (m->flags & ACC_FINAL)          strcat(logtext, " FINAL");
-       if (m->flags & ACC_SYNCHRONIZED)   strcat(logtext, " SYNCHRONIZED");
-       if (m->flags & ACC_VOLATILE)       strcat(logtext, " VOLATILE");
-       if (m->flags & ACC_TRANSIENT)      strcat(logtext, " TRANSIENT");
-       if (m->flags & ACC_NATIVE)         strcat(logtext, " NATIVE");
-       if (m->flags & ACC_INTERFACE)      strcat(logtext, " INTERFACE");
-       if (m->flags & ACC_ABSTRACT)       strcat(logtext, " ABSTRACT");
-
-       strcat(logtext, "(");
-
-       for (i = 0; i < md->paramcount; ++i) {
-               arg = argument_jitarray_load(md, i, arg_regs, stack);
-               logtext = trace_java_call_print_argument(m, logtext, &logtextlen,
-                                                                                                &md->paramtypes[i], arg);
-               if (i != (md->paramcount - 1)) {
-                       strcat(logtext, ", ");
-               }
-       }
-
-       strcat(logtext, ")");
-
-       log_text(logtext);
-
-       /* release memory */
-
-       DRELEASE;
-
-       TRACEJAVACALLINDENT++;
-
-}
-
-/* trace_java_call_exit ********************************************************
-
-   Traces an exit form a java method.
-
-   return_regs: Array of size 1 containing return register.
-   The array is usually allocated on the stack and used for restoring the
-   registers later.
-
-*******************************************************************************/
-
-void trace_java_call_exit(methodinfo *m, uint64_t *return_regs)
-{
-       methoddesc *md;
-       char       *logtext;
-       s4          logtextlen;
-       s4          i;
-       s4          pos;
-       imm_union   val;
-       int32_t     dumpmarker;
-
-       /* We don't trace builtin functions here because the argument
-          passing happens via the native ABI and does not fit these
-          functions. */
-
-       if (method_is_builtin(m))
-               return;
-
-#if defined(ENABLE_DEBUG_FILTER)
-       if (!show_filters_test_verbosecall_exit(m))
-               return;
-#endif
-
-#if defined(ENABLE_VMLOG)
-       vmlog_cacao_leave_method(m);
-       return;
-#endif
-
-       md = m->parseddesc;
-
-       /* outdent the log message */
-
-       if (TRACEJAVACALLINDENT)
-               TRACEJAVACALLINDENT--;
-       else
-               log_text("trace_java_call_exit: WARNING: unmatched unindent");
-
-       /* calculate message length */
-
-       logtextlen =
-               strlen("4294967295 ") +
-               strlen("-2147483647-") +        /* INT_MAX should be sufficient       */
-               TRACEJAVACALLINDENT +
-               strlen("finished: ") +
-               ((m->clazz == NULL) ? strlen("NULL") : utf_bytes(m->clazz->name)) +
-               strlen(".") +
-               utf_bytes(m->name) +
-               utf_bytes(m->descriptor) +
-               strlen(" SYNCHRONIZED") + strlen("(") + strlen(")");
-
-       /* add maximal argument length */
-
-       logtextlen += strlen("->0.4872328470301428 (0x0123456789abcdef)");
-
-       /* allocate memory */
-
-       DMARKER;
-
-       logtext = DMNEW(char, logtextlen);
-
-       /* generate the message */
-
-       sprintf(logtext, "           ");
-       sprintf(logtext + strlen(logtext), "-%d-", TRACEJAVACALLINDENT);
-
-       pos = strlen(logtext);
-
-       for (i = 0; i < TRACEJAVACALLINDENT; i++)
-               logtext[pos++] = '\t';
-
-       strcpy(logtext + pos, "finished: ");
-       if (m->clazz != NULL)
-               utf_cat_classname(logtext, m->clazz->name);
-       else
-               strcat(logtext, "NULL");
-       strcat(logtext, ".");
-       utf_cat(logtext, m->name);
-       utf_cat(logtext, m->descriptor);
-
-       if (!IS_VOID_TYPE(md->returntype.type)) {
-               strcat(logtext, "->");
-               val = argument_jitreturn_load(md, return_regs);
-
-               logtext =
-                       trace_java_call_print_argument(m, logtext, &logtextlen,
-                                                                                  &md->returntype, val);
-       }
-
-       log_text(logtext);
-
-       /* release memory */
-
-       DRELEASE;
-}
-
-
-/* trace_exception *************************************************************
-
-   Traces an exception which is handled by exceptions_handle_exception.
-
-*******************************************************************************/
-
-void trace_exception(java_object_t *xptr, methodinfo *m, void *pos)
-{
-       char *logtext;
-       s4    logtextlen;
-       codeinfo *code;
-       int32_t   dumpmarker;
-
-       /* calculate message length */
-
-       if (xptr) {
-               logtextlen =
-                       strlen("Exception ") + utf_bytes(xptr->vftbl->clazz->name);
-       } 
-       else {
-               logtextlen = strlen("Some Throwable");
-       }
-
-       logtextlen += strlen(" thrown in ");
-
-       if (m) {
-               logtextlen +=
-                       utf_bytes(m->clazz->name) +
-                       strlen(".") +
-                       utf_bytes(m->name) +
-                       utf_bytes(m->descriptor) +
-                       strlen("(NOSYNC,NATIVE");
-
-#if SIZEOF_VOID_P == 8
-               logtextlen +=
-                       strlen(")(0x123456789abcdef0) at position 0x123456789abcdef0 (");
-#else
-               logtextlen += strlen(")(0x12345678) at position 0x12345678 (");
-#endif
-
-               if (m->clazz->sourcefile == NULL)
-                       logtextlen += strlen("<NO CLASSFILE INFORMATION>");
-               else
-                       logtextlen += utf_bytes(m->clazz->sourcefile);
-
-               logtextlen += strlen(":65536)");
-
-       } 
-       else {
-               logtextlen += strlen("call_java_method");
-       }
-
-       logtextlen += strlen("0");
-
-       /* allocate memory */
-
-       DMARKER;
-
-       logtext = DMNEW(char, logtextlen);
-
-       if (xptr) {
-               strcpy(logtext, "Exception ");
-               utf_cat_classname(logtext, xptr->vftbl->clazz->name);
-
-       } else {
-               strcpy(logtext, "Some Throwable");
-       }
-
-       strcat(logtext, " thrown in ");
-
-       if (m) {
-               utf_cat_classname(logtext, m->clazz->name);
-               strcat(logtext, ".");
-               utf_cat(logtext, m->name);
-               utf_cat(logtext, m->descriptor);
-
-               if (m->flags & ACC_SYNCHRONIZED)
-                       strcat(logtext, "(SYNC");
-               else
-                       strcat(logtext, "(NOSYNC");
-
-               if (m->flags & ACC_NATIVE) {
-                       strcat(logtext, ",NATIVE");
-
-                       code = m->code;
-
-#if SIZEOF_VOID_P == 8
-                       sprintf(logtext + strlen(logtext),
-                                       ")(0x%016lx) at position 0x%016lx",
-                                       (ptrint) code->entrypoint, (ptrint) pos);
-#else
-                       sprintf(logtext + strlen(logtext),
-                                       ")(0x%08x) at position 0x%08x",
-                                       (ptrint) code->entrypoint, (ptrint) pos);
-#endif
-
-               } else {
-
-                       /* XXX preliminary: This should get the actual codeinfo */
-                       /* in which the exception happened.                     */
-                       code = m->code;
-                       
-#if SIZEOF_VOID_P == 8
-                       sprintf(logtext + strlen(logtext),
-                                       ")(0x%016lx) at position 0x%016lx (",
-                                       (ptrint) code->entrypoint, (ptrint) pos);
-#else
-                       sprintf(logtext + strlen(logtext),
-                                       ")(0x%08x) at position 0x%08x (",
-                                       (ptrint) code->entrypoint, (ptrint) pos);
-#endif
-
-                       if (m->clazz->sourcefile == NULL)
-                               strcat(logtext, "<NO CLASSFILE INFORMATION>");
-                       else
-                               utf_cat(logtext, m->clazz->sourcefile);
-
-                       sprintf(logtext + strlen(logtext), ":%d)", 0);
-               }
-
-       } else
-               strcat(logtext, "call_java_method");
-
-       log_text(logtext);
-
-       /* release memory */
-
-       DRELEASE;
-}
-
-
-/* trace_exception_builtin *****************************************************
-
-   Traces an exception which is thrown by builtin_throw_exception.
-
-*******************************************************************************/
-
-void trace_exception_builtin(java_object_t *xptr)
-{
-       java_lang_Throwable *t;
-       java_lang_String    *s;
-       char                *logtext;
-       s4                   logtextlen;
-       int32_t              dumpmarker;
-
-       t = (java_lang_Throwable *) xptr;
-
-       /* get detail message */
-       if (t)
-               LLNI_field_get_ref(t, detailMessage, s);
-
-       /* calculate message length */
-
-       logtextlen = strlen("Builtin exception thrown: ") + strlen("0");
-
-       if (t) {
-               logtextlen +=
-                       utf_bytes(xptr->vftbl->clazz->name);
-               if (s) {
-                       logtextlen += strlen(": ") +
-                               u2_utflength(LLNI_field_direct(s, value)->data 
-                                                               + LLNI_field_direct(s, offset),
-                                                        LLNI_field_direct(s,count));
-               }
-       } 
-       else {
-               logtextlen += strlen("(nil)");
-       }
-
-       /* allocate memory */
-
-       DMARKER;
-
-       logtext = DMNEW(char, logtextlen);
-
-       strcpy(logtext, "Builtin exception thrown: ");
-
-       if (t) {
-               utf_cat_classname(logtext, xptr->vftbl->clazz->name);
-
-               if (s) {
-                       char *buf;
-
-                       buf = javastring_tochar((java_handle_t *) s);
-                       strcat(logtext, ": ");
-                       strcat(logtext, buf);
-                       MFREE(buf, char, strlen(buf) + 1);
-               }
-
-       } else {
-               strcat(logtext, "(nil)");
-       }
-
-       log_text(logtext);
-
-       /* release memory */
-
-       DRELEASE;
-}
-
-
-#endif /* !defined(NDEBUG) */
-
-
-/*
- * 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/vm/jit/trace.cpp b/src/vm/jit/trace.cpp
new file mode 100644 (file)
index 0000000..1647324
--- /dev/null
@@ -0,0 +1,649 @@
+/* src/vm/jit/trace.cpp - Functions for tracing from java code.
+
+   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.
+
+*/
+
+
+// FIXME For now we export everything as C functions.
+extern "C" {
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include "arch.h"
+#include "md-abi.h"
+
+#include "mm/memory.h"
+
+#include "native/jni.h"
+#include "native/llni.h"
+
+#include "native/include/java_lang_String.h"
+#include "native/include/java_lang_Throwable.h"
+
+#include "threads/thread.h"
+
+#include "toolbox/logging.h"
+
+#include "vm/global.h"
+#include "vm/stringlocal.h"
+#include "vm/jit/argument.h"
+#include "vm/jit/codegen-common.h"
+#include "vm/jit/trace.hpp"
+#include "vm/jit/show.h"
+
+#include "vmcore/globals.hpp"
+#include "vmcore/options.h"
+#include "vmcore/utf8.h"
+
+
+#if !defined(NDEBUG)
+
+
+/* global variables ***********************************************************/
+
+#if !defined(ENABLE_THREADS)
+s4 _no_threads_tracejavacallindent = 0;
+u4 _no_threads_tracejavacallcount= 0;
+#endif
+
+
+/* trace_java_call_print_argument **********************************************
+
+   XXX: Document me!
+
+*******************************************************************************/
+
+static char *trace_java_call_print_argument(methodinfo *m, char *logtext, s4 *logtextlen, typedesc *paramtype, imm_union imu)
+{
+       java_object_t *o;
+       classinfo     *c;
+       utf           *u;
+       u4             len;
+
+       switch (paramtype->type) {
+       case TYPE_INT:
+               sprintf(logtext + strlen(logtext), "%d (0x%08x)", (int32_t)imu.l, (int32_t)imu.l);
+               break;
+
+       case TYPE_LNG:
+#if SIZEOF_VOID_P == 4
+               sprintf(logtext + strlen(logtext), "%lld (0x%016llx)", imu.l, imu.l);
+#else
+               sprintf(logtext + strlen(logtext), "%ld (0x%016lx)", imu.l, imu.l);
+#endif
+               break;
+
+       case TYPE_FLT:
+               sprintf(logtext + strlen(logtext), "%g (0x%08x)", imu.f, imu.i);
+               break;
+
+       case TYPE_DBL:
+#if SIZEOF_VOID_P == 4
+               sprintf(logtext + strlen(logtext), "%g (0x%016llx)", imu.d, imu.l);
+#else
+               sprintf(logtext + strlen(logtext), "%g (0x%016lx)", imu.d, imu.l);
+#endif
+               break;
+
+       case TYPE_ADR:
+#if SIZEOF_VOID_P == 4
+               sprintf(logtext + strlen(logtext), "0x%08x", (ptrint) imu.l);
+#else
+               sprintf(logtext + strlen(logtext), "0x%016lx", (ptrint) imu.l);
+#endif
+
+               /* Workaround for sun.misc.Unsafe methods.  In the future
+                  (exact GC) we should check if the address is on the GC
+                  heap. */
+
+               if ((m->clazz       != NULL) &&
+                       (m->clazz->name == utf_new_char("sun/misc/Unsafe")))
+                       break;
+
+               /* Cast to java.lang.Object. */
+
+               o = (java_object_t *) (ptrint) imu.l;
+
+               /* Check return argument for java.lang.Class or
+                  java.lang.String. */
+
+               if (o != NULL) {
+                       if (o->vftbl->clazz == class_java_lang_String) {
+                               /* get java.lang.String object and the length of the
+                                  string */
+
+                               u = javastring_toutf(o, false);
+
+                               len = strlen(" (String = \"") + utf_bytes(u) + strlen("\")");
+
+                               /* realloc memory for string length */
+
+                               logtext = DMREALLOC(logtext, char, *logtextlen, *logtextlen + len);
+                               *logtextlen += len;
+
+                               /* convert to utf8 string and strcat it to the logtext */
+
+                               strcat(logtext, " (String = \"");
+                               utf_cat(logtext, u);
+                               strcat(logtext, "\")");
+                       }
+                       else {
+                               if (o->vftbl->clazz == class_java_lang_Class) {
+                                       /* if the object returned is a java.lang.Class
+                                          cast it to classinfo structure and get the name
+                                          of the class */
+
+                                       c = (classinfo *) o;
+
+                                       u = c->name;
+                               }
+                               else {
+                                       /* if the object returned is not a java.lang.String or
+                                          a java.lang.Class just print the name of the class */
+
+                                       u = o->vftbl->clazz->name;
+                               }
+
+                               len = strlen(" (Class = \"") + utf_bytes(u) + strlen("\")");
+
+                               /* realloc memory for string length */
+
+                               logtext = DMREALLOC(logtext, char, *logtextlen, *logtextlen + len);
+                               *logtextlen += len;
+
+                               /* strcat to the logtext */
+
+                               strcat(logtext, " (Class = \"");
+                               utf_cat_classname(logtext, u);
+                               strcat(logtext, "\")");
+                       }
+               }
+       }
+
+       return logtext;
+}
+
+/* trace_java_call_enter ******************************************************
+   Traces an entry into a java method.
+
+   arg_regs: Array containing all argument registers as int64_t values in
+   the same order as listed in m->methoddesc. The array is usually allocated
+   on the stack and used for restoring the argument registers later.
+
+   stack: Pointer to first on stack argument in the same format passed to 
+   asm_vm_call_method.
+
+*******************************************************************************/
+
+void trace_java_call_enter(methodinfo *m, uint64_t *arg_regs, uint64_t *stack)
+{
+       methoddesc *md;
+       imm_union   arg;
+       char       *logtext;
+       s4          logtextlen;
+       s4          i;
+       s4          pos;
+       int32_t     dumpmarker;
+
+       /* We don't trace builtin functions here because the argument
+          passing happens via the native ABI and does not fit these
+          functions. */
+
+       if (method_is_builtin(m))
+               return;
+
+#if defined(ENABLE_DEBUG_FILTER)
+       if (!show_filters_test_verbosecall_enter(m))
+               return;
+#endif
+
+#if defined(ENABLE_VMLOG)
+       vmlog_cacao_enter_method(m);
+       return;
+#endif
+
+       md = m->parseddesc;
+
+       /* calculate message length */
+
+       logtextlen =
+               strlen("4294967295 ") +
+               strlen("-2147483647-") +        /* INT_MAX should be sufficient       */
+               TRACEJAVACALLINDENT +
+               strlen("called: ") +
+               ((m->clazz == NULL) ? strlen("NULL") : utf_bytes(m->clazz->name)) +
+               strlen(".") +
+               utf_bytes(m->name) +
+               utf_bytes(m->descriptor);
+
+       /* Actually it's not possible to have all flags printed, but:
+          safety first! */
+
+       logtextlen +=
+               strlen(" PUBLIC") +
+               strlen(" PRIVATE") +
+               strlen(" PROTECTED") +
+               strlen(" STATIC") +
+               strlen(" FINAL") +
+               strlen(" SYNCHRONIZED") +
+               strlen(" VOLATILE") +
+               strlen(" TRANSIENT") +
+               strlen(" NATIVE") +
+               strlen(" INTERFACE") +
+               strlen(" ABSTRACT") +
+               strlen(" METHOD_BUILTIN");
+
+       /* add maximal argument length */
+
+       logtextlen +=
+               strlen("(") +
+               strlen("-9223372036854775808 (0x123456789abcdef0), ") * md->paramcount +
+               strlen("...(255)") +
+               strlen(")");
+
+       /* allocate memory */
+
+       DMARKER;
+
+       logtext = DMNEW(char, logtextlen);
+
+       TRACEJAVACALLCOUNT++;
+
+       sprintf(logtext, "%10d ", TRACEJAVACALLCOUNT);
+       sprintf(logtext + strlen(logtext), "-%d-", TRACEJAVACALLINDENT);
+
+       pos = strlen(logtext);
+
+       for (i = 0; i < TRACEJAVACALLINDENT; i++)
+               logtext[pos++] = '\t';
+
+       strcpy(logtext + pos, "called: ");
+
+       if (m->clazz != NULL)
+               utf_cat_classname(logtext, m->clazz->name);
+       else
+               strcat(logtext, "NULL");
+       strcat(logtext, ".");
+       utf_cat(logtext, m->name);
+       utf_cat(logtext, m->descriptor);
+
+       if (m->flags & ACC_PUBLIC)         strcat(logtext, " PUBLIC");
+       if (m->flags & ACC_PRIVATE)        strcat(logtext, " PRIVATE");
+       if (m->flags & ACC_PROTECTED)      strcat(logtext, " PROTECTED");
+       if (m->flags & ACC_STATIC)         strcat(logtext, " STATIC");
+       if (m->flags & ACC_FINAL)          strcat(logtext, " FINAL");
+       if (m->flags & ACC_SYNCHRONIZED)   strcat(logtext, " SYNCHRONIZED");
+       if (m->flags & ACC_VOLATILE)       strcat(logtext, " VOLATILE");
+       if (m->flags & ACC_TRANSIENT)      strcat(logtext, " TRANSIENT");
+       if (m->flags & ACC_NATIVE)         strcat(logtext, " NATIVE");
+       if (m->flags & ACC_INTERFACE)      strcat(logtext, " INTERFACE");
+       if (m->flags & ACC_ABSTRACT)       strcat(logtext, " ABSTRACT");
+
+       strcat(logtext, "(");
+
+       for (i = 0; i < md->paramcount; ++i) {
+               arg = argument_jitarray_load(md, i, arg_regs, stack);
+               logtext = trace_java_call_print_argument(m, logtext, &logtextlen,
+                                                                                                &md->paramtypes[i], arg);
+               if (i != (md->paramcount - 1)) {
+                       strcat(logtext, ", ");
+               }
+       }
+
+       strcat(logtext, ")");
+
+       log_text(logtext);
+
+       /* release memory */
+
+       DRELEASE;
+
+       TRACEJAVACALLINDENT++;
+
+}
+
+/* trace_java_call_exit ********************************************************
+
+   Traces an exit form a java method.
+
+   return_regs: Array of size 1 containing return register.
+   The array is usually allocated on the stack and used for restoring the
+   registers later.
+
+*******************************************************************************/
+
+void trace_java_call_exit(methodinfo *m, uint64_t *return_regs)
+{
+       methoddesc *md;
+       char       *logtext;
+       s4          logtextlen;
+       s4          i;
+       s4          pos;
+       imm_union   val;
+       int32_t     dumpmarker;
+
+       /* We don't trace builtin functions here because the argument
+          passing happens via the native ABI and does not fit these
+          functions. */
+
+       if (method_is_builtin(m))
+               return;
+
+#if defined(ENABLE_DEBUG_FILTER)
+       if (!show_filters_test_verbosecall_exit(m))
+               return;
+#endif
+
+#if defined(ENABLE_VMLOG)
+       vmlog_cacao_leave_method(m);
+       return;
+#endif
+
+       md = m->parseddesc;
+
+       /* outdent the log message */
+
+       if (TRACEJAVACALLINDENT)
+               TRACEJAVACALLINDENT--;
+       else
+               log_text("trace_java_call_exit: WARNING: unmatched unindent");
+
+       /* calculate message length */
+
+       logtextlen =
+               strlen("4294967295 ") +
+               strlen("-2147483647-") +        /* INT_MAX should be sufficient       */
+               TRACEJAVACALLINDENT +
+               strlen("finished: ") +
+               ((m->clazz == NULL) ? strlen("NULL") : utf_bytes(m->clazz->name)) +
+               strlen(".") +
+               utf_bytes(m->name) +
+               utf_bytes(m->descriptor) +
+               strlen(" SYNCHRONIZED") + strlen("(") + strlen(")");
+
+       /* add maximal argument length */
+
+       logtextlen += strlen("->0.4872328470301428 (0x0123456789abcdef)");
+
+       /* allocate memory */
+
+       DMARKER;
+
+       logtext = DMNEW(char, logtextlen);
+
+       /* generate the message */
+
+       sprintf(logtext, "           ");
+       sprintf(logtext + strlen(logtext), "-%d-", TRACEJAVACALLINDENT);
+
+       pos = strlen(logtext);
+
+       for (i = 0; i < TRACEJAVACALLINDENT; i++)
+               logtext[pos++] = '\t';
+
+       strcpy(logtext + pos, "finished: ");
+       if (m->clazz != NULL)
+               utf_cat_classname(logtext, m->clazz->name);
+       else
+               strcat(logtext, "NULL");
+       strcat(logtext, ".");
+       utf_cat(logtext, m->name);
+       utf_cat(logtext, m->descriptor);
+
+       if (!IS_VOID_TYPE(md->returntype.type)) {
+               strcat(logtext, "->");
+               val = argument_jitreturn_load(md, return_regs);
+
+               logtext =
+                       trace_java_call_print_argument(m, logtext, &logtextlen,
+                                                                                  &md->returntype, val);
+       }
+
+       log_text(logtext);
+
+       /* release memory */
+
+       DRELEASE;
+}
+
+
+/* trace_exception *************************************************************
+
+   Traces an exception which is handled by exceptions_handle_exception.
+
+*******************************************************************************/
+
+void trace_exception(java_object_t *xptr, methodinfo *m, void *pos)
+{
+       char *logtext;
+       s4    logtextlen;
+       codeinfo *code;
+       int32_t   dumpmarker;
+
+       /* calculate message length */
+
+       if (xptr) {
+               logtextlen =
+                       strlen("Exception ") + utf_bytes(xptr->vftbl->clazz->name);
+       } 
+       else {
+               logtextlen = strlen("Some Throwable");
+       }
+
+       logtextlen += strlen(" thrown in ");
+
+       if (m) {
+               logtextlen +=
+                       utf_bytes(m->clazz->name) +
+                       strlen(".") +
+                       utf_bytes(m->name) +
+                       utf_bytes(m->descriptor) +
+                       strlen("(NOSYNC,NATIVE");
+
+#if SIZEOF_VOID_P == 8
+               logtextlen +=
+                       strlen(")(0x123456789abcdef0) at position 0x123456789abcdef0 (");
+#else
+               logtextlen += strlen(")(0x12345678) at position 0x12345678 (");
+#endif
+
+               if (m->clazz->sourcefile == NULL)
+                       logtextlen += strlen("<NO CLASSFILE INFORMATION>");
+               else
+                       logtextlen += utf_bytes(m->clazz->sourcefile);
+
+               logtextlen += strlen(":65536)");
+
+       } 
+       else {
+               logtextlen += strlen("call_java_method");
+       }
+
+       logtextlen += strlen("0");
+
+       /* allocate memory */
+
+       DMARKER;
+
+       logtext = DMNEW(char, logtextlen);
+
+       if (xptr) {
+               strcpy(logtext, "Exception ");
+               utf_cat_classname(logtext, xptr->vftbl->clazz->name);
+
+       } else {
+               strcpy(logtext, "Some Throwable");
+       }
+
+       strcat(logtext, " thrown in ");
+
+       if (m) {
+               utf_cat_classname(logtext, m->clazz->name);
+               strcat(logtext, ".");
+               utf_cat(logtext, m->name);
+               utf_cat(logtext, m->descriptor);
+
+               if (m->flags & ACC_SYNCHRONIZED)
+                       strcat(logtext, "(SYNC");
+               else
+                       strcat(logtext, "(NOSYNC");
+
+               if (m->flags & ACC_NATIVE) {
+                       strcat(logtext, ",NATIVE");
+
+                       code = m->code;
+
+#if SIZEOF_VOID_P == 8
+                       sprintf(logtext + strlen(logtext),
+                                       ")(0x%016lx) at position 0x%016lx",
+                                       (ptrint) code->entrypoint, (ptrint) pos);
+#else
+                       sprintf(logtext + strlen(logtext),
+                                       ")(0x%08x) at position 0x%08x",
+                                       (ptrint) code->entrypoint, (ptrint) pos);
+#endif
+
+               } else {
+
+                       /* XXX preliminary: This should get the actual codeinfo */
+                       /* in which the exception happened.                     */
+                       code = m->code;
+                       
+#if SIZEOF_VOID_P == 8
+                       sprintf(logtext + strlen(logtext),
+                                       ")(0x%016lx) at position 0x%016lx (",
+                                       (ptrint) code->entrypoint, (ptrint) pos);
+#else
+                       sprintf(logtext + strlen(logtext),
+                                       ")(0x%08x) at position 0x%08x (",
+                                       (ptrint) code->entrypoint, (ptrint) pos);
+#endif
+
+                       if (m->clazz->sourcefile == NULL)
+                               strcat(logtext, "<NO CLASSFILE INFORMATION>");
+                       else
+                               utf_cat(logtext, m->clazz->sourcefile);
+
+                       sprintf(logtext + strlen(logtext), ":%d)", 0);
+               }
+
+       } else
+               strcat(logtext, "call_java_method");
+
+       log_text(logtext);
+
+       /* release memory */
+
+       DRELEASE;
+}
+
+
+/* trace_exception_builtin *****************************************************
+
+   Traces an exception which is thrown by builtin_throw_exception.
+
+*******************************************************************************/
+
+void trace_exception_builtin(java_object_t *xptr)
+{
+       java_lang_Throwable *t;
+       java_lang_String    *s;
+       char                *logtext;
+       s4                   logtextlen;
+       int32_t              dumpmarker;
+
+       t = (java_lang_Throwable *) xptr;
+
+       /* get detail message */
+       if (t)
+               LLNI_field_get_ref(t, detailMessage, s);
+
+       /* calculate message length */
+
+       logtextlen = strlen("Builtin exception thrown: ") + strlen("0");
+
+       if (t) {
+               logtextlen +=
+                       utf_bytes(xptr->vftbl->clazz->name);
+               if (s) {
+                       logtextlen += strlen(": ") +
+                               u2_utflength(LLNI_field_direct(s, value)->data 
+                                                               + LLNI_field_direct(s, offset),
+                                                        LLNI_field_direct(s,count));
+               }
+       } 
+       else {
+               logtextlen += strlen("(nil)");
+       }
+
+       /* allocate memory */
+
+       DMARKER;
+
+       logtext = DMNEW(char, logtextlen);
+
+       strcpy(logtext, "Builtin exception thrown: ");
+
+       if (t) {
+               utf_cat_classname(logtext, xptr->vftbl->clazz->name);
+
+               if (s) {
+                       char *buf;
+
+                       buf = javastring_tochar((java_handle_t *) s);
+                       strcat(logtext, ": ");
+                       strcat(logtext, buf);
+                       MFREE(buf, char, strlen(buf) + 1);
+               }
+
+       } else {
+               strcat(logtext, "(nil)");
+       }
+
+       log_text(logtext);
+
+       /* release memory */
+
+       DRELEASE;
+}
+
+#endif /* !defined(NDEBUG) */
+
+} // extern "C"
+
+
+/*
+ * 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/vm/jit/trace.h b/src/vm/jit/trace.h
deleted file mode 100644 (file)
index db41359..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* src/vm/jit/trace.h - Functions for tracing from java code.
-
-   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
-
-   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 _VM_JIT_TRACE_H
-#define _VM_JIT_TRACE_H
-
-#include "config.h"
-
-#include <stdint.h>
-
-#include "vmcore/method.h"
-
-#if !defined(NDEBUG)
-
-void trace_java_call_enter(methodinfo *m, uint64_t *arg_regs, uint64_t *stack);
-void trace_java_call_exit(methodinfo *m, uint64_t *return_regs);
-
-void trace_exception(java_object_t *xptr, methodinfo *m, void *pos);
-void trace_exception_builtin(java_object_t *xptr);
-
-#endif /* !defined(NDEBUG) */
-
-#endif /* _VM_JIT_TRACE_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:
- * vim:noexpandtab:sw=4:ts=4:
- */
diff --git a/src/vm/jit/trace.hpp b/src/vm/jit/trace.hpp
new file mode 100644 (file)
index 0000000..c382678
--- /dev/null
@@ -0,0 +1,69 @@
+/* src/vm/jit/trace.hpp - Functions for tracing from java code.
+
+   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 _VM_JIT_TRACE_HPP
+#define _VM_JIT_TRACE_HPP
+
+// FIXME For now we export everything as C functions.
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "vmcore/method.h"
+
+#if !defined(NDEBUG)
+
+void trace_java_call_enter(methodinfo *m, uint64_t *arg_regs, uint64_t *stack);
+void trace_java_call_exit(methodinfo *m, uint64_t *return_regs);
+
+void trace_exception(java_object_t *xptr, methodinfo *m, void *pos);
+void trace_exception_builtin(java_object_t *xptr);
+
+#endif /* !defined(NDEBUG) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _VM_JIT_TRACE_HPP
+
+
+/*
+ * 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:
+ */
index 163f840c26fb30a299827140c67dd09d93824d9e..3e29d711111fe4400dadde5f08461a5bb736a396 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/x86_64/emit.c - x86_64 code emitter functions
 
-   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.
 
@@ -47,7 +45,7 @@
 #include "vm/jit/jit.h"
 #include "vm/jit/patcher-common.h"
 #include "vm/jit/replace.h"
-#include "vm/jit/trace.h"
+#include "vm/jit/trace.hpp"
 #include "vm/jit/trap.h"
 
 #include "vmcore/options.h"