/* 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
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 $
*/
#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 **************************************************************
{
/* 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 */
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 */
else {
/* XXX what is the right-thing(tm) to do here? */
- exceptions_print_exception(*exceptionptr);
+ exceptions_print_current_exception();
}
/* remove the compiled method */
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;
/* 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);
}