* src/vm/builtin.c (builtintable_init): Create builtin stubs for
authormichi <none@none>
Mon, 20 Aug 2007 14:25:59 +0000 (14:25 +0000)
committermichi <none@none>
Mon, 20 Aug 2007 14:25:59 +0000 (14:25 +0000)
builtintable_function as well.

* src/vm/builtintable.inc (builtintable_function): Create stubs for arraycopy.

--HG--
branch : exact-gc

18 files changed:
configure.ac
src/Makefile.am
src/lib/Makefile.am
src/native/include/Makefile.am
src/native/vm/gnu/java_lang_VMString.c
src/native/vm/java_lang_String.c [new file with mode: 0644]
src/native/vm/java_lang_String.h [new file with mode: 0644]
src/threads/threads-common.h
src/vm/builtin.c
src/vm/builtintable.inc
src/vm/jit/s390/asmpart.S
src/vm/jit/s390/emit.c
src/vm/jit/s390/md.c
src/vm/jit/trace.c [new file with mode: 0644]
src/vm/jit/trace.h [new file with mode: 0644]
src/vm/properties.c
src/vm/stringlocal.h
src/vmcore/zip.c

index 74312f04a8e72afb36a156b213e92c69e95df0f2..b1ade80a8e09ef72dbd3bc93335f763cf7543b43 100644 (file)
@@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 dnl 02110-1301, USA.
 dnl 
-dnl $Id: configure.ac 8301 2007-08-13 13:34:12Z twisti $
+dnl $Id: configure.ac 8321 2007-08-16 11:37:25Z michi $
 
 dnl Process this file with autoconf to produce a configure script.
 
index 1681eddf5b875405bdb6538e11391e928c126c52..b608e8b0a828fa2e66e64ba38e6d02b63e80f7e6 100644 (file)
@@ -22,7 +22,7 @@
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ## 02110-1301, USA.
 ##
-## $Id: Makefile.am 7596 2007-03-28 21:05:53Z twisti $
+## $Id: Makefile.am 7601 2007-03-28 23:02:50Z michi $
 
 ## Process this file with automake to produce Makefile.in
 
index af5834f9849140db0b0b9e489c48dcbc5ee51637..cb62428c52d70d0dd51a50ff8872ced5129c4f46 100644 (file)
@@ -22,7 +22,7 @@
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ## 02110-1301, USA.
 ##
-## $Id: Makefile.am 8262 2007-08-06 12:44:01Z panzi $
+## $Id: Makefile.am 8299 2007-08-13 08:41:18Z michi $
 
 ## Process this file with automake to produce Makefile.in
 
index ab712873cb983a204aea636ee9a08236fdc146f6..d0918e937ec31b110a9af3c07db014f0d08bb971 100644 (file)
@@ -22,7 +22,7 @@
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ## 02110-1301, USA.
 ##
-## $Id: Makefile.am 8249 2007-07-31 12:59:03Z panzi $
+## $Id: Makefile.am 8299 2007-08-13 08:41:18Z michi $
 
 ## Process this file with automake to produce Makefile.in
 
index cec8d0bc9839de645055b3677739b281c219b45e..2832202fdb7ba44e73bed5095704198af5cfc2e2 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_VMString.c 8017 2007-06-05 23:46:59Z twisti $
+   $Id: java_lang_VMString.c 8027 2007-06-07 10:30:33Z michi $
 
 */
 
diff --git a/src/native/vm/java_lang_String.c b/src/native/vm/java_lang_String.c
new file mode 100644 (file)
index 0000000..495209c
--- /dev/null
@@ -0,0 +1,73 @@
+/* src/native/vm/java_lang_String.c
+
+   Copyright (C) 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.
+
+   $Id: java_lang_VMString.c 7910 2007-05-16 08:02:52Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <stdlib.h>
+
+#include "native/jni.h"
+#include "native/llni.h"
+
+#include "native/include/java_lang_String.h"
+
+#include "vm/stringlocal.h"
+
+
+/*
+ * Class:     java/lang/String
+ * Method:    intern
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+java_lang_String *_Jv_java_lang_String_intern(java_lang_String *s)
+{
+       java_handle_t *o;
+
+       if (s == NULL)
+               return NULL;
+
+       /* search table so identical strings will get identical pointers */
+
+       o = literalstring_u2(LLNI_field_direct(s, value), LLNI_field_direct(s, count), LLNI_field_direct(s, offset), true);
+
+       return (java_lang_String *) o;
+}
+
+
+/*
+ * 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/native/vm/java_lang_String.h b/src/native/vm/java_lang_String.h
new file mode 100644 (file)
index 0000000..506ce33
--- /dev/null
@@ -0,0 +1,59 @@
+/* src/native/vm/java_lang_String.h - java/lang/String functions
+
+   Copyright (C) 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.
+
+   $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
+
+*/
+
+
+#ifndef _JV_JAVA_LANG_STRING_H
+#define _JV_JAVA_LANG_STRING_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "native/jni.h"
+
+#include "native/include/java_lang_String.h"
+
+
+/* function prototypes ********************************************************/
+
+java_lang_String *_Jv_java_lang_String_intern(java_lang_String *s);
+
+#endif /* _JV_JAVA_LANG_STRING_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 abcb13cfdf4202218c11ba1806a591604a2c41f8..24a797f9b5e2428ab92910046ff6790c7a440836 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads-common.h 8222 2007-07-22 20:07:55Z twisti $
+   $Id: threads-common.h 8245 2007-07-31 09:55:04Z michi $
 
 */
 
