X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Foptimizing%2Frecompile.c;h=bca3ef36cf733474b14c786702962ae98763bda2;hb=bfb7d15b502b8170ec8a9b348c546418c0e44ace;hp=5ada79b8b9cf128cc2fe74458ed030fd96fc5da8;hpb=6925ab26d61a2ab00c278b49fb3100a31ef75e42;p=cacao.git diff --git a/src/vm/jit/optimizing/recompile.c b/src/vm/jit/optimizing/recompile.c index 5ada79b8b..bca3ef36c 100644 --- a/src/vm/jit/optimizing/recompile.c +++ b/src/vm/jit/optimizing/recompile.c @@ -1,6 +1,6 @@ /* src/vm/jit/optimizing/recompile.c - recompilation system - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, + 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, J. Wenninger, Institut f. Computersprachen - TU Wien @@ -22,12 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Christian Thalinger - - Changes: - $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $ */ @@ -41,28 +35,28 @@ #include "vm/types.h" #include "mm/memory.h" -#include "native/jni.h" -#include "native/include/java_lang_Thread.h" -#include "native/include/java_lang_VMThread.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -# include "threads/native/threads.h" -#endif +#include "threads/lock-common.h" +#include "threads/threads-common.h" #include "toolbox/list.h" + #include "vm/builtin.h" -#include "vm/classcache.h" #include "vm/exceptions.h" #include "vm/stringlocal.h" + +#include "vm/jit/code.h" +#include "vm/jit/jit.h" + #include "vm/jit/optimizing/recompile.h" +#include "vmcore/classcache.h" + /* global variables ***********************************************************/ -static java_lang_VMThread *recompile_vmthread; -static java_objectheader *lock_recompile_thread; -static list *list_recompile_methods; +static java_objectheader *lock_thread_recompile; +static list_t *list_recompile_methods; /* recompile_init ************************************************************** @@ -75,9 +69,9 @@ bool recompile_init(void) { /* initialize the recompile lock object */ - lock_recompile_thread = NEW(java_objectheader); + lock_thread_recompile = NEW(java_objectheader); - lock_init_object_lock(lock_recompile_thread); + lock_init_object_lock(lock_thread_recompile); /* create method list */ @@ -172,15 +166,15 @@ static void recompile_thread(void) while (true) { /* get the lock on the recompile lock object, so we can call wait */ - lock_monitor_enter(lock_recompile_thread); + lock_monitor_enter(lock_thread_recompile); /* wait forever (0, 0) on that object till we are signaled */ - lock_wait_for_object(lock_recompile_thread, 0, 0); + lock_wait_for_object(lock_thread_recompile, 0, 0); /* leave the lock */ - lock_monitor_exit(lock_recompile_thread); + lock_monitor_exit(lock_thread_recompile); /* get the next method and recompile it */ @@ -195,7 +189,7 @@ static void recompile_thread(void) else { /* XXX what is the right-thing(tm) to do here? */ - exceptions_print_exception(*exceptionptr); + exceptions_print_current_exception(); } /* remove the compiled method */ @@ -218,29 +212,13 @@ static void recompile_thread(void) bool recompile_start_thread(void) { - java_lang_Thread *t; - - /* create the profile object */ + utf *name; - recompile_vmthread = - (java_lang_VMThread *) builtin_new(class_java_lang_VMThread); + name = utf_new_char("Recompiler"); - if (recompile_vmthread == NULL) + if (!threads_thread_start_internal(name, recompile_thread)) return false; - t = (java_lang_Thread *) builtin_new(class_java_lang_Thread); - - t->vmThread = recompile_vmthread; - t->name = javastring_new_from_ascii("Recompiler"); - t->daemon = true; - t->priority = 5; - - recompile_vmthread->thread = t; - - /* actually start the recompilation thread */ - - threads_start_thread(t, recompile_thread); - /* everything's ok */ return true; @@ -269,15 +247,15 @@ void recompile_queue_method(methodinfo *m) /* get the lock on the recompile lock object, so we can call notify */ - lock_monitor_enter(lock_recompile_thread); + lock_monitor_enter(lock_thread_recompile); /* signal the recompiler thread */ - lock_notify_object(lock_recompile_thread); + lock_notify_object(lock_thread_recompile); /* leave the lock */ - lock_monitor_exit(lock_recompile_thread); + lock_monitor_exit(lock_thread_recompile); }