Object.h 2.4 KB

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