Andreas Krall
Christian Thalinger
- $Id: initialize.c 4921 2006-05-15 14:24:36Z twisti $
+ $Id: initialize.c 5123 2006-07-12 21:45:34Z twisti $
*/
#include "vm/types.h"
+#if defined(ENABLE_THREADS)
+# include "threads/native/lock.h"
+#else
+# include "threads/none/lock.h"
+#endif
+
#include "vm/global.h"
#include "vm/initialize.h"
#include "vm/builtin.h"
if (!makeinitializations)
return true;
-#if defined(ENABLE_THREADS)
- /* enter a monitor on the class */
-
- builtin_monitorenter((java_objectheader *) c);
-#endif
+ LOCK_MONITOR_ENTER(c);
/* maybe the class is already initalized or the current thread, which can
pass the monitor, is currently initalizing this class */
if (CLASS_IS_OR_ALMOST_INITIALIZED(c)) {
-#if defined(ENABLE_THREADS)
- builtin_monitorexit((java_objectheader *) c);
-#endif
+ LOCK_MONITOR_EXIT(c);
return true;
}
if (c->state & CLASS_ERROR) {
*exceptionptr = new_noclassdeffounderror(c->name);
-#if defined(ENABLE_THREADS)
- builtin_monitorexit((java_objectheader *) c);
-#endif
+ LOCK_MONITOR_EXIT(c);
/* ...but return true, this is ok (mauve test) */
c->state &= ~CLASS_INITIALIZING;
-#if defined(ENABLE_THREADS)
- /* leave the monitor */
-
- builtin_monitorexit((java_objectheader *) c);
-#endif
+ LOCK_MONITOR_EXIT(c);
return r;
}