index 69e93ed57d68ba4f94865e348124903e6abec89d..ddacb738189c62d49fa526ae7340b7a8f4bae55c 100644 (file)
@@ -28,7 +28,7 @@
    calls instead of machine instructions, using the C calling
    convention.
 
-   $Id: builtin.c 8343 2007-08-17 21:39:32Z michi $
+   $Id: builtin.c 8358 2007-08-20 14:25:59Z michi $
 
 */
 
@@ -192,6 +192,10 @@ static bool builtintable_init(void)
                                                                                                        bte->descriptor,
                                                                                                        ACC_STATIC | ACC_METHOD_BUILTIN,
                                                                                                        NULL);
+
+               /* no stubs should be needed for this table */
+
+               assert(!bte->flags & BUILTINTABLE_FLAG_STUB);
        }
 
        for (bte = builtintable_function; bte->fp != NULL; bte++) {
@@ -200,6 +204,11 @@ static bool builtintable_init(void)
                                                                                                        bte->descriptor,
                                                                                                        ACC_STATIC | ACC_METHOD_BUILTIN,
                                                                                                        NULL);
+
+               /* generate a builtin stub if we need one */
+
+               if (bte->flags & BUILTINTABLE_FLAG_STUB)
+                       codegen_generate_stub_builtin(bte);
        }
 
        /* release dump area */
index fa962036249eccd3d68133163678b1b627f317b6..4e4dbcba758f0df44e7ae37f858f485462998635 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: builtintable.inc 8245 2007-07-31 09:55:04Z michi $
+   $Id: builtintable.inc 8358 2007-08-20 14:25:59Z michi $
 
 */
 
