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"
38 #include "native/include/java_lang_Object.h"
39 #include "native/include/java_lang_String.h" /* required by j.l.CL */
41 #if defined(ENABLE_JAVASE)
42 # if defined(WITH_CLASSPATH_SUN)
43 # include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
46 # include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
47 # include "native/include/java_lang_Cloneable.h"
50 #include "native/include/java_lang_Class.h"
52 #include "threads/lock-common.h"
54 #include "vm/builtin.h"
55 #include "vm/exceptions.h"
57 #include "vmcore/options.h"
59 #if defined(ENABLE_JVMTI)
60 #include "native/jvmti/cacaodbg.h"
65 * Class: java/lang/Object
67 * Signature: (Ljava/lang/Object;)Ljava/lang/Class;
69 java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
74 o = (java_objectheader *) obj;
77 exceptions_throw_nullpointerexception();
83 return (java_lang_Class *) c;
88 * Class: java/lang/Object
92 void _Jv_java_lang_Object_notify(java_lang_Object *this)
94 #if defined(ENABLE_THREADS)
95 lock_notify_object(&this->header);
101 * Class: java/lang/Object
105 void _Jv_java_lang_Object_notifyAll(java_lang_Object *this)
107 #if defined(ENABLE_THREADS)
108 lock_notify_all_object(&this->header);
114 * Class: java/lang/Object
116 * Signature: (Ljava/lang/Object;JI)V
118 void _Jv_java_lang_Object_wait(java_lang_Object *o, s8 ms, s4 ns)
120 #if defined(ENABLE_JVMTI)
122 if (jvmti) jvmti_MonitorWaiting(true, o, ms);
125 #if defined(ENABLE_THREADS)
126 lock_wait_for_object(&o->header, ms, ns);
129 #if defined(ENABLE_JVMTI)
131 /* XXX: How do you know if wait timed out ?*/
132 if (jvmti) jvmti_MonitorWaiting(false, o, 0);
137 #if defined(ENABLE_JAVASE)
140 * Class: java/lang/Object
142 * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
144 java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
146 java_objectheader *o;
147 java_objectheader *co;
149 o = (java_objectheader *) this;
151 co = builtin_clone(NULL, o);
153 return (java_lang_Object *) co;
156 #endif /* ENABLE_JAVASE */
160 * These are local overrides for various environment variables in Emacs.
161 * Please do not remove this and leave it at the end of the file, where
162 * Emacs will automagically detect them.
163 * ---------------------------------------------------------------------
166 * indent-tabs-mode: t