1 // Object.h - Header file for java.lang.Object.  -*- c++ -*-
2 
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005  Free Software Foundation
4 
5    This file is part of libgcj.
6 
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10 
11 #ifndef __JAVA_LANG_OBJECT_H__
12 #define __JAVA_LANG_OBJECT_H__
13 
14 #pragma interface
15 
16 #include <gcj/javaprims.h>
17 
18 extern "Java"
19 {
20 // This class is mainly here as a kludge to get G++ to allocate two
21 // extra entries in each vtable.
22 struct _JvObjectPrefix
23 {
24 protected:
25   // New ABI Compatibility Dummy, #1 and 2.
nacd_1_JvObjectPrefix26   virtual void nacd_1 (void) {}; // This slot really contains the Class pointer.
27   // For IA64, the GC descriptor goes into the second word of the nacd1 descr.
28 # ifndef __ia64__
nacd_2_JvObjectPrefix29     virtual void nacd_2 (void) {}; // Actually the GC bitmap marking descriptor.
30 # endif
31 };
32 }
33 
34 // Forward declarations for friends of java::lang::Object
35 void _Jv_MonitorEnter (jobject obj);
36 void _Jv_MonitorExit (jobject obj);
37 void _Jv_InitializeSyncMutex (void);
38 void _Jv_FinalizeObject (jobject obj);
39 bool _Jv_ObjectCheckMonitor (jobject obj);
40 
41 class java::lang::Object : public _JvObjectPrefix
42 {
43 protected:
44   virtual void finalize (void);
45 public:
46   // Order must match order in Object.java.
47   jclass getClass (void);
48   virtual jint hashCode (void);
49   void notify (void);
50   void notifyAll (void);
51   void wait (jlong timeout, jint nanos);
52   virtual jboolean equals (jobject obj);
53   Object (void);
54   virtual jstring toString (void);
55   void wait (void);
56   void wait (jlong timeout);
57 
58   friend void ::_Jv_MonitorEnter (jobject obj);
59   friend void ::_Jv_MonitorExit (jobject obj);
60   friend void ::_Jv_InitializeSyncMutex (void);
61   friend void ::_Jv_FinalizeObject (jobject obj);
62   friend bool ::_Jv_ObjectCheckMonitor (jobject obj);
63 
64 #ifdef JV_MARKOBJ_DECL
65   friend JV_MARKOBJ_DECL;
66 #endif
67 #ifdef JV_MARKARRAY_DECL
68   friend JV_MARKARRAY_DECL;
69 #endif
70 
71   static java::lang::Class class$;
72 
73 protected:
74   virtual jobject clone (void);
75 
76 private:
77   // This does not actually refer to a Java object.  Instead it is a
78   // placeholder for a piece of internal data (the synchronization
79   // information).
80 # ifndef JV_HASH_SYNCHRONIZATION
81     jobject sync_info;
82 # endif
83 
84     // Initialize the sync_info field.  Not called with JV_HASH_SYNCHRONIZATION.
85     void sync_init (void);
86 
87 public:
88   virtual void throwNoSuchMethodError (void);
89 };
90 
91 #endif /* __JAVA_LANG_OBJECT_H__ */
92