1 /* src/native/vm/java_lang_Object.c - java/lang/Object functions
3 Copyright (C) 1996-2005, 2006 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 Contact: cacao@cacaojvm.org
27 Authors: Roman Obermaiser
31 $Id: java_lang_VMObject.c 6213 2006-12-18 17:36:06Z twisti $
42 #include "native/jni.h"
43 #include "native/native.h"
44 #include "native/include/java_lang_Class.h"
45 #include "native/include/java_lang_Cloneable.h"
46 #include "native/include/java_lang_Object.h"
48 #if defined(ENABLE_THREADS)
49 # include "threads/native/lock.h"
52 #include "vm/builtin.h"
53 #include "vm/options.h"
55 #if defined(ENABLE_JVMTI)
56 #include "native/jvmti/cacaodbg.h"
61 * Class: java/lang/Object
63 * Signature: (Ljava/lang/Object;)Ljava/lang/Class;
65 java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
72 c = ((java_objectheader *) obj)->vftbl->class;
74 return (java_lang_Class *) c;
79 * Class: java/lang/Object
81 * Signature: (Ljava/lang/Cloneable;)Ljava/lang/Object;
83 java_lang_Object *_Jv_java_lang_Object_clone(java_lang_Cloneable *this)
86 java_objectheader *co;
88 o = (java_objectheader *) this;
90 co = builtin_clone(NULL, o);
92 return (java_lang_Object *) co;
97 * Class: java/lang/Object
101 void _Jv_java_lang_Object_notify(java_lang_Object *this)
103 #if defined(ENABLE_THREADS)
104 lock_notify_object(&this->header);
110 * Class: java/lang/Object
114 void _Jv_java_lang_Object_notifyAll(java_lang_Object *this)
116 #if defined(ENABLE_THREADS)
117 lock_notify_all_object(&this->header);
123 * Class: java/lang/Object
125 * Signature: (Ljava/lang/Object;JI)V
127 void _Jv_java_lang_Object_wait(java_lang_Object *o, s8 ms, s4 ns)
129 #if defined(ENABLE_JVMTI)
131 if (jvmti) jvmti_MonitorWaiting(true, o, ms);
134 #if defined(ENABLE_THREADS)
135 lock_wait_for_object(&o->header, ms, ns);
138 #if defined(ENABLE_JVMTI)
140 /* XXX: How do you know if wait timed out ?*/
141 if (jvmti) jvmti_MonitorWaiting(false, o, 0);
147 * These are local overrides for various environment variables in Emacs.
148 * Please do not remove this and leave it at the end of the file, where
149 * Emacs will automagically detect them.
150 * ---------------------------------------------------------------------
153 * indent-tabs-mode: t