1 /* src/native/vm/java_lang_Object.c - java/lang/Object functions
3 Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
34 #include "native/jni.h"
35 #include "native/llni.h"
37 #include "native/include/java_lang_Object.h"
38 #include "native/include/java_lang_String.h" /* required by j.l.CL */
40 #if defined(ENABLE_JAVASE)
41 # if defined(WITH_CLASSPATH_SUN)
42 # include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
45 # include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
46 # include "native/include/java_lang_Cloneable.h"
49 #include "native/include/java_lang_Class.h"
51 #include "threads/lock-common.h"
53 #include "vm/builtin.h"
54 #include "vm/exceptions.h"
56 #include "vmcore/options.h"
58 #if defined(ENABLE_JVMTI)
59 #include "native/jvmti/cacaodbg.h"
64 * Class: java/lang/Object
66 * Signature: (Ljava/lang/Object;)Ljava/lang/Class;
68 java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
73 exceptions_throw_nullpointerexception();
77 LLNI_class_get(obj, c);
79 return LLNI_classinfo_wrap(c);
84 * Class: java/lang/Object
88 void _Jv_java_lang_Object_notify(java_lang_Object *this)
90 #if defined(ENABLE_THREADS)
91 lock_notify_object(&LLNI_field_direct(this, header));
97 * Class: java/lang/Object
101 void _Jv_java_lang_Object_notifyAll(java_lang_Object *this)
103 #if defined(ENABLE_THREADS)
104 lock_notify_all_object(&LLNI_field_direct(this, header));
110 * Class: java/lang/Object
112 * Signature: (Ljava/lang/Object;JI)V
114 void _Jv_java_lang_Object_wait(java_lang_Object *o, s8 ms, s4 ns)
116 #if defined(ENABLE_JVMTI)
118 if (jvmti) jvmti_MonitorWaiting(true, o, ms);
122 /* exceptions_throw_illegalargumentexception("argument out of range"); */
123 exceptions_throw_illegalargumentexception();
127 #if defined(ENABLE_THREADS)
128 lock_wait_for_object(&LLNI_field_direct(o, header), ms, ns);
131 #if defined(ENABLE_JVMTI)
133 /* XXX: How do you know if wait timed out ?*/
134 if (jvmti) jvmti_MonitorWaiting(false, o, 0);
139 #if defined(ENABLE_JAVASE)
142 * Class: java/lang/Object
144 * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
146 java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
151 o = (java_handle_t *) this;
153 co = builtin_clone(NULL, o);
155 return (java_lang_Object *) co;
158 #endif /* ENABLE_JAVASE */
162 * These are local overrides for various environment variables in Emacs.
163 * Please do not remove this and leave it at the end of the file, where
164 * Emacs will automagically detect them.
165 * ---------------------------------------------------------------------
168 * indent-tabs-mode: t