11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_OOP_HPP
26 #define SHARE_VM_OOPS_OOP_HPP
27
28 #include "gc/shared/specialized_oop_closures.hpp"
29 #include "memory/iterator.hpp"
30 #include "memory/memRegion.hpp"
31 #include "oops/metadata.hpp"
32 #include "utilities/macros.hpp"
33
34 // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe
35 // the format of Java objects so the fields can be accessed from C++.
36 // oopDesc is abstract.
37 // (see oopHierarchy for complete oop class hierarchy)
38 //
39 // no virtual functions allowed
40
41 extern bool always_do_update_barrier;
42
43 // Forward declarations.
44 class OopClosure;
45 class ScanClosure;
46 class FastScanClosure;
47 class FilteringClosure;
48 class BarrierSet;
49 class CMSIsAliveClosure;
50
161 static inline narrowOop load_heap_oop(narrowOop* p);
162 static inline oop load_heap_oop(oop* p);
163
164 // Load an oop out of Java heap and decode it to an uncompressed oop.
165 static inline oop load_decode_heap_oop_not_null(narrowOop* p);
166 static inline oop load_decode_heap_oop_not_null(oop* p);
167 static inline oop load_decode_heap_oop(narrowOop* p);
168 static inline oop load_decode_heap_oop(oop* p);
169
170 // Store already encoded heap oop into the heap.
171 static inline void store_heap_oop(narrowOop* p, narrowOop v);
172 static inline void store_heap_oop(oop* p, oop v);
173
174 // Encode oop if UseCompressedOops and store into the heap.
175 static inline void encode_store_heap_oop_not_null(narrowOop* p, oop v);
176 static inline void encode_store_heap_oop_not_null(oop* p, oop v);
177 static inline void encode_store_heap_oop(narrowOop* p, oop v);
178 static inline void encode_store_heap_oop(oop* p, oop v);
179
180 // Access to fields in a instanceOop through these methods.
181 oop obj_field(int offset) const;
182 void obj_field_put(int offset, oop value);
183 void obj_field_put_raw(int offset, oop value);
184 void obj_field_put_volatile(int offset, oop value);
185
186 Metadata* metadata_field(int offset) const;
187 void metadata_field_put(int offset, Metadata* value);
188
189 Metadata* metadata_field_acquire(int offset) const;
190 void release_metadata_field_put(int offset, Metadata* value);
191
192 jbyte byte_field(int offset) const;
193 void byte_field_put(int offset, jbyte contents);
194
195 jchar char_field(int offset) const;
196 void char_field_put(int offset, jchar contents);
197
198 jboolean bool_field(int offset) const;
199 void bool_field_put(int offset, jboolean contents);
200
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_OOP_HPP
26 #define SHARE_VM_OOPS_OOP_HPP
27
28 #include "gc/shared/specialized_oop_closures.hpp"
29 #include "memory/iterator.hpp"
30 #include "memory/memRegion.hpp"
31 #include "oops/access.hpp"
32 #include "oops/metadata.hpp"
33 #include "utilities/macros.hpp"
34
35 // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe
36 // the format of Java objects so the fields can be accessed from C++.
37 // oopDesc is abstract.
38 // (see oopHierarchy for complete oop class hierarchy)
39 //
40 // no virtual functions allowed
41
42 extern bool always_do_update_barrier;
43
44 // Forward declarations.
45 class OopClosure;
46 class ScanClosure;
47 class FastScanClosure;
48 class FilteringClosure;
49 class BarrierSet;
50 class CMSIsAliveClosure;
51
162 static inline narrowOop load_heap_oop(narrowOop* p);
163 static inline oop load_heap_oop(oop* p);
164
165 // Load an oop out of Java heap and decode it to an uncompressed oop.
166 static inline oop load_decode_heap_oop_not_null(narrowOop* p);
167 static inline oop load_decode_heap_oop_not_null(oop* p);
168 static inline oop load_decode_heap_oop(narrowOop* p);
169 static inline oop load_decode_heap_oop(oop* p);
170
171 // Store already encoded heap oop into the heap.
172 static inline void store_heap_oop(narrowOop* p, narrowOop v);
173 static inline void store_heap_oop(oop* p, oop v);
174
175 // Encode oop if UseCompressedOops and store into the heap.
176 static inline void encode_store_heap_oop_not_null(narrowOop* p, oop v);
177 static inline void encode_store_heap_oop_not_null(oop* p, oop v);
178 static inline void encode_store_heap_oop(narrowOop* p, oop v);
179 static inline void encode_store_heap_oop(oop* p, oop v);
180
181 // Access to fields in a instanceOop through these methods.
182 template <DecoratorSet decorator>
183 oop obj_field_special(int offset) const;
184 oop obj_field(int offset) const;
185 void obj_field_put(int offset, oop value);
186 void obj_field_put_raw(int offset, oop value);
187 void obj_field_put_volatile(int offset, oop value);
188
189 Metadata* metadata_field(int offset) const;
190 void metadata_field_put(int offset, Metadata* value);
191
192 Metadata* metadata_field_acquire(int offset) const;
193 void release_metadata_field_put(int offset, Metadata* value);
194
195 jbyte byte_field(int offset) const;
196 void byte_field_put(int offset, jbyte contents);
197
198 jchar char_field(int offset) const;
199 void char_field_put(int offset, jchar contents);
200
201 jboolean bool_field(int offset) const;
202 void bool_field_put(int offset, jboolean contents);
203
|