< prev index next >

src/hotspot/share/oops/oop.hpp

Print this page

100   // Size of object header, aligned to platform wordSize
101   static int header_size() {
102     if (UseCompactObjectHeaders) {
103       return sizeof(markWord) / HeapWordSize;
104     } else {
105       return sizeof(oopDesc)  / HeapWordSize;
106     }
107   }
108 
109   // Returns whether this is an instance of k or an instance of a subclass of k
110   inline bool is_a(Klass* k) const;
111 
112   // Returns the actual oop size of the object in machine words
113   inline size_t size();
114 
115   // Sometimes (for complicated concurrency-related reasons), it is useful
116   // to be able to figure out the size of an object knowing its klass.
117   inline size_t size_given_klass(Klass* klass);
118 
119   // type test operations (inlined in oop.inline.hpp)
120   inline bool is_instance()    const;
121   inline bool is_instanceRef() const;
122   inline bool is_stackChunk()  const;
123   inline bool is_array()       const;
124   inline bool is_objArray()    const;
125   inline bool is_typeArray()   const;







126 
127   // type test operations that don't require inclusion of oop.inline.hpp.
128   bool is_instance_noinline()    const;
129   bool is_instanceRef_noinline() const;
130   bool is_stackChunk_noinline()  const;
131   bool is_array_noinline()       const;
132   bool is_objArray_noinline()    const;
133   bool is_typeArray_noinline()   const;


134 
135  protected:
136   inline oop        as_oop() const { return const_cast<oopDesc*>(this); }
137 
138  public:
139   template<typename T>
140   inline T* field_addr(int offset) const;
141 
142   template <typename T> inline size_t field_offset(T* p) const;
143 
144   // Standard compare function returns negative value if o1 < o2
145   //                                   0              if o1 == o2
146   //                                   positive value if o1 > o2
147   inline static int  compare(oop o1, oop o2) {
148     void* o1_addr = (void*)o1;
149     void* o2_addr = (void*)o2;
150     if (o1_addr < o2_addr) {
151       return -1;
152     } else if (o1_addr > o2_addr) {
153       return 1;

100   // Size of object header, aligned to platform wordSize
101   static int header_size() {
102     if (UseCompactObjectHeaders) {
103       return sizeof(markWord) / HeapWordSize;
104     } else {
105       return sizeof(oopDesc)  / HeapWordSize;
106     }
107   }
108 
109   // Returns whether this is an instance of k or an instance of a subclass of k
110   inline bool is_a(Klass* k) const;
111 
112   // Returns the actual oop size of the object in machine words
113   inline size_t size();
114 
115   // Sometimes (for complicated concurrency-related reasons), it is useful
116   // to be able to figure out the size of an object knowing its klass.
117   inline size_t size_given_klass(Klass* klass);
118 
119   // type test operations (inlined in oop.inline.hpp)
120   inline bool is_instance()         const;
121   inline bool is_inline()           const;
122   inline bool is_instanceRef()      const;
123   inline bool is_stackChunk()       const;
124   inline bool is_array()            const;
125   inline bool is_objArray()         const;
126   inline bool is_typeArray()        const;
127   inline bool is_flatArray()        const;
128   inline bool is_refArray()         const;
129   inline bool is_refined_objArray() const;
130   inline bool is_array_with_oops()  const;
131 
132   inline bool is_inline_type()      const;
133 
134   // type test operations that don't require inclusion of oop.inline.hpp.
135   bool is_instance_noinline()         const;
136   bool is_instanceRef_noinline()      const;
137   bool is_stackChunk_noinline()       const;
138   bool is_array_noinline()            const;
139   bool is_objArray_noinline()         const;
140   bool is_refArray_noinline()         const;
141   bool is_typeArray_noinline()        const;
142   bool is_flatArray_noinline()        const;
143 
144  protected:
145   inline oop        as_oop() const { return const_cast<oopDesc*>(this); }
146 
147  public:
148   template<typename T>
149   inline T* field_addr(int offset) const;
150 
151   template <typename T> inline size_t field_offset(T* p) const;
152 
153   // Standard compare function returns negative value if o1 < o2
154   //                                   0              if o1 == o2
155   //                                   positive value if o1 > o2
156   inline static int  compare(oop o1, oop o2) {
157     void* o1_addr = (void*)o1;
158     void* o2_addr = (void*)o2;
159     if (o1_addr < o2_addr) {
160       return -1;
161     } else if (o1_addr > o2_addr) {
162       return 1;
< prev index next >