* src/native/llni.h: Added LLNI (low level native interface).
[cacao.git] / src / native / vm / java_lang_Object.c
index 83f5f7570552969bb057467804e64f31284d9fe6..e96faf429053feb28535335abbf7381731bc904c 100644 (file)
 #include "vm/types.h"
 
 #include "native/jni.h"
+#include "native/llni.h"
 
-#if defined(ENABLE_JAVAME_CLDC1_1)
-# include "native/include/java_lang_String.h"/* required by java_lang_Class.h */
-#endif
-
-#include "native/include/java_lang_Class.h"
+#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_String.h"            /* required by j.l.CL */
 
 #if defined(ENABLE_JAVASE)
+# if defined(WITH_CLASSPATH_SUN)
+#  include "native/include/java_nio_ByteBuffer.h"       /* required by j.l.CL */
+# endif
+
+# include "native/include/java_lang_ClassLoader.h"       /* required by j.l.C */
 # include "native/include/java_lang_Cloneable.h"
 #endif
 
-#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_Class.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#endif
+#include "threads/lock-common.h"
 
 #include "vm/builtin.h"
+#include "vm/exceptions.h"
 
 #include "vmcore/options.h"
 
  */
 java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
 {
-       classinfo *c;
+       java_objectheader *o;
+       classinfo         *c;
+
+       o = (java_objectheader *) obj;
 
-       if (obj == NULL)
+       if (o == NULL) {
+               exceptions_throw_nullpointerexception();
                return NULL;
+       }
 
-       c = ((java_objectheader *) obj)->vftbl->class;
+       c = o->vftbl->class;
 
        return (java_lang_Class *) c;
 }
@@ -86,7 +93,7 @@ java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
 void _Jv_java_lang_Object_notify(java_lang_Object *this)
 {
 #if defined(ENABLE_THREADS)
-       lock_notify_object(&this->header);
+       lock_notify_object(&LLNI_field_direct(this, header));
 #endif
 }
 
@@ -99,7 +106,7 @@ void _Jv_java_lang_Object_notify(java_lang_Object *this)
 void _Jv_java_lang_Object_notifyAll(java_lang_Object *this)
 {
 #if defined(ENABLE_THREADS)
-       lock_notify_all_object(&this->header);
+       lock_notify_all_object(&LLNI_field_direct(this, header));
 #endif
 }
 
@@ -117,7 +124,7 @@ void _Jv_java_lang_Object_wait(java_lang_Object *o, s8 ms, s4 ns)
 #endif
 
 #if defined(ENABLE_THREADS)
-       lock_wait_for_object(&o->header, ms, ns);
+       lock_wait_for_object(&LLNI_field_direct(o, header), ms, ns);
 #endif
 
 #if defined(ENABLE_JVMTI)