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
25 $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
36 #include "native/jni.h"
37 #include "native/llni.h"
39 #include "native/include/java_lang_Object.h"
40 #include "native/include/java_lang_String.h" /* required by j.l.CL */
42 #if defined(ENABLE_JAVASE)
43 # if defined(WITH_CLASSPATH_SUN)
44 # include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
47 # include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
48 # include "native/include/java_lang_Cloneable.h"
51 #include "native/include/java_lang_Class.h"
53 #include "threads/lock-common.h"
55 #include "vm/builtin.h"
56 #include "vm/exceptions.h"
58 #include "vmcore/options.h"
60 #if defined(ENABLE_JVMTI)
61 #include "native/jvmti/cacaodbg.h"
66 * Class: java/lang/Object
68 * Signature: (Ljava/lang/Object;)Ljava/lang/Class;
70 java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
75 exceptions_throw_nullpointerexception();
79 LLNI_class_get(obj, c);
81 return (java_lang_Class *) c;
86 * Class: java/lang/Object
90 void _Jv_java_lang_Object_notify(java_lang_Object *this)
92 #if defined(ENABLE_THREADS)
93 lock_notify_object(&LLNI_field_direct(this, header));
99 * Class: java/lang/Object
103 void _Jv_java_lang_Object_notifyAll(java_lang_Object *this)
105 #if defined(ENABLE_THREADS)
106 lock_notify_all_object(&LLNI_field_direct(this, header));
112 * Class: java/lang/Object
114 * Signature: (Ljava/lang/Object;JI)V
116 void _Jv_java_lang_Object_wait(java_lang_Object *o, s8 ms, s4 ns)
118 #if defined(ENABLE_JVMTI)
120 if (jvmti) jvmti_MonitorWaiting(true, o, ms);
123 #if defined(ENABLE_THREADS)
124 lock_wait_for_object(&LLNI_field_direct(o, header), ms, ns);
127 #if defined(ENABLE_JVMTI)
129 /* XXX: How do you know if wait timed out ?*/
130 if (jvmti) jvmti_MonitorWaiting(false, o, 0);
135 #if defined(ENABLE_JAVASE)
138 * Class: java/lang/Object
140 * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
142 java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
147 o = (java_handle_t *) this;
149 co = builtin_clone(NULL, o);
151 return (java_lang_Object *) co;
154 #endif /* ENABLE_JAVASE */
158 * These are local overrides for various environment variables in Emacs.
159 * Please do not remove this and leave it at the end of the file, where
160 * Emacs will automagically detect them.
161 * ---------------------------------------------------------------------
164 * indent-tabs-mode: t