GNU header update.
[cacao.git] / src / vm / builtin.c
index ae8f01742b4923add036e91635961a3d66f8f627..bdbd2d7df38fa2867ec6435811a16ebb68740ac7 100644 (file)
@@ -1,9 +1,9 @@
-/* builtin.c - functions for unsupported operations
+/* vm/builtin.c - functions for unsupported operations
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
+   Copyright (C) 1996-2005 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.
 
@@ -34,7 +34,7 @@
    calls instead of machine instructions, using the C calling
    convention.
 
-   $Id: builtin.c 1369 2004-08-01 21:53:32Z stefan $
+   $Id: builtin.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
 #include <assert.h>
 #include <string.h>
 #include <math.h>
-#include "exceptions.h"
-#include "global.h"
-#include "options.h"
-#include "builtin.h"
-#include "native.h"
-#include "loader.h"
-#include "tables.h"
-#include "asmpart.h"
+
 #include "mm/boehm.h"
-#include "threads/thread.h"
-#include "threads/locks.h"
+#include "mm/memory.h"
+#include "native/native.h"
+#include "native/include/java_lang_Cloneable.h"
+#include "native/include/java_lang_VMObject.h"
+
+#if defined(USE_THREADS)
+# if defined(NATIVE_THREADS)
+#  include "threads/native/threads.h"
+# else
+#  include "threads/green/threads.h"
+#  include "threads/green/locks.h"
+# endif
+#endif
+
 #include "toolbox/logging.h"
-#include "toolbox/memory.h"
-#include "nat/java_lang_Cloneable.h"
-#include "nat/java_lang_VMObject.h"
+#include "vm/builtin.h"
+#include "vm/exceptions.h"
+#include "vm/global.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/tables.h"
+#include "vm/jit/asmpart.h"
 
 
 #undef DEBUG /*define DEBUG 1*/
@@ -265,7 +274,7 @@ s4 builtin_arrayinstanceof(java_objectheader *obj, vftbl_t *target)
 
 java_objectheader *builtin_throw_exception(java_objectheader *xptr)
 {
-       if (verbose) {
+       if (opt_verbose) {
                char logtext[MAXLOGTEXT];
                sprintf(logtext, "Builtin exception thrown: ");
                if (xptr) {
@@ -276,7 +285,7 @@ java_objectheader *builtin_throw_exception(java_objectheader *xptr)
 
                        if (t->detailMessage) {
                                sprintf(logtext + strlen(logtext), ": %s",
-                                               javastring_tochar(t->detailMessage));
+                                               javastring_tochar((java_objectheader *) t->detailMessage));
                        }
 
                } else {
@@ -777,7 +786,7 @@ java_objectheader *builtin_trace_exception(java_objectheader *xptr,
                else
                        log_text("WARNING: unmatched methodindent--");
        }
-       if (verbose || runverbose || verboseexception) {
+       if (opt_verbose || runverbose || verboseexception) {
                if (xptr) {
                        printf("Exception ");
                        utf_display_classname(xptr->vftbl->class->name);
@@ -791,25 +800,39 @@ java_objectheader *builtin_trace_exception(java_objectheader *xptr,
                        utf_display_classname(m->class->name);
                        printf(".");
                        utf_display(m->name);
-                       if (m->flags & ACC_SYNCHRONIZED)
+                       if (m->flags & ACC_SYNCHRONIZED) {
                                printf("(SYNC");
-                       else
+
+                       } else{
                                printf("(NOSYNC");
+                       }
+
                        if (m->flags & ACC_NATIVE) {
                                printf(",NATIVE");
-                               printf(")(%p) at position %p\n", m->entrypoint, pos);
+#if POINTERSIZE == 8
+                               printf(")(0x%016lx) at position %p\n", (s8) m->entrypoint, pos);
+#else
+                               printf(")(0x%08lx) at position %p\n", (s4) m->entrypoint, pos);
+#endif
+
                        } else {
-                               printf(")(%p) at position %p (", m->entrypoint, pos);
-                               if (m->class->sourcefile==NULL)
+#if POINTERSIZE == 8
+                               printf(")(0x%016lx) at position %p (", (s8) m->entrypoint, pos);
+#else
+                               printf(")(0x%08lx) at position %p (", (s4) m->entrypoint, pos);
+#endif
+                               if (m->class->sourcefile == NULL) {
                                        printf("<NO CLASSFILE INFORMATION>");
-                               else
+
+                               } else {
                                        utf_display(m->class->sourcefile);
+                               }
                                printf(":%d)\n", line);
                        }
 
                } else
                        printf("call_java_method\n");
-               fflush (stdout);
+               fflush(stdout);
        }
 
        return xptr;
@@ -1148,6 +1171,7 @@ void builtin_monitorenter(java_objectheader *o)
        monitorEnter((threadobject *) THREADOBJECT, o);
 #endif
 #endif
+
 }
 
 /*
@@ -1784,7 +1808,8 @@ inline float longBitsToDouble(s8 l)
 
 java_arrayheader *builtin_clone_array(void *env, java_arrayheader *o)
 {
-       return (java_arrayheader *) Java_java_lang_VMObject_clone(0, 0, (java_lang_Cloneable *) o);
+       return (java_arrayheader *)
+               Java_java_lang_VMObject_clone(0, 0, (java_lang_Cloneable *) o);
 }