Renamed member header to mutex and made it a pointer.
* src/vm/method.c (method_load, method_builtin_new): Allocate new mutex.
(method_free): Free methodinfos mutex.
* src/vm/jit/inline/inline.c: Adapted to above changes.
* src/vm/jit/jit.cpp: Likewise.
* src/vm/loader.cpp: Likewise.
#include "mm/memory.h"
#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
#include "threads/thread.hpp"
#include "toolbox/logging.h"
/* enter a monitor on the method */
- LOCK_MONITOR_ENTER(m);
+ Mutex_lock(m->mutex);
/* allocate jitdata structure and fill it */
/* leave the monitor */
- LOCK_MONITOR_EXIT(m);
+ Mutex_unlock(m->mutex);
return r;
}
#include "toolbox/logging.h"
-#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
#include "vm/class.h"
#include "vm/global.h"
/* enter a monitor on the method */
- LOCK_MONITOR_ENTER(m);
+ m->mutex->lock();
/* if method has been already compiled return immediately */
if (m->code != NULL) {
- LOCK_MONITOR_EXIT(m);
+ m->mutex->unlock();
assert(m->code->entrypoint);
return m->code->entrypoint;
/* leave the monitor */
- LOCK_MONITOR_EXIT(m);
+ m->mutex->unlock();
/* return pointer to the methods entry point */
clone = c->methods;
MSET(clone, 0, methodinfo, 1);
-#if defined(ENABLE_THREADS)
- lock_init_object_lock(&clone->header);
-#endif
-
/* ATTENTION: if you delete the ACC_NATIVE below, set
clone->maxlocals=1 (interpreter related) */
+ clone->mutex = new Mutex();
clone->flags = ACC_PUBLIC | ACC_NATIVE;
clone->name = utf_clone;
clone->descriptor = utf_void__java_lang_Object;
#include "native/llni.h"
-#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
#include "vm/array.h"
#include "vm/jit/builtin.hpp"
c = cb->clazz;
- LOCK_INIT_OBJECT_LOCK(&(m->header));
+ m->mutex = Mutex_new();
#if defined(ENABLE_STATISTICS)
if (opt_stat)
void method_free(methodinfo *m)
{
+ if (m->mutex)
+ Mutex_delete(m->mutex);
+
if (m->jcode)
MFREE(m->jcode, u1, m->jcodelength);
/* initialize methodinfo structure */
MZERO(m, methodinfo, 1);
- LOCK_INIT_OBJECT_LOCK(&(m->header));
-
+
+ m->mutex = Mutex_new();
m->flags = ACC_METHOD_BUILTIN;
m->parseddesc = bte->md;
m->name = bte->name;
#include "config.h"
#include "vm/types.h"
+#include "threads/mutex.hpp"
+
#include "vm/jit/builtin.hpp"
#include "vm/descriptor.h"
#include "vm/global.h"
/* methodinfo *****************************************************************/
struct methodinfo { /* method structure */
- java_object_t header; /* we need this in jit's monitorenter */
+ Mutex *mutex; /* we need this in jit's locking */
s4 flags; /* ACC flags */
utf *name; /* name of method */
utf *descriptor; /* JavaVM descriptor string of method */