/* src/native/vm/java_lang_Object.c - java/lang/Object functions
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Roman Obermaiser
- Joseph Wenninger
- Christian Thalinger
-
- $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
-
*/
#include "vm/types.h"
#include "native/jni.h"
-#include "native/native.h"
-#include "native/include/java_lang_Class.h"
-#include "native/include/java_lang_Cloneable.h"
+#include "native/llni.h"
+
#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_String.h" /* required by j.l.CL */
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
+#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_Class.h"
+
+#include "threads/lock-common.h"
+
#include "vm/builtin.h"
-#include "vm/options.h"
+#include "vm/exceptions.h"
+
+#include "vmcore/options.h"
#if defined(ENABLE_JVMTI)
#include "native/jvmti/cacaodbg.h"
*/
java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
{
- classinfo *c;
+ classinfo *c;
- if (obj == NULL)
+ if (obj == NULL) {
+ exceptions_throw_nullpointerexception();
return NULL;
+ }
- c = ((java_objectheader *) obj)->vftbl->class;
-
- return (java_lang_Class *) c;
-}
-
-
-/*
- * Class: java/lang/Object
- * Method: clone
- * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
- */
-java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
-{
- java_objectheader *o;
- java_objectheader *co;
-
- o = (java_objectheader *) this;
-
- co = builtin_clone(NULL, o);
+ LLNI_class_get(obj, c);
- return (java_lang_Object *) co;
+ return LLNI_classinfo_wrap(c);
}
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
}
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
}
if (jvmti) jvmti_MonitorWaiting(true, o, ms);
#endif
+ if (ms < 0) {
+/* exceptions_throw_illegalargumentexception("argument out of range"); */
+ exceptions_throw_illegalargumentexception();
+ return;
+ }
+
#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)
}
+#if defined(ENABLE_JAVASE)
+
+/*
+ * Class: java/lang/Object
+ * Method: clone
+ * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
+ */
+java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
+{
+ java_handle_t *o;
+ java_handle_t *co;
+
+ o = (java_handle_t *) this;
+
+ co = builtin_clone(NULL, o);
+
+ return (java_lang_Object *) co;
+}
+
+#endif /* ENABLE_JAVASE */
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where