#include "native/jni.hpp"
#include "native/llni.h"
-#include "native/localref.h"
-#include "native/native.h"
+#include "native/localref.hpp"
+#include "native/native.hpp"
-#include "native/vm/nativevm.h"
+#include "native/vm/nativevm.hpp"
-#include "threads/lock-common.h"
-#include "threads/threadlist.h"
+#include "threads/lock.hpp"
#include "threads/thread.hpp"
#include "toolbox/logging.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#if defined(ENABLE_ASSERTION)
-#include "vm/assertion.h"
+#include "vm/assertion.hpp"
#endif
#include "vm/jit/builtin.hpp"
#include "vm/finalizer.h"
#include "vm/global.h"
#include "vm/globals.hpp"
-#include "vm/initialize.h"
+#include "vm/initialize.hpp"
#include "vm/options.h"
#include "vm/os.hpp"
#include "vm/primitive.hpp"
#include "vm/signallocal.h"
#include "vm/statistics.h"
#include "vm/string.hpp"
-#include "vm/suck.h"
+#include "vm/suck.hpp"
#include "vm/vm.hpp"
-#include "vm/jit/argument.h"
+#include "vm/jit/argument.hpp"
#include "vm/jit/asmpart.h"
-#include "vm/jit/code.h"
+#include "vm/jit/code.hpp"
#if defined(ENABLE_DISASSEMBLER)
# include "vm/jit/disass.h"
#endif
-#include "vm/jit/jit.hpp"
+#include "vm/jit/jitcache.hpp"
#include "vm/jit/methodtree.h"
#if defined(ENABLE_PROFILING)
# include "vm/jit/optimizing/profile.h"
#endif
-#include "vm/jit/optimizing/recompile.h"
+#include "vm/jit/optimizing/recompiler.hpp"
#if defined(ENABLE_PYTHON)
# include "vm/jit/python.h"
/* CACAO options */
OPT_VERBOSE1,
- OPT_NOIEEE,
#if defined(ENABLE_STATISTICS)
OPT_TIME,
#if defined(ENABLE_VERIFIER) && defined(TYPECHECK_VERBOSE)
{ "verbosetc", false, OPT_VERBOSETC },
#endif
-#if defined(__ALPHA__)
- { "noieee", false, OPT_NOIEEE },
-#endif
#if defined(ENABLE_STATISTICS)
{ "time", false, OPT_TIME },
{ "stat", false, OPT_STAT },
#ifdef TYPECHECK_VERBOSE
puts(" -verbosetc write debug messages while typechecking");
#endif
-#if defined(__ALPHA__)
- puts(" -noieee don't use ieee compliant arithmetic");
-#endif
#if defined(ENABLE_VERIFIER)
puts(" -noverify don't verify classfiles");
#endif
/* Install the exit handler. */
if (atexit(vm_exit_handler))
- VM::get_current()->abort("atexit failed: %s\n", strerror(errno));
+ os::abort("atexit failed: %s\n", strerror(errno));
/* Set some options. */
opt_version = false;
opt_exit = false;
- opt_noieee = false;
-
opt_heapmaxsize = HEAP_MAXSIZE;
opt_heapstartsize = HEAP_STARTSIZE;
opt_stacksize = STACK_SIZE;
/* We need to check if the actual size of a java.lang.Class object
is smaller or equal than the assumption made in
- src/vm/class.h. */
+ src/vm/class.hpp. */
#warning FIXME We need to check the size of java.lang.Class!!!
// if (sizeof(java_lang_Class) > sizeof(dummy_java_lang_Class))
opt_version = true;
break;
- case OPT_NOIEEE:
- opt_noieee = true;
- break;
-
#if defined(ENABLE_VERIFIER)
case OPT_NOVERIFY:
opt_verify = false;
gc_init(opt_heapmaxsize, opt_heapstartsize);
#if defined(ENABLE_THREADS)
- /* BEFORE: threads_preinit */
-
- threadlist_init();
-
/* AFTER: gc_init */
threads_preinit();
/* install architecture dependent signal handlers */
if (!signal_init())
- VM::get_current()->abort("vm_create: signal_init failed");
+ os::abort("vm_create: signal_init failed");
#if defined(ENABLE_INTRP)
/* Allocate main thread stack on the Java heap. */
/* AFTER: threads_preinit */
if (!string_init())
- VM::get_current()->abort("vm_create: string_init failed");
+ os::abort("vm_create: string_init failed");
/* AFTER: threads_preinit */
/* AFTER: thread_preinit */
if (!suck_init())
- VM::get_current()->abort("vm_create: suck_init failed");
+ os::abort("vm_create: suck_init failed");
suck_add_from_property("java.endorsed.dirs");
(must be done _after_ threads_preinit) */
if (!classcache_init())
- VM::get_current()->abort("vm_create: classcache_init failed");
+ os::abort("vm_create: classcache_init failed");
/* Initialize the code memory management. */
/* AFTER: threads_preinit */
threads_preinit) */
if (!finalizer_init())
- VM::get_current()->abort("vm_create: finalizer_init failed");
+ os::abort("vm_create: finalizer_init failed");
/* Initialize the JIT compiler. */
#endif
if (!builtin_init())
- VM::get_current()->abort("vm_create: builtin_init failed");
-
- /* Initialize the native subsystem. */
- /* BEFORE: threads_init */
-
- if (!native_init())
- VM::get_current()->abort("vm_create: native_init failed");
+ os::abort("vm_create: builtin_init failed");
/* Register the native methods implemented in the VM. */
/* BEFORE: threads_init */
(e.g. NewGlobalRef). */
if (!jni_init())
- VM::get_current()->abort("vm_create: jni_init failed");
+ os::abort("vm_create: jni_init failed");
#endif
#if defined(ENABLE_JNI) || defined(ENABLE_HANDLES)
/* BEFORE: threads_init */
if (!localref_table_init())
- VM::get_current()->abort("vm_create: localref_table_init failed");
+ os::abort("vm_create: localref_table_init failed");
#endif
/* Iinitialize some important system classes. */
/* initialize profiling */
if (!profile_init())
- VM::get_current()->abort("vm_create: profile_init failed");
+ os::abort("vm_create: profile_init failed");
#endif
#if defined(ENABLE_THREADS)
- /* initialize recompilation */
-
- if (!recompile_init())
- VM::get_current()->abort("vm_create: recompile_init failed");
-
/* start the signal handler thread */
#if defined(__LINUX__)
if (threads_pthreads_implementation_nptl)
#endif
if (!signal_start_thread())
- VM::get_current()->abort("vm_create: signal_start_thread failed");
+ os::abort("vm_create: signal_start_thread failed");
/* finally, start the finalizer thread */
if (!finalizer_start_thread())
- VM::get_current()->abort("vm_create: finalizer_start_thread failed");
+ os::abort("vm_create: finalizer_start_thread failed");
# if !defined(NDEBUG)
/* start the memory profiling thread */
if (opt_ProfileMemoryUsage || opt_ProfileGCMemoryUsage)
if (!memory_start_thread())
- VM::get_current()->abort("vm_create: memory_start_thread failed");
+ os::abort("vm_create: memory_start_thread failed");
# endif
- /* start the recompilation thread (must be done before the
- profiling thread) */
-
- if (!recompile_start_thread())
- VM::get_current()->abort("vm_create: recompile_start_thread failed");
+ // Start the recompilation thread (must be done before the
+ // profiling thread).
+ // FIXME Only works for one recompiler.
+ _recompiler.start();
# if defined(ENABLE_PROFILING)
/* start the profile sampling thread */
/* if (opt_prof) */
/* if (!profile_start_thread()) */
-/* VM::get_current()->abort("vm_create: profile_start_thread failed"); */
+/* os::abort("vm_create: profile_start_thread failed"); */
# endif
#endif
the application's main method exits. */
if (!thread_detach_current_thread())
- VM::get_current()->abort("vm_run: Could not detach main thread.");
+ os::abort("vm_run: Could not detach main thread.");
#endif
/* Destroy the JavaVM. */
}
#endif
+#if defined (ENABLE_JITCACHE)
+ jitcache_quit();
+#endif
+
exit(status);
}
}
-/**
- * Prints an error message and aborts the VM.
- *
- * @param text Error message to print.
- */
-void VM::abort(const char* text, ...)
-{
- va_list ap;
-
- // Print the log message.
- log_start();
-
- va_start(ap, text);
- log_vprint(text, ap);
- va_end(ap);
-
- log_finish();
-
- // Print a backtrace.
- os::print_backtrace();
-
- // Now abort the VM.
- os::abort();
-}
-
-
-/**
- * Prints an error message, appends ":" plus the strerror-message of
- * errnum and aborts the VM.
- *
- * @param errnum Error number.
- * @param text Error message to print.
- */
-void VM::abort_errnum(int errnum, const char* text, ...)
-{
- va_list ap;
-
- // Print the log message.
- log_start();
-
- va_start(ap, text);
- log_vprint(text, ap);
- va_end(ap);
-
- // Print the strerror-message of errnum.
- log_print(": %s", os::strerror(errnum));
-
- log_finish();
-
- // Print a backtrace.
- os::print_backtrace();
-
- // Now abort the VM.
- os::abort();
-}
-
-
-/**
- * Equal to VM::abort_errnum, but uses errno to get the error number.
- *
- * @param text Error message to print.
- */
-void VM::abort_errno(const char* text, ...)
-{
- va_list ap;
-
- va_start(ap, text);
- abort_errnum(errno, text, ap);
- va_end(ap);
-}
-
-
/* vm_abort_disassemble ********************************************************
Prints an error message, disassemble the given code range (if
pc = disassinstr((u1*) pc);
#endif
- VM::get_current()->abort("Aborting...");
+ os::abort("Aborting...");
}
}
if (m == NULL)
- VM::get_current()->abort("vm_compile_method: java.lang.NoSuchMethodException: %s.%s",
+ os::abort("vm_compile_method: java.lang.NoSuchMethodException: %s.%s",
opt_method, opt_signature ? opt_signature : "");
jit_compile(m);
break;
default:
- VM::get_current()->abort("vm_call_method_objectarray: invalid return type %d", m->parseddesc->returntype.primitivetype);
+ os::abort("vm_call_method_objectarray: invalid return type %d", m->parseddesc->returntype.primitivetype);
}
/* enter the nativeworld again */
va_list ap;
va_start(ap, text);
- VM::get_current()->abort(text, ap);
+ os::abort(text, ap);
va_end(ap);
}
va_list ap;
va_start(ap, text);
- VM::get_current()->abort_errnum(errnum, text, ap);
+ os::abort_errnum(errnum, text, ap);
va_end(ap);
}
va_list ap;
va_start(ap, text);
- VM::get_current()->abort_errno(text, ap);
+ os::abort_errno(text, ap);
va_end(ap);
}