merged threadlist & threadobject improvements
[cacao.git] / src / vm / exceptions.cpp
index 521b2db93283ed45e2853d8c4b1da241787d702f..707efa4c31ea88a321104f91070972f9ae1c2a21 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/exceptions.cpp - exception related functions
 
-   Copyright (C) 1996-2005, 2006, 2007, 2008
+   Copyright (C) 1996-2011
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 #include <string.h>
 #include <stdarg.h>
 #include <stdlib.h>
-#include <sys/mman.h>
 
 #include "vm/types.h"
 
 #include "md-abi.h"
 
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
-#include "native/jni.h"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
-#include "threads/lock-common.h"
+#include "threads/lock.hpp"
 #include "threads/thread.hpp"
 
 #include "toolbox/util.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
+#include "vm/globals.hpp"
+#include "vm/javaobjects.hpp"
+#include "vm/loader.hpp"
+#include "vm/method.hpp"
+#include "vm/options.h"
+#include "vm/os.hpp"
 #include "vm/string.hpp"
 #include "vm/vm.hpp"
 
 #include "vm/jit/asmpart.h"
-#include "vm/jit/jit.h"
+#include "vm/jit/jit.hpp"
 #include "vm/jit/methodheader.h"
-#include "vm/jit/patcher-common.h"
-#include "vm/jit/show.h"
+#include "vm/jit/patcher-common.hpp"
+#include "vm/jit/show.hpp"
 #include "vm/jit/stacktrace.hpp"
 #include "vm/jit/trace.hpp"
 
-#include "vmcore/class.h"
-#include "vmcore/globals.hpp"
-#include "vmcore/javaobjects.hpp"
-#include "vmcore/loader.h"
-#include "vmcore/method.h"
-#include "vmcore/options.h"
-#include "vmcore/os.hpp"
-
 #if defined(ENABLE_VMLOG)
 #include <vmlog_cacao.h>
 #endif
@@ -243,7 +240,7 @@ static void exceptions_abort(utf *classname, utf *message)
 
        log_finish();
 
-       vm_abort("Aborting...");
+       os::abort("Aborting...");
 }
 
 
@@ -268,7 +265,7 @@ static java_handle_t *exceptions_new_class_utf(classinfo *c, utf *message)
        java_handle_t *s;
        java_handle_t *o;
 
-       if (vm->is_initializing()) {
+       if (VM::get_current()->is_initializing()) {
                /* This can happen when global class variables are used which
                   are not initialized yet. */
 
@@ -306,7 +303,7 @@ static java_handle_t *exceptions_new_utf(utf *classname)
        classinfo     *c;
        java_handle_t *o;
 
-       if (vm->is_initializing())
+       if (VM::get_current()->is_initializing())
                exceptions_abort(classname, NULL);
 
        c = load_class_bootstrap(classname);
@@ -344,7 +341,7 @@ static java_handle_t *exceptions_new_utf_javastring(utf *classname,
        java_handle_t *o;
        classinfo     *c;
    
-       if (vm->is_initializing())
+       if (VM::get_current()->is_initializing())
                exceptions_abort(classname, NULL);
 
        c = load_class_bootstrap(classname);
@@ -381,7 +378,7 @@ static java_handle_t *exceptions_new_utf_utf(utf *classname, utf *message)
        classinfo     *c;
        java_handle_t *o;
 
-       if (vm->is_initializing())
+       if (VM::get_current()->is_initializing())
                exceptions_abort(classname, message);
 
        c = load_class_bootstrap(classname);
@@ -456,7 +453,7 @@ static void exceptions_throw_utf_throwable(utf *classname,
        classinfo           *c;
        methodinfo          *m;
 
-       if (vm->is_initializing())
+       if (VM::get_current()->is_initializing())
                exceptions_abort(classname, NULL);
 
        java_lang_Throwable jlt(cause);
@@ -508,7 +505,7 @@ static void exceptions_throw_utf_exception(utf *classname,
        java_handle_t *o;
        methodinfo    *m;
 
-       if (vm->is_initializing())
+       if (VM::get_current()->is_initializing())
                exceptions_abort(classname, NULL);
 
        c = load_class_bootstrap(classname);
@@ -553,7 +550,7 @@ static void exceptions_throw_utf_exception(utf *classname,
 
 static void exceptions_throw_utf_cause(utf *classname, java_handle_t *cause)
 {
-       if (vm->is_initializing())
+       if (VM::get_current()->is_initializing())
                exceptions_abort(classname, NULL);
 
        java_lang_Throwable jltcause(cause);
@@ -2013,7 +2010,7 @@ void exceptions_print_stacktrace(void)
                                                                         false);
 
                if (m == NULL)
-                       vm_abort("exceptions_print_stacktrace: printStackTrace()V not found");
+                       os::abort("exceptions_print_stacktrace: printStackTrace()V not found");
 
                /* Print message. */
 
@@ -2024,7 +2021,7 @@ void exceptions_print_stacktrace(void)
                   need it afterwards. */
 
                t  = thread_get_current();
-               to = (java_lang_Thread *) thread_get_object(t);
+               to = (java_lang_Thread *) LLNI_WRAP(t->object);
 
                if (to != NULL) {
                        fprintf(stderr, "in thread \"");