< prev index next >

src/hotspot/share/oops/oop.hpp

Print this page

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







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


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

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