Object.h 2.4 KB
Newer Older
Tom Tromey committed
1 2
// Object.h - Header file for java.lang.Object.  -*- c++ -*-

3
/* Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005  Free Software Foundation
Tom Tromey committed
4 5 6 7 8 9 10 11 12 13 14 15

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#ifndef __JAVA_LANG_OBJECT_H__
#define __JAVA_LANG_OBJECT_H__

#pragma interface

Tom Tromey committed
16
#include <gcj/javaprims.h>
Tom Tromey committed
17

18 19
extern "Java"
{
20
// This class is mainly here as a kludge to get G++ to allocate two
21
// extra entries in each vtable.
Tom Tromey committed
22 23 24
struct _JvObjectPrefix
{
protected:
25
  // New ABI Compatibility Dummy, #1 and 2.
26 27 28 29 30
  virtual void nacd_1 (void) {}; // This slot really contains the Class pointer.
  // For IA64, the GC descriptor goes into the second word of the nacd1 descr.
# ifndef __ia64__
    virtual void nacd_2 (void) {}; // Actually the GC bitmap marking descriptor.
# endif
Tom Tromey committed
31
};
32
}
Tom Tromey committed
33

34 35 36 37 38 39 40
// Forward declarations for friends of java::lang::Object
void _Jv_MonitorEnter (jobject obj);
void _Jv_MonitorExit (jobject obj);
void _Jv_InitializeSyncMutex (void);
void _Jv_FinalizeObject (jobject obj);
bool _Jv_ObjectCheckMonitor (jobject obj);

Tom Tromey committed
41 42
class java::lang::Object : public _JvObjectPrefix
{
43 44
protected:
  virtual void finalize (void);
Tom Tromey committed
45 46 47 48 49 50 51 52 53 54 55 56 57
public:
  // Order must match order in Object.java.
  jclass getClass (void);
  virtual jint hashCode (void);
  void notify (void);
  void notifyAll (void);
  void wait (jlong timeout, jint nanos);
  virtual jboolean equals (jobject obj);
  Object (void);
  virtual jstring toString (void);
  void wait (void);
  void wait (jlong timeout);

58 59 60 61 62
  friend void ::_Jv_MonitorEnter (jobject obj);
  friend void ::_Jv_MonitorExit (jobject obj);
  friend void ::_Jv_InitializeSyncMutex (void);
  friend void ::_Jv_FinalizeObject (jobject obj);
  friend bool ::_Jv_ObjectCheckMonitor (jobject obj);
Tom Tromey committed
63 64 65 66 67 68 69 70

#ifdef JV_MARKOBJ_DECL
  friend JV_MARKOBJ_DECL;
#endif
#ifdef JV_MARKARRAY_DECL
  friend JV_MARKARRAY_DECL;
#endif

71 72
  static java::lang::Class class$;

Tom Tromey committed
73 74 75 76 77 78 79
protected:
  virtual jobject clone (void);

private:
  // This does not actually refer to a Java object.  Instead it is a
  // placeholder for a piece of internal data (the synchronization
  // information).
Tom Tromey committed
80 81 82
# ifndef JV_HASH_SYNCHRONIZATION
    jobject sync_info;
# endif
Tom Tromey committed
83

Tom Tromey committed
84 85
    // Initialize the sync_info field.  Not called with JV_HASH_SYNCHRONIZATION.
    void sync_init (void);
86 87 88

public:
  virtual void throwNoSuchMethodError (void);
Tom Tromey committed
89 90 91
};

#endif /* __JAVA_LANG_OBJECT_H__ */