#include <assert.h>
-#include "vmcore/os.hpp"
+#include "vm/os.hpp"
#include "vm/types.h"
#include "mm/memory.h"
-#include "native/jni.h"
#include "native/llni.h"
-#include "threads/lock-common.h"
+#include "threads/lock.hpp"
-#include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/array.hpp"
+#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
+#include "vm/globals.hpp"
+#include "vm/javaobjects.hpp"
+#include "vm/options.h"
#include "vm/primitive.hpp"
+#include "vm/statistics.h"
#include "vm/string.hpp"
-#include "vm/vm.hpp"
-
-#include "vmcore/globals.hpp"
-#include "vmcore/javaobjects.hpp"
-#include "vmcore/options.h"
-#include "vmcore/statistics.h"
-#include "vmcore/utf8.h"
+#include "vm/utf8.h"
/* global variables ***********************************************************/
#define HASHTABLE_STRING_SIZE 2048 /* initial size of javastring-hash */
-hashtable hashtable_string; /* hashtable for javastrings */
-
-#if defined(ENABLE_THREADS)
-static java_object_t *lock_hashtable_string;
-#endif
+static hashtable hashtable_string; /* hashtable for javastrings */
+static Mutex* mutex;
/* string_init *****************************************************************
hashtable_create(&hashtable_string, HASHTABLE_STRING_SIZE);
-#if defined(ENABLE_THREADS)
- /* create string hashtable lock object */
-
- lock_hashtable_string = NEW(java_object_t);
-
- LOCK_INIT_OBJECT_LOCK(lock_hashtable_string);
-#endif
+ mutex = new Mutex();
/* everything's ok */
if (js.is_null() || (js.get_value() == NULL)) {
/* error in hashtable found */
-
- vm_abort("stringtable_update: invalid literalstring in hashtable");
+ os::abort("stringtable_update: invalid literalstring in hashtable");
}
a = LLNI_UNWRAP(js.get_value());
u4 slot;
u2 i;
- LOCK_MONITOR_ENTER(lock_hashtable_string);
+ mutex->lock();
/* find location in hashtable */
if (!copymode)
mem_free(a, sizeof(java_chararray_t) + sizeof(u2) * (length - 1) + 10);
- LOCK_MONITOR_EXIT(lock_hashtable_string);
+ mutex->unlock();
return (java_object_t*) LLNI_UNWRAP(js.get_handle());
}
#endif
#if defined(ENABLE_THREADS)
- lock_init_object_lock(o);
+ o->lockword.init();
#endif
o->vftbl = class_java_lang_String->vftbl;
hashtable_string = newhash;
}
- LOCK_MONITOR_EXIT(lock_hashtable_string);
+ mutex->unlock();
return (java_object_t*) LLNI_UNWRAP(jls.get_handle());
}