#include "mm/memory.h"
-#include "native/jni.h"
+#include "native/jni.hpp"
#include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
#include "native/vm/reflection.hpp"
#include "native/vm/openjdk/hpi.h"
+#include "native/vm/openjdk/management.hpp"
-#include "threads/lock-common.h"
+#include "threads/lock.hpp"
#include "threads/thread.hpp"
#include "toolbox/logging.h"
-#include "toolbox/list.h"
+#include "toolbox/list.hpp"
-#include "vm/array.h"
+#include "vm/array.hpp"
#if defined(ENABLE_ASSERTION)
-#include "vm/assertion.h"
+#include "vm/assertion.hpp"
#endif
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
#include "vm/classcache.h"
#include "vm/exceptions.hpp"
#include "vm/global.h"
#include "vm/os.hpp"
#include "vm/package.hpp"
#include "vm/primitive.hpp"
-#include "vm/properties.h"
+#include "vm/properties.hpp"
#include "vm/resolve.h"
#include "vm/signallocal.h"
#include "vm/string.hpp"
-D option, as requested. */
jio_snprintf(buf, sizeof(buf), PRINTF_FORMAT_INT64_T, opt_MaxDirectMemorySize);
- properties_add("sun.nio.MaxDirectMemorySize", buf);
+ VM::get_current()->get_properties().put("sun.nio.MaxDirectMemorySize", buf);
- /* Add all properties. */
-
- properties_system_add_all(h);
+ // Fill the java.util.Properties object.
+ VM::get_current()->get_properties().fill(h);
return properties;
}
linenumber = -2;
}
else {
- /* FIXME The linenumbertable_linenumber_for_pc could change
- the methodinfo pointer when hitting an inlined method. */
-
- linenumber = linenumbertable_linenumber_for_pc(&m, code, ste->pc);
+ // FIXME linenumbertable->find could change the methodinfo
+ // pointer when hitting an inlined method.
+ linenumber = code->linenumbertable->find(&m, ste->pc);
linenumber = (linenumber == 0) ? -1 : linenumber;
}
{
TRACEJVMCALLS(("JVM_IHashCode(env=%p, jobject=%p)", env, handle));
- return (jint) ((ptrint) handle);
+ java_lang_Object o(handle);
+
+ return o.get_hashcode();
}
jboolean JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls)
{
#if defined(ENABLE_ASSERTION)
- assertion_name_t *item;
classinfo *c;
jboolean status;
utf *name;
}
if (list_assertion_names != NULL) {
- item = (assertion_name_t *)list_first(list_assertion_names);
- while (item != NULL) {
+ for (List<assertion_name_t*>::iterator it = list_assertion_names->begin();
+ it != list_assertion_names->end(); it++) {
+ assertion_name_t* item = *it;
+
name = utf_new_char(item->name);
if (name == c->packagename) {
status = (jboolean)item->enabled;
else if (name == c->name) {
status = (jboolean)item->enabled;
}
-
- item = (assertion_name_t *)list_next(list_assertion_names, item);
}
}
java_booleanarray_t *classEnabled;
java_booleanarray_t *packageEnabled;
#if defined(ENABLE_ASSERTION)
- assertion_name_t *item;
java_handle_t *js;
s4 i, j;
#endif
i = 0;
j = 0;
- item = (assertion_name_t *)list_first(list_assertion_names);
- while (item != NULL) {
+ for (List<assertion_name_t*>::iterator it = list_assertion_names->begin(); it != list_assertion_names->end(); it++) {
+ assertion_name_t* item = *it;
+
js = javastring_new_from_ascii(item->name);
if (js == NULL) {
return NULL;
packageEnabled->data[j] = (jboolean) item->enabled;
j += 1;
}
-
- item = (assertion_name_t *)list_next(list_assertion_names, item);
}
}
#endif
JNIEXPORT void* JNICALL JVM_RawMonitorCreate(void)
{
- java_object_t *o;
-
TRACEJVMCALLS(("JVM_RawMonitorCreate()"));
- o = NEW(java_object_t);
+ Mutex* m = new Mutex();
- lock_init_object_lock(o);
-
- return o;
+ return m;
}
/* JVM_RawMonitorDestroy */
-JNIEXPORT void JNICALL JVM_RawMonitorDestroy(void *mon)
+JNIEXPORT void JNICALL JVM_RawMonitorDestroy(void* mon)
{
TRACEJVMCALLS(("JVM_RawMonitorDestroy(mon=%p)", mon));
- FREE(mon, java_object_t);
+ delete ((Mutex*) mon);
}
/* JVM_RawMonitorEnter */
-JNIEXPORT jint JNICALL JVM_RawMonitorEnter(void *mon)
+JNIEXPORT jint JNICALL JVM_RawMonitorEnter(void* mon)
{
TRACEJVMCALLS(("JVM_RawMonitorEnter(mon=%p)", mon));
- (void) lock_monitor_enter((java_object_t *) mon);
+ ((Mutex*) mon)->lock();
return 0;
}
/* JVM_RawMonitorExit */
-JNIEXPORT void JNICALL JVM_RawMonitorExit(void *mon)
+JNIEXPORT void JNICALL JVM_RawMonitorExit(void* mon)
{
TRACEJVMCALLS(("JVM_RawMonitorExit(mon=%p)", mon));
- (void) lock_monitor_exit((java_object_t *) mon);
+ ((Mutex*) mon)->unlock();
}
{
TRACEJVMCALLS(("JVM_GetManagement(version=%d)", version));
- /* TODO We current don't support the management interface. */
-
- return NULL;
+ return Management::get_jmm_interface(version);
}
* c-basic-offset: 4
* tab-width: 4
* End:
+ * vim:noexpandtab:sw=4:ts=4:
*/