* src/cacaoh/headers.c (inline_debug_log): Added dummy variable.
[cacao.git] / src / cacaoh / headers.c
index a3f83f6eecad156bb864c44694575baa7ea5dd6d..930d47a01b4ff3394b2a36a26a418e50d0beaafa 100644 (file)
    Contact: cacao@cacaojvm.org
 
    Authors: Reinhard Grafl
-
-   Changes: Mark Probst
+            Mark Probst
             Philipp Tomsich
             Christian Thalinger
-                       Edwin Steiner
+            Edwin Steiner
 
-   $Id: headers.c 5251 2006-08-18 13:01:00Z twisti $
+   $Id: headers.c 5973 2006-11-12 15:01:14Z edwin $
 
 */
 
@@ -53,7 +52,7 @@
 # include <ucontext.h>
 #endif
 
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
 #include "mm/memory.h"
 #include "native/include/java_lang_String.h"
 #include "native/include/java_lang_Throwable.h"
@@ -72,7 +71,7 @@
 /* Invocation API variables ***************************************************/
 
 _Jv_JavaVM *_Jv_jvm;                    /* denotes a Java VM                  */
-
+char       *_Jv_bootclasspath;
 
 #if defined(ENABLE_INTRP)
 /* dummy interpreter stack to keep the compiler happy */
@@ -81,6 +80,12 @@ u1 *intrp_main_stack;
 #endif
 
 
+#if !defined(NDEBUG)
+/* dummy variable */
+bool inline_debug_log = false;
+#endif
+
+
 /* for raising exceptions from native methods *********************************/
 
 #if !defined(ENABLE_THREADS)
@@ -109,6 +114,16 @@ java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
 
 void vm_abort(const char *text, ...)
 {
+       va_list ap;
+
+       /* print the log message */
+
+       va_start(ap, text);
+       vfprintf(stderr, text, ap);
+       va_end(ap);
+
+       /* now abort the VM */
+
        abort();
 }
 
@@ -143,13 +158,14 @@ u1* asm_initialize_thread_stack(void *func, u1 *stack) { return NULL; }
 void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void * p) { return NULL; }
 
 void asm_handle_builtin_exception(classinfo *c) {}
-void asm_abstractmethoderror(void) {}
 
 #if defined(ENABLE_JIT)
+void asm_abstractmethoderror(void) {}
 void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out) {}
 #endif
 
 #if defined(ENABLE_INTRP)
+void intrp_asm_abstractmethoderror(void) {}
 void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out) {}
 #endif
 
@@ -179,12 +195,16 @@ bool typeinfo_init_class(typeinfo *info,classref_or_classinfo c)
 }
 
 void typeinfo_print(FILE *file,typeinfo *info,int indent) {}
+void typeinfo_print_short(FILE *file,typeinfo *info) {}
 
 void exceptions_print_exception(java_objectheader *xptr) {}
+void stacktrace_dump_trace(threadobject *thread) {}
 void stacktrace_print_trace(java_objectheader *xptr) {}
 java_objectarray *stacktrace_getClassContext() { return NULL; }
 void code_free_code_of_method(methodinfo *m) {}
 
+void jit_invalidate_code(methodinfo *m) {}
+
 
 /* exception functions ********************************************************/
 
@@ -453,7 +473,7 @@ void exceptions_throw_arraystoreexception(void)
 }
 
 
-java_objectheader *new_illegalmonitorstateexception(void)
+java_objectheader *exceptions_throw_illegalmonitorstateexception(void)
 {
        fprintf(stderr, "%s", string_java_lang_IllegalMonitorStateException);
        exit(1);
@@ -481,7 +501,7 @@ void exceptions_throw_negativearraysizeexception(void)
 }
 
 
-java_objectheader *new_nullpointerexception(void)
+java_objectheader *exceptions_new_nullpointerexception(void)
 {
        fprintf(stderr, "%s", string_java_lang_NullPointerException);
        exit(1);
@@ -494,7 +514,7 @@ java_objectheader *new_nullpointerexception(void)
 
 void exceptions_throw_nullpointerexception(void)
 {
-       (void) new_nullpointerexception();
+       (void) exceptions_new_nullpointerexception();
 }
 
 
@@ -519,6 +539,8 @@ void print_dynamic_super_statistics(void) {}
 
 /************************ global variables **********************/
 
+#define ACC_NATIVELY_OVERLOADED    0x10000000
+
 chain *ident_chain;     /* chain with method and field names in current class */
 FILE *file = NULL;
 static u4 outputsize;
@@ -552,7 +574,7 @@ static void addoutputsize (int len)
        u4 newsize,i;
        if (!dopadding) return;
 
-       newsize = ALIGN(outputsize, len);
+       newsize = MEMORY_ALIGN(outputsize, len);
        
        for (i = outputsize; i < newsize; i++) fprintf(file, "   u1 pad%d\n", (int) i);
        outputsize = newsize;
@@ -745,11 +767,9 @@ void printmethod(methodinfo *m)
        fprintf(file, "_");
        printID(m->name);
 
-       /* ATTENTION: We use the methodinfo's stackcount variable as
-          nativelyoverloaded, so we can save some space during
-          runtime. */
+       /* ATTENTION: We use a dummy flag here. */
 
-       if (m->stackcount)
+       if (m->flags & ACC_NATIVELY_OVERLOADED)
                printOverloadPart(m->descriptor);
 
        fprintf(file, "(JNIEnv *env");
@@ -871,11 +891,9 @@ void headerfile_generate(classinfo *c, char *opt_directory)
                if (!(m->flags & ACC_NATIVE))
                        continue;
 
-               /* We use the methodinfo's stackcount variable as
-                  nativelyoverloaded, so we can save some space during
-                  runtime. */
+               /* We use a dummy flag here. */
 
-               if (!m->stackcount) {
+               if (!(m->flags & ACC_NATIVELY_OVERLOADED)) {
                        nativelyoverloaded = false;
 
                        for (j = i + 1; j < c->methodscount; j++) {
@@ -885,13 +903,14 @@ void headerfile_generate(classinfo *c, char *opt_directory)
                                        continue;
 
                                if (m->name == m2->name) {
-                                       m2->stackcount     = true;
-                                       nativelyoverloaded = true;
+                                       m2->flags          |= ACC_NATIVELY_OVERLOADED;
+                                       nativelyoverloaded  = true;
                                }
                        }
                }
 
-               m->stackcount = nativelyoverloaded;
+               if (nativelyoverloaded == true)
+                       m->flags |= ACC_NATIVELY_OVERLOADED;
        }
 
        for (i = 0; i < c->methodscount; i++) {