@@ -967,7 +967,7 @@ static builtintable_entry builtintable_function[] = {
 
        {
                ICMD_BUILTIN,
-               BUILTINTABLE_FLAG_EXCEPTION,
+               BUILTINTABLE_FLAG_STUB | BUILTINTABLE_FLAG_EXCEPTION,
                BUILTIN_arraycopy,
                NULL,
                "java/lang/VMSystem",
@@ -987,7 +987,7 @@ static builtintable_entry builtintable_function[] = {
 
        {
                ICMD_BUILTIN,
-               BUILTINTABLE_FLAG_EXCEPTION,
+               BUILTINTABLE_FLAG_STUB | BUILTINTABLE_FLAG_EXCEPTION,
                BUILTIN_arraycopy,
                NULL,
                "java/lang/System",
index 6a1b038039f3b4aeacb79ee21d4b89c16537ab68..de89c58db6d4d6335bd9ba312c1e3d23ac7c1dad 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.S 8298 2007-08-12 18:49:16Z pm $
+   $Id: asmpart.S 8299 2007-08-13 08:41:18Z michi $
 
 */
 
index d1a70b9a8671e68bf055b9824cd9760f673d94f8..d9c89657ecb157c916f460374673b4bbfb0f2ec0 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 8318 2007-08-16 10:05:34Z michi $
+   $Id: emit.c 8321 2007-08-16 11:37:25Z michi $
 
 */
 
index b257a40355d7b01572fe7063a0e5f89571ffe8ef..9f9331869609ae8f48efcf58dfa5df5529e0c566 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 8298 2007-08-12 18:49:16Z pm $
+   $Id: md.c 8299 2007-08-13 08:41:18Z michi $
 
 */
 
diff --git a/src/vm/jit/trace.c b/src/vm/jit/trace.c
new file mode 100644 (file)
index 0000000..d6b8f5a
--- /dev/null
@@ -0,0 +1,454 @@
+/* src/vm/jit/trace.c - 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.
+
+   $Id: trace.c 8321 2007-08-16 11:37:25Z michi $
+
+*/
+
+#include "arch.h"
+#include "md-abi.h"
+
+#include "mm/memory.h"
+
+#if defined(ENABLE_THREADS)
+#include "threads/native/threads.h"
+#else
+#include "threads/none/threads.h"
+#endif
+
+#include "toolbox/logging.h"
+
+#include "vm/global.h"
+#include "vm/stringlocal.h"
+#include "vm/jit/codegen-common.h"
+#include "vm/jit/trace.h"
+#include "vm/jit/show.h"
+
+#include "vmcore/utf8.h"
+
+#include <stdio.h>
+
+#if !defined(NDEBUG)
+
+#if !defined(ENABLE_THREADS)
+s4 _no_threads_tracejavacallindent = 0;
+u4 _no_threads_tracejavacallcount= 0;
+#endif
+
+/* _array_load_param **********************************************************
+   Returns the argument specified by pd and td from one of the passed arrays
+   and returns it.
+
+*******************************************************************************/
+
+static imm_union _array_load_param(paramdesc *pd, typedesc *td, uint64_t *arg_regs, uint64_t *stack) {
+       imm_union ret;
+
+       switch (td->type) {
+               case TYPE_INT:
+               case TYPE_ADR:
+                       if (pd->inmemory) {
+#if (SIZEOF_VOID_P == 8)
+                               ret.l = (int64_t)stack[pd->index];
+#else
+                               ret.l = *(int32_t *)(stack + pd->index);
+#endif
+                       } else {
+                               ret.l = arg_regs[pd->index];
+                       }
+                       break;
+               case TYPE_LNG:
+                       if (pd->inmemory) {
+                               ret.l = (int64_t)stack[pd->index];
+                       } else {
+#if (SIZEOF_VOID_P == 8)
+                               ret.l = (int64_t)arg_regs[pd->index];
+#else
+                               ret.l = (int64_t)(
+                                       (arg_regs[GET_HIGH_REG(pd->index)] << 32) |
+                                       (arg_regs[GET_LOW_REG(pd->index)] & 0xFFFFFFFF)
+                               );
+#endif
+                       }
+                       break;
+               case TYPE_FLT:
+                       if (pd->inmemory) {
+                               ret.l = (int64_t)stack[pd->index];
+                       } else {
+                               ret.l = (int64_t)arg_regs[pd->index + INT_ARG_CNT];
+                       }
+                       break;
+               case TYPE_DBL:
+                       if (pd->inmemory) {
+                               ret.l = (int64_t)stack[pd->index];
+                       } else {
+                               ret.l = (int64_t)arg_regs[pd->index + INT_ARG_CNT];
+                       }
+                       break;
+       }
+
+       return ret;
+}
+
+/* _array_load_return_value ***************************************************
+
+   Loads the proper return value form the return registers array and returns it.
+
+*******************************************************************************/
+
+static imm_union _array_load_return_value(typedesc *td, uint64_t *return_regs) {
+       imm_union ret;
+
+       switch (td->type) {
+               case TYPE_INT:
+               case TYPE_ADR:
+                       ret.l = return_regs[0];
+                       break;
+               case TYPE_LNG:
+#if (SIZEOF_VOID_P == 8)
+                       ret.l = (int64_t)return_regs[0];
+#else
+                       ret.l = (int64_t)(
+                               (return_regs[0] << 32) | (return_regs[1] & 0xFFFFFFFF)
+                       );
+#endif
+                       break;
+               case TYPE_FLT:
+                       ret.l = (int64_t)return_regs[2];
+                       break;
+               case TYPE_DBL:
+                       ret.l = (int64_t)return_regs[2];
+                       break;
+       }
+
+       return ret;
+}
+
+static char *trace_java_call_print_argument(char *logtext, s4 *logtextlen,
+                                                                               typedesc *paramtype, imm_union imu)
+{
+       java_handle_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
+
+               /* cast to java.lang.Object */
+
+               o = (java_handle_t *) (ptrint) imu.l;
+
+               /* check return argument for java.lang.Class or java.lang.String */
+
+               if (o != NULL) {
+                       if (o->vftbl->class == 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->class == 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->class->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;
+}
+
+void trace_java_call_enter(methodinfo *m, uint64_t *arg_regs, uint64_t *stack) {
+       methoddesc *md;
+       paramdesc *pd;
+       typedesc *td;
+       imm_union arg;
+       char       *logtext;
+       s4          logtextlen;
+       s4          dumpsize;
+       s4          i;
+       s4          pos;
+
+#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: ") +
+               utf_bytes(m->class->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");
+
+       /* add maximal argument length */
+
+       logtextlen +=
+               strlen("(") +
+               strlen("-9223372036854775808 (0x123456789abcdef0), ") * md->paramcount +
+               strlen("...(255)") +
+               strlen(")");
+
+       /* allocate memory */
+
+       dumpsize = dump_size();
+
+       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: ");
+
+       utf_cat_classname(logtext, m->class->name);
+       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) {
+               pd = &md->params[i];
+               td = &md->paramtypes[i];
+               arg = _array_load_param(pd, td, arg_regs, stack);
+               logtext = trace_java_call_print_argument(
+                       logtext, &logtextlen, td, arg
+               );
+               if (i != (md->paramcount - 1)) {
+                       strcat(logtext, ", ");
+               }
+       }
+
+       strcat(logtext, ")");
+
+       log_text(logtext);
+
+       /* release memory */
+
+       dump_release(dumpsize);
+
+       TRACEJAVACALLINDENT++;
+
+}
+
+void trace_java_call_exit(methodinfo *m, uint64_t *return_regs)
+{
+       methoddesc *md;
+       char       *logtext;
+       s4          logtextlen;
+       s4          dumpsize;
+       s4          i;
+       s4          pos;
+       imm_union   val;
+
+#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;
+
+       /* calculate message length */
+
+       logtextlen =
+               strlen("4294967295 ") +
+               strlen("-2147483647-") +        /* INT_MAX should be sufficient       */
+               TRACEJAVACALLINDENT +
+               strlen("finished: ") +
+               utf_bytes(m->class->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 */
+
+       dumpsize = dump_size();
+
+       logtext = DMNEW(char, logtextlen);
+
+       /* outdent the log message */
+
+       if (TRACEJAVACALLINDENT)
+               TRACEJAVACALLINDENT--;
+       else
+               log_text("WARNING: unmatched TRACEJAVACALLINDENT--");
+
+       /* 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: ");
+       utf_cat_classname(logtext, m->class->name);
+       strcat(logtext, ".");
+       utf_cat(logtext, m->name);
+       utf_cat(logtext, m->descriptor);
+
+       if (!IS_VOID_TYPE(md->returntype.type)) {
+               strcat(logtext, "->");
+               val = _array_load_return_value(&md->returntype, return_regs);
+
+               logtext =
+                       trace_java_call_print_argument(logtext, &logtextlen, &md->returntype, val);
+       }
+
+       log_text(logtext);
+
+       /* release memory */
+
+       dump_release(dumpsize);
+
+}
+
+#endif /* !defined(NDEBUG) */
+
diff --git a/src/vm/jit/trace.h b/src/vm/jit/trace.h
new file mode 100644 (file)
index 0000000..0659e87
--- /dev/null
@@ -0,0 +1,72 @@
+/* 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.
+
+   $Id: trace.h 8321 2007-08-16 11:37:25Z michi $
+
+*/
+
+#ifndef _VM_JIT_TRACE_H
+#define _VM_JIT_TRACE_H
+
+#include <stdint.h>
+
+#include "vmcore/method.h"
+
+#if !defined(NDEBUG)
+
+/* trace_java_call_enter ******************************************************
+   Traces an entry into a java method.
+
+   arg_regs: Array of size ARG_CNT containing all argument registers in
+   the same format as in asm_vm_call_method. 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);
+
+/* trace_java_call_exit ********************************************************
+   Traces an exit form a java method.
+
+   return_regs: Array of size 3 containing return registers:
+     [0] : REG_RESULT
+        [1] : REG_RESULT2 (if available on architecture)
+        [2] : REG_FRESULT
+   The array is usually allocated on the stack and used for restoring the
+   registers later. The format of the array is the same as the format of 
+   register arguments passed to asm_vm_call_method.
+
+*******************************************************************************/
+
+void trace_java_call_exit(methodinfo *m, uint64_t *return_regs);
+
+#endif /* !defined(NDEBUG) */
+
+#endif
+
index 69458063f24cd0dc0221f97fb04e0cbea8f77864..1b2e4df819c9caa3be87d682d3329ca04598e1c8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: properties.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: properties.c 8299 2007-08-13 08:41:18Z michi $
 
 */
 
index 64c68cb96469810d87a75ae8b5476449ed225baa..d367d28c91087ab96e8df2d1aed263337f0d0817 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: stringlocal.h 8318 2007-08-16 10:05:34Z michi $
+   $Id: stringlocal.h 8321 2007-08-16 11:37:25Z michi $
 
 */
 
index 84511522d62a73cbc18bb652f3e02e1d39b130a2..757712c97444b18389bd7d72e06bea063d51d87b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: zip.c 7548 2007-03-21 13:19:44Z twisti $
+   $Id: zip.c 7601 2007-03-28 23:02:50Z michi $
 
 */