#include <stdint.h>
#include <stdlib.h>
-#include "native/jni.h"
+#include "native/jni.hpp"
#include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
#if defined(ENABLE_JNI_HEADERS)
# include "native/include/java_lang_Object.h"
#endif
-#include "threads/lock-common.h"
+#include "threads/lock.hpp"
#include "vm/exceptions.hpp"
+#include "vm/javaobjects.hpp"
// Native functions are exported as C functions.
*/
JNIEXPORT jclass JNICALL Java_java_lang_Object_getClass(JNIEnv *env, jobject obj)
{
- classinfo *c;
-
if (obj == NULL) {
exceptions_throw_nullpointerexception();
return NULL;
}
- LLNI_class_get(obj, c);
+ java_lang_Object o(obj);
- return (jclass) LLNI_classinfo_wrap(c);
+ return (jclass) LLNI_classinfo_wrap(o.get_Class());
}
*/
JNIEXPORT jint JNICALL Java_java_lang_Object_hashCode(JNIEnv *env, jobject _this)
{
-#if defined(ENABLE_GC_CACAO)
- assert(0);
-#else
- return (int32_t) ((uintptr_t) _this);
-#endif
+ java_lang_Object o(_this);
+
+ return o.get_hashcode();
}
*/
JNIEXPORT void JNICALL Java_java_lang_Object_wait(JNIEnv *env, jobject _this, jlong timeout)
{
-#if defined(ENABLE_JVMTI)
- /* Monitor Wait */
- if (jvmti) jvmti_MonitorWaiting(true, _this, timeout);
-#endif
-
#if defined(ENABLE_THREADS)
lock_wait_for_object((java_handle_t *) _this, timeout, 0);
#endif
-
-#if defined(ENABLE_JVMTI)
- /* Monitor Waited */
- /* XXX: How do you know if wait timed out ?*/
- if (jvmti) jvmti_MonitorWaiting(false, _this, 0);
-#endif
}
} // extern "C"
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Object_init(void)
{
- utf *u;
+ utf* u = utf_new_char("java/lang/Object");
- u = utf_new_char("java/lang/Object");
-
- native_method_register(u, methods, NATIVE_METHODS_COUNT);
-}
+ NativeMethods& nm = VM::get_current()->get_nativemethods();
+ nm.register_methods(u, methods, NATIVE_METHODS_COUNT);
}