28 // (see oopHierarchy for complete oop class hierarchy) |
28 // (see oopHierarchy for complete oop class hierarchy) |
29 // |
29 // |
30 // no virtual functions allowed |
30 // no virtual functions allowed |
31 |
31 |
32 // store into oop with store check |
32 // store into oop with store check |
33 void oop_store(oop* p, oop v); |
33 template <class T> void oop_store(T* p, oop v); |
34 void oop_store(volatile oop* p, oop v); |
34 template <class T> void oop_store(volatile T* p, oop v); |
35 |
35 |
36 // store into oop without store check |
36 // store into oop without store check |
37 void oop_store_without_check(oop* p, oop v); |
37 template <class T> void oop_store_without_check(T* p, oop v); |
38 void oop_store_without_check(volatile oop* p, oop v); |
38 template <class T> void oop_store_without_check(volatile T* p, oop v); |
39 |
39 |
40 |
40 |
41 extern bool always_do_update_barrier; |
41 extern bool always_do_update_barrier; |
42 |
42 |
43 // Forward declarations. |
43 // Forward declarations. |
71 |
74 |
72 // Used only to re-initialize the mark word (e.g., of promoted |
75 // Used only to re-initialize the mark word (e.g., of promoted |
73 // objects during a GC) -- requires a valid klass pointer |
76 // objects during a GC) -- requires a valid klass pointer |
74 void init_mark(); |
77 void init_mark(); |
75 |
78 |
76 klassOop klass() const { return _klass; } |
79 klassOop klass() const; |
77 oop* klass_addr() const { return (oop*) &_klass; } |
80 oop* klass_addr(); |
|
81 narrowOop* compressed_klass_addr(); |
78 |
82 |
79 void set_klass(klassOop k); |
83 void set_klass(klassOop k); |
80 // For when the klass pointer is being used as a linked list "next" field. |
84 // For when the klass pointer is being used as a linked list "next" field. |
81 void set_klass_to_list_ptr(oop k); |
85 void set_klass_to_list_ptr(oop k); |
82 |
86 |
83 // size of object header |
87 // size of object header, aligned to platform wordSize |
84 static int header_size() { return sizeof(oopDesc)/HeapWordSize; } |
88 static int header_size() { return sizeof(oopDesc)/HeapWordSize; } |
85 static int header_size_in_bytes() { return sizeof(oopDesc); } |
|
86 |
89 |
87 Klass* blueprint() const; |
90 Klass* blueprint() const; |
88 |
91 |
89 // Returns whether this is an instance of k or an instance of a subclass of k |
92 // Returns whether this is an instance of k or an instance of a subclass of k |
90 bool is_a(klassOop k) const; |
93 bool is_a(klassOop k) const; |
117 bool is_javaArray() const; |
120 bool is_javaArray() const; |
118 bool is_compiledICHolder() const; |
121 bool is_compiledICHolder() const; |
119 |
122 |
120 private: |
123 private: |
121 // field addresses in oop |
124 // field addresses in oop |
122 // byte/char/bool/short fields are always stored as full words |
|
123 void* field_base(int offset) const; |
125 void* field_base(int offset) const; |
124 |
126 |
125 jbyte* byte_field_addr(int offset) const; |
127 jbyte* byte_field_addr(int offset) const; |
126 jchar* char_field_addr(int offset) const; |
128 jchar* char_field_addr(int offset) const; |
127 jboolean* bool_field_addr(int offset) const; |
129 jboolean* bool_field_addr(int offset) const; |
128 jint* int_field_addr(int offset) const; |
130 jint* int_field_addr(int offset) const; |
129 jshort* short_field_addr(int offset) const; |
131 jshort* short_field_addr(int offset) const; |
130 jlong* long_field_addr(int offset) const; |
132 jlong* long_field_addr(int offset) const; |
131 jfloat* float_field_addr(int offset) const; |
133 jfloat* float_field_addr(int offset) const; |
132 jdouble* double_field_addr(int offset) const; |
134 jdouble* double_field_addr(int offset) const; |
|
135 address* address_field_addr(int offset) const; |
133 |
136 |
134 public: |
137 public: |
135 // need this as public for garbage collection |
138 // Need this as public for garbage collection. |
136 oop* obj_field_addr(int offset) const; |
139 template <class T> T* obj_field_addr(int offset) const; |
137 |
140 |
|
141 static bool is_null(oop obj); |
|
142 static bool is_null(narrowOop obj); |
|
143 |
|
144 // Decode an oop pointer from a narrowOop if compressed. |
|
145 // These are overloaded for oop and narrowOop as are the other functions |
|
146 // below so that they can be called in template functions. |
|
147 static oop decode_heap_oop_not_null(oop v); |
|
148 static oop decode_heap_oop_not_null(narrowOop v); |
|
149 static oop decode_heap_oop(oop v); |
|
150 static oop decode_heap_oop(narrowOop v); |
|
151 |
|
152 // Encode an oop pointer to a narrow oop. The or_null versions accept |
|
153 // null oop pointer, others do not in order to eliminate the |
|
154 // null checking branches. |
|
155 static narrowOop encode_heap_oop_not_null(oop v); |
|
156 static narrowOop encode_heap_oop(oop v); |
|
157 |
|
158 // Load an oop out of the Java heap |
|
159 static narrowOop load_heap_oop(narrowOop* p); |
|
160 static oop load_heap_oop(oop* p); |
|
161 |
|
162 // Load an oop out of Java heap and decode it to an uncompressed oop. |
|
163 static oop load_decode_heap_oop_not_null(narrowOop* p); |
|
164 static oop load_decode_heap_oop_not_null(oop* p); |
|
165 static oop load_decode_heap_oop(narrowOop* p); |
|
166 static oop load_decode_heap_oop(oop* p); |
|
167 |
|
168 // Store an oop into the heap. |
|
169 static void store_heap_oop(narrowOop* p, narrowOop v); |
|
170 static void store_heap_oop(oop* p, oop v); |
|
171 |
|
172 // Encode oop if UseCompressedOops and store into the heap. |
|
173 static void encode_store_heap_oop_not_null(narrowOop* p, oop v); |
|
174 static void encode_store_heap_oop_not_null(oop* p, oop v); |
|
175 static void encode_store_heap_oop(narrowOop* p, oop v); |
|
176 static void encode_store_heap_oop(oop* p, oop v); |
|
177 |
|
178 static void release_store_heap_oop(volatile narrowOop* p, narrowOop v); |
|
179 static void release_store_heap_oop(volatile oop* p, oop v); |
|
180 |
|
181 static void release_encode_store_heap_oop_not_null(volatile narrowOop* p, oop v); |
|
182 static void release_encode_store_heap_oop_not_null(volatile oop* p, oop v); |
|
183 static void release_encode_store_heap_oop(volatile narrowOop* p, oop v); |
|
184 static void release_encode_store_heap_oop(volatile oop* p, oop v); |
|
185 |
|
186 static oop atomic_exchange_oop(oop exchange_value, volatile HeapWord *dest); |
|
187 static oop atomic_compare_exchange_oop(oop exchange_value, |
|
188 volatile HeapWord *dest, |
|
189 oop compare_value); |
|
190 |
|
191 // Access to fields in a instanceOop through these methods. |
138 oop obj_field(int offset) const; |
192 oop obj_field(int offset) const; |
139 void obj_field_put(int offset, oop value); |
193 void obj_field_put(int offset, oop value); |
|
194 void obj_field_raw_put(int offset, oop value); |
140 |
195 |
141 jbyte byte_field(int offset) const; |
196 jbyte byte_field(int offset) const; |
142 void byte_field_put(int offset, jbyte contents); |
197 void byte_field_put(int offset, jbyte contents); |
143 |
198 |
144 jchar char_field(int offset) const; |
199 jchar char_field(int offset) const; |
159 jfloat float_field(int offset) const; |
214 jfloat float_field(int offset) const; |
160 void float_field_put(int offset, jfloat contents); |
215 void float_field_put(int offset, jfloat contents); |
161 |
216 |
162 jdouble double_field(int offset) const; |
217 jdouble double_field(int offset) const; |
163 void double_field_put(int offset, jdouble contents); |
218 void double_field_put(int offset, jdouble contents); |
|
219 |
|
220 address address_field(int offset) const; |
|
221 void address_field_put(int offset, address contents); |
164 |
222 |
165 oop obj_field_acquire(int offset) const; |
223 oop obj_field_acquire(int offset) const; |
166 void release_obj_field_put(int offset, oop value); |
224 void release_obj_field_put(int offset, oop value); |
167 |
225 |
168 jbyte byte_field_acquire(int offset) const; |
226 jbyte byte_field_acquire(int offset) const; |