#include <sys/stat.h>
#include <sys/types.h>
-#include "vm/types.h"
+// Include our JNI header before the JVM headers, because the JVM
+// headers include jni.h and we want to override the typedefs in
+// jni.h.
+#include "native/jni.hpp"
+
+// We include jvm_md.h before jvm.h as the latter includes the former.
+#include INCLUDE_JVM_MD_H
+#include INCLUDE_JVM_H
#include "mm/memory.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.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.hpp"
#endif
-typedef struct {
- /* Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx */
- unsigned int jvm_version; /* Consists of major, minor, micro (n.n.n) */
- /* and build number (xx) */
- unsigned int update_version : 8; /* Update release version (uu) */
- unsigned int special_update_version : 8; /* Special update release version (c) */
- unsigned int reserved1 : 16;
- unsigned int reserved2;
-
- /* The following bits represents JVM supports that JDK has dependency on.
- * JDK can use these bits to determine which JVM version
- * and support it has to maintain runtime compatibility.
- *
- * When a new bit is added in a minor or update release, make sure
- * the new bit is also added in the main/baseline.
- */
- unsigned int is_attachable : 1;
- unsigned int : 31;
- unsigned int : 32;
- unsigned int : 32;
-} jvm_version_info;
-
-
-/*
- * A structure used to a capture exception table entry in a Java method.
- */
-typedef struct {
- jint start_pc;
- jint end_pc;
- jint handler_pc;
- jint catchType;
-} JVM_ExceptionTableEntryType;
-
-
// Interface functions are exported as C functions.
extern "C" {
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);
}