#include "native/include/java_lang_VMThread.h"
#if defined(ENABLE_THREADS)
+# include "threads/native/lock.h"
# include "threads/native/threads.h"
#endif
/* global variables ***********************************************************/
-static threadobject *recompile_threadobject;
+static java_lang_VMThread *recompile_vmthread;
static java_objectheader *lock_recompile_thread;
static list *list_recompile_methods;
while (true) {
/* get the lock on the recompile lock object, so we can call wait */
- builtin_monitorenter(lock_recompile_thread);
+ lock_monitor_enter(lock_recompile_thread);
/* wait forever (0, 0) on that object till we are signaled */
/* leave the lock */
- builtin_monitorexit(lock_recompile_thread);
+ lock_monitor_exit(lock_recompile_thread);
/* get the next method and recompile it */
while ((lme = list_first(list_recompile_methods)) != NULL) {
/* recompile this method */
- (void) jit_recompile(lme->m);
+ if (jit_recompile(lme->m) != NULL) {
+ /* replace in vftbl's */
- /* replace in vftbl's */
-
- recompile_replace_vftbl(lme->m);
+ recompile_replace_vftbl(lme->m);
+ }
+ else {
+ throw_exception();
+ }
/* remove the compiled method */
/* create the profile object */
- recompile_threadobject = NEW(threadobject);
+ recompile_vmthread =
+ (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
- if (recompile_threadobject == NULL)
+ if (recompile_vmthread == NULL)
return false;
t = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
- t->vmThread = (java_lang_VMThread *) recompile_threadobject;
+ t->vmThread = recompile_vmthread;
t->name = javastring_new_from_ascii("Recompiler");
t->daemon = true;
t->priority = 5;
- recompile_threadobject->o.thread = t;
+ recompile_vmthread->thread = t;
/* actually start the recompilation thread */
/* get the lock on the recompile lock object, so we can call notify */
- builtin_monitorenter(lock_recompile_thread);
+ lock_monitor_enter(lock_recompile_thread);
/* signal the recompiler thread */
/* leave the lock */
- builtin_monitorexit(lock_recompile_thread);
+ lock_monitor_exit(lock_recompile_thread);
}