* src/native/vm/openjdk/management.cpp: New file.
[cacao.git] / src / native / vm / openjdk / jvm.cpp
index f90de53b86ff318bd2b82555705741d5e14e1033..b62ae3fe5f0b7b01b59242afb97cbfdcdc20eea1 100644 (file)
 
 #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.hpp"
 
-#include "vm/array.h"
+#include "vm/array.hpp"
 
 #if defined(ENABLE_ASSERTION)
-#include "vm/assertion.h"
+#include "vm/assertion.hpp"
 #endif
 
 #include "vm/jit/builtin.hpp"
@@ -502,10 +503,9 @@ jobject JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)
                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;
        }
 
@@ -2991,35 +2991,31 @@ jstring JVM_InternString(JNIEnv *env, jstring str)
 
 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(voidmon)
 {
        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(voidmon)
 {
        TRACEJVMCALLS(("JVM_RawMonitorEnter(mon=%p)", mon));
 
-       (void) lock_monitor_enter((java_object_t *) mon);
+       ((Mutex*) mon)->lock();
 
        return 0;
 }
@@ -3027,11 +3023,11 @@ JNIEXPORT jint JNICALL JVM_RawMonitorEnter(void *mon)
 
 /* JVM_RawMonitorExit */
 
-JNIEXPORT void JNICALL JVM_RawMonitorExit(void *mon)
+JNIEXPORT void JNICALL JVM_RawMonitorExit(voidmon)
 {
        TRACEJVMCALLS(("JVM_RawMonitorExit(mon=%p)", mon));
 
-       (void) lock_monitor_exit((java_object_t *) mon);
+       ((Mutex*) mon)->unlock();
 }
 
 
@@ -3264,9 +3260,7 @@ void *JVM_GetManagement(jint version)
 {
        TRACEJVMCALLS(("JVM_GetManagement(version=%d)", version));
 
-       /* TODO We current don't support the management interface. */
-
-       return NULL;
+       return Management::get_jmm_interface(version);
 }
 
 
@@ -3630,4 +3624,5 @@ jint JVM_FindSignal(const char *name)
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */