annotate src/share/vm/oops/oop.inline.hpp @ 16:f8236e79048a

6664627: Merge changes made only in hotspot 11 forward to jdk 7 Reviewed-by: jcoomes
author dcubed
date Wed, 05 Dec 2007 09:00:00 -0800
parents a61af66fc99e
children ba764ed4b6f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // Implementation of all inlined member functions defined in oop.hpp
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // We need a separate file to avoid circular references
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 inline void oopDesc::release_set_mark(markOop m) {
a61af66fc99e Initial load
duke
parents:
diff changeset
30 OrderAccess::release_store_ptr(&_mark, m);
a61af66fc99e Initial load
duke
parents:
diff changeset
31 }
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 inline markOop oopDesc::cas_set_mark(markOop new_mark, markOop old_mark) {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 return (markOop) Atomic::cmpxchg_ptr(new_mark, &_mark, old_mark);
a61af66fc99e Initial load
duke
parents:
diff changeset
35 }
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 inline void oopDesc::set_klass(klassOop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // since klasses are promoted no store check is needed
a61af66fc99e Initial load
duke
parents:
diff changeset
39 assert(Universe::is_bootstrapping() || k != NULL, "must be a real klassOop");
a61af66fc99e Initial load
duke
parents:
diff changeset
40 assert(Universe::is_bootstrapping() || k->is_klass(), "not a klassOop");
a61af66fc99e Initial load
duke
parents:
diff changeset
41 oop_store_without_check((oop*) &_klass, (oop) k);
a61af66fc99e Initial load
duke
parents:
diff changeset
42 }
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 inline void oopDesc::set_klass_to_list_ptr(oop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // This is only to be used during GC, for from-space objects, so no
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // barrier is needed.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 _klass = (klassOop)k;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 inline void oopDesc::init_mark() { set_mark(markOopDesc::prototype_for_object(this)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
51 inline Klass* oopDesc::blueprint() const { return klass()->klass_part(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 inline bool oopDesc::is_a(klassOop k) const { return blueprint()->is_subtype_of(k); }
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 inline bool oopDesc::is_instance() const { return blueprint()->oop_is_instance(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
56 inline bool oopDesc::is_instanceRef() const { return blueprint()->oop_is_instanceRef(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 inline bool oopDesc::is_array() const { return blueprint()->oop_is_array(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 inline bool oopDesc::is_objArray() const { return blueprint()->oop_is_objArray(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
59 inline bool oopDesc::is_typeArray() const { return blueprint()->oop_is_typeArray(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
60 inline bool oopDesc::is_javaArray() const { return blueprint()->oop_is_javaArray(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
61 inline bool oopDesc::is_symbol() const { return blueprint()->oop_is_symbol(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 inline bool oopDesc::is_klass() const { return blueprint()->oop_is_klass(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 inline bool oopDesc::is_thread() const { return blueprint()->oop_is_thread(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 inline bool oopDesc::is_method() const { return blueprint()->oop_is_method(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 inline bool oopDesc::is_constMethod() const { return blueprint()->oop_is_constMethod(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 inline bool oopDesc::is_methodData() const { return blueprint()->oop_is_methodData(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
67 inline bool oopDesc::is_constantPool() const { return blueprint()->oop_is_constantPool(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 inline bool oopDesc::is_constantPoolCache() const { return blueprint()->oop_is_constantPoolCache(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
69 inline bool oopDesc::is_compiledICHolder() const { return blueprint()->oop_is_compiledICHolder(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 inline void* oopDesc::field_base(int offset) const { return (void*)&((char*)this)[offset]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 inline oop* oopDesc::obj_field_addr(int offset) const { return (oop*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
74 inline jbyte* oopDesc::byte_field_addr(int offset) const { return (jbyte*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
75 inline jchar* oopDesc::char_field_addr(int offset) const { return (jchar*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 inline jboolean* oopDesc::bool_field_addr(int offset) const { return (jboolean*)field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 inline jint* oopDesc::int_field_addr(int offset) const { return (jint*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 inline jshort* oopDesc::short_field_addr(int offset) const { return (jshort*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 inline jlong* oopDesc::long_field_addr(int offset) const { return (jlong*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 inline jfloat* oopDesc::float_field_addr(int offset) const { return (jfloat*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 inline jdouble* oopDesc::double_field_addr(int offset) const { return (jdouble*) field_base(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 inline oop oopDesc::obj_field(int offset) const { return *obj_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
84 inline void oopDesc::obj_field_put(int offset, oop value) { oop_store(obj_field_addr(offset), value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 inline jbyte oopDesc::byte_field(int offset) const { return (jbyte) *byte_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 inline void oopDesc::byte_field_put(int offset, jbyte contents) { *byte_field_addr(offset) = (jint) contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 inline jboolean oopDesc::bool_field(int offset) const { return (jboolean) *bool_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 inline void oopDesc::bool_field_put(int offset, jboolean contents) { *bool_field_addr(offset) = (jint) contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 inline jchar oopDesc::char_field(int offset) const { return (jchar) *char_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
93 inline void oopDesc::char_field_put(int offset, jchar contents) { *char_field_addr(offset) = (jint) contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 inline jint oopDesc::int_field(int offset) const { return *int_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 inline void oopDesc::int_field_put(int offset, jint contents) { *int_field_addr(offset) = contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 inline jshort oopDesc::short_field(int offset) const { return (jshort) *short_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 inline void oopDesc::short_field_put(int offset, jshort contents) { *short_field_addr(offset) = (jint) contents;}
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 inline jlong oopDesc::long_field(int offset) const { return *long_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 inline void oopDesc::long_field_put(int offset, jlong contents) { *long_field_addr(offset) = contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 inline jfloat oopDesc::float_field(int offset) const { return *float_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 inline void oopDesc::float_field_put(int offset, jfloat contents) { *float_field_addr(offset) = contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 inline jdouble oopDesc::double_field(int offset) const { return *double_field_addr(offset); }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 inline void oopDesc::double_field_put(int offset, jdouble contents) { *double_field_addr(offset) = contents; }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 inline oop oopDesc::obj_field_acquire(int offset) const { return (oop)OrderAccess::load_ptr_acquire(obj_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 inline void oopDesc::release_obj_field_put(int offset, oop value) { oop_store((volatile oop*)obj_field_addr(offset), value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 inline jbyte oopDesc::byte_field_acquire(int offset) const { return OrderAccess::load_acquire(byte_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 inline void oopDesc::release_byte_field_put(int offset, jbyte contents) { OrderAccess::release_store(byte_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 inline jboolean oopDesc::bool_field_acquire(int offset) const { return OrderAccess::load_acquire(bool_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 inline void oopDesc::release_bool_field_put(int offset, jboolean contents) { OrderAccess::release_store(bool_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 inline jchar oopDesc::char_field_acquire(int offset) const { return OrderAccess::load_acquire(char_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 inline void oopDesc::release_char_field_put(int offset, jchar contents) { OrderAccess::release_store(char_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 inline jint oopDesc::int_field_acquire(int offset) const { return OrderAccess::load_acquire(int_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 inline void oopDesc::release_int_field_put(int offset, jint contents) { OrderAccess::release_store(int_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 inline jshort oopDesc::short_field_acquire(int offset) const { return (jshort)OrderAccess::load_acquire(short_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 inline void oopDesc::release_short_field_put(int offset, jshort contents) { OrderAccess::release_store(short_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 inline jlong oopDesc::long_field_acquire(int offset) const { return OrderAccess::load_acquire(long_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 inline void oopDesc::release_long_field_put(int offset, jlong contents) { OrderAccess::release_store(long_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 inline jfloat oopDesc::float_field_acquire(int offset) const { return OrderAccess::load_acquire(float_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 inline void oopDesc::release_float_field_put(int offset, jfloat contents) { OrderAccess::release_store(float_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 inline jdouble oopDesc::double_field_acquire(int offset) const { return OrderAccess::load_acquire(double_field_addr(offset)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 inline void oopDesc::release_double_field_put(int offset, jdouble contents) { OrderAccess::release_store(double_field_addr(offset), contents); }
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 inline int oopDesc::size_given_klass(Klass* klass) {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 int lh = klass->layout_helper();
a61af66fc99e Initial load
duke
parents:
diff changeset
140 int s = lh >> LogHeapWordSize; // deliver size scaled by wordSize
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // lh is now a value computed at class initialization that may hint
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // at the size. For instances, this is positive and equal to the
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // size. For arrays, this is negative and provides log2 of the
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // array element size. For other oops, it is zero and thus requires
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
147 //
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // We go to all this trouble because the size computation is at the
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // heart of phase 2 of mark-compaction, and called for every object,
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // alive or dead. So the speed here is equal in importance to the
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // speed of allocation.
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 if (lh <= Klass::_lh_neutral_value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // The most common case is instances; fall through if so.
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if (lh < Klass::_lh_neutral_value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // Second most common case is arrays. We have to fetch the
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // length of the array, shift (multiply) it appropriately,
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // up to wordSize, add the header, and align to object size.
a61af66fc99e Initial load
duke
parents:
diff changeset
159 size_t size_in_bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 #ifdef _M_IA64
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // The Windows Itanium Aug 2002 SDK hoists this load above
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // the check for s < 0. An oop at the end of the heap will
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // cause an access violation if this load is performed on a non
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // array oop. Making the reference volatile prohibits this.
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // (%%% please explain by what magic the length is actually fetched!)
a61af66fc99e Initial load
duke
parents:
diff changeset
166 volatile int *array_length;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 array_length = (volatile int *)( (intptr_t)this +
a61af66fc99e Initial load
duke
parents:
diff changeset
168 arrayOopDesc::length_offset_in_bytes() );
a61af66fc99e Initial load
duke
parents:
diff changeset
169 assert(array_length > 0, "Integer arithmetic problem somewhere");
a61af66fc99e Initial load
duke
parents:
diff changeset
170 // Put into size_t to avoid overflow.
a61af66fc99e Initial load
duke
parents:
diff changeset
171 size_in_bytes = (size_t) array_length;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 size_in_bytes = size_in_bytes << Klass::layout_helper_log2_element_size(lh);
a61af66fc99e Initial load
duke
parents:
diff changeset
173 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
174 size_t array_length = (size_t) ((arrayOop)this)->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
175 size_in_bytes = array_length << Klass::layout_helper_log2_element_size(lh);
a61af66fc99e Initial load
duke
parents:
diff changeset
176 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
177 size_in_bytes += Klass::layout_helper_header_size(lh);
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 // This code could be simplified, but by keeping array_header_in_bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // in units of bytes and doing it this way we can round up just once,
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // skipping the intermediate round to HeapWordSize. Cast the result
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // of round_to to size_t to guarantee unsigned division == right shift.
a61af66fc99e Initial load
duke
parents:
diff changeset
183 s = (int)((size_t)round_to(size_in_bytes, MinObjAlignmentInBytes) /
a61af66fc99e Initial load
duke
parents:
diff changeset
184 HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // UseParNewGC can change the length field of an "old copy" of an object
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // array in the young gen so it indicates the stealable portion of
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // an already copied array. This will cause the first disjunct below
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // to fail if the sizes are computed across such a concurrent change.
a61af66fc99e Initial load
duke
parents:
diff changeset
190 // UseParNewGC also runs with promotion labs (which look like int
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // filler arrays) which are subject to changing their declared size
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // when finally retiring a PLAB; this also can cause the first disjunct
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // to fail for another worker thread that is concurrently walking the block
a61af66fc99e Initial load
duke
parents:
diff changeset
194 // offset table. Both these invariant failures are benign for their
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // current uses; we relax the assertion checking to cover these two cases below:
a61af66fc99e Initial load
duke
parents:
diff changeset
196 // is_objArray() && is_forwarded() // covers first scenario above
a61af66fc99e Initial load
duke
parents:
diff changeset
197 // || is_typeArray() // covers second scenario above
a61af66fc99e Initial load
duke
parents:
diff changeset
198 // If and when UseParallelGC uses the same obj array oop stealing/chunking
a61af66fc99e Initial load
duke
parents:
diff changeset
199 // technique, or when G1 is integrated (and currently uses this array chunking
a61af66fc99e Initial load
duke
parents:
diff changeset
200 // technique) we will need to suitably modify the assertion.
a61af66fc99e Initial load
duke
parents:
diff changeset
201 assert((s == klass->oop_size(this)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
202 (((UseParNewGC || UseParallelGC) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
203 Universe::heap()->is_gc_active()) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
204 (is_typeArray() ||
a61af66fc99e Initial load
duke
parents:
diff changeset
205 (is_objArray() && is_forwarded()))),
a61af66fc99e Initial load
duke
parents:
diff changeset
206 "wrong array object size");
a61af66fc99e Initial load
duke
parents:
diff changeset
207 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 // Must be zero, so bite the bullet and take the virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
209 s = klass->oop_size(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 assert(s % MinObjAlignment == 0, "alignment check");
a61af66fc99e Initial load
duke
parents:
diff changeset
214 assert(s > 0, "Bad size calculated");
a61af66fc99e Initial load
duke
parents:
diff changeset
215 return s;
a61af66fc99e Initial load
duke
parents:
diff changeset
216 }
a61af66fc99e Initial load
duke
parents:
diff changeset
217
a61af66fc99e Initial load
duke
parents:
diff changeset
218
a61af66fc99e Initial load
duke
parents:
diff changeset
219 inline int oopDesc::size() {
a61af66fc99e Initial load
duke
parents:
diff changeset
220 return size_given_klass(blueprint());
a61af66fc99e Initial load
duke
parents:
diff changeset
221 }
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 inline bool oopDesc::is_parsable() {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 return blueprint()->oop_is_parsable(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 inline void update_barrier_set(oop *p, oop v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!");
a61af66fc99e Initial load
duke
parents:
diff changeset
230 oopDesc::bs()->write_ref_field(p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
231 }
a61af66fc99e Initial load
duke
parents:
diff changeset
232
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 inline void oop_store(oop* p, oop v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 if (always_do_update_barrier) {
a61af66fc99e Initial load
duke
parents:
diff changeset
236 oop_store((volatile oop*)p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
237 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 *p = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 update_barrier_set(p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243 inline void oop_store(volatile oop* p, oop v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // Used by release_obj_field_put, so use release_store_ptr.
a61af66fc99e Initial load
duke
parents:
diff changeset
245 OrderAccess::release_store_ptr(p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
246 update_barrier_set((oop *)p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 inline void oop_store_without_check(oop* p, oop v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // XXX YSR FIX ME!!!
a61af66fc99e Initial load
duke
parents:
diff changeset
251 if (always_do_update_barrier) {
a61af66fc99e Initial load
duke
parents:
diff changeset
252 oop_store(p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
253 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 assert(!Universe::heap()->barrier_set()->write_ref_needs_barrier(p, v),
a61af66fc99e Initial load
duke
parents:
diff changeset
255 "oop store without store check failed");
a61af66fc99e Initial load
duke
parents:
diff changeset
256 *p = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259
a61af66fc99e Initial load
duke
parents:
diff changeset
260 // When it absolutely has to get there.
a61af66fc99e Initial load
duke
parents:
diff changeset
261 inline void oop_store_without_check(volatile oop* p, oop v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 // XXX YSR FIX ME!!!
a61af66fc99e Initial load
duke
parents:
diff changeset
263 if (always_do_update_barrier) {
a61af66fc99e Initial load
duke
parents:
diff changeset
264 oop_store(p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
265 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 assert(!Universe::heap()->barrier_set()->
a61af66fc99e Initial load
duke
parents:
diff changeset
267 write_ref_needs_barrier((oop *)p, v),
a61af66fc99e Initial load
duke
parents:
diff changeset
268 "oop store without store check failed");
a61af66fc99e Initial load
duke
parents:
diff changeset
269 OrderAccess::release_store_ptr(p, v);
a61af66fc99e Initial load
duke
parents:
diff changeset
270 }
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // Used only for markSweep, scavenging
a61af66fc99e Initial load
duke
parents:
diff changeset
275 inline bool oopDesc::is_gc_marked() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
276 return mark()->is_marked();
a61af66fc99e Initial load
duke
parents:
diff changeset
277 }
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 inline bool oopDesc::is_locked() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
280 return mark()->is_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
281 }
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 inline bool oopDesc::is_unlocked() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
284 return mark()->is_unlocked();
a61af66fc99e Initial load
duke
parents:
diff changeset
285 }
a61af66fc99e Initial load
duke
parents:
diff changeset
286
a61af66fc99e Initial load
duke
parents:
diff changeset
287 inline bool oopDesc::has_bias_pattern() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 return mark()->has_bias_pattern();
a61af66fc99e Initial load
duke
parents:
diff changeset
289 }
a61af66fc99e Initial load
duke
parents:
diff changeset
290
a61af66fc99e Initial load
duke
parents:
diff changeset
291 inline bool check_obj_alignment(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
292 return (intptr_t)obj % MinObjAlignmentInBytes == 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
293 }
a61af66fc99e Initial load
duke
parents:
diff changeset
294
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // used only for asserts
a61af66fc99e Initial load
duke
parents:
diff changeset
297 inline bool oopDesc::is_oop(bool ignore_mark_word) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
298 oop obj = (oop) this;
a61af66fc99e Initial load
duke
parents:
diff changeset
299 if (!check_obj_alignment(obj)) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
300 if (!Universe::heap()->is_in_reserved(obj)) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // obj is aligned and accessible in heap
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // try to find metaclass cycle safely without seg faulting on bad input
a61af66fc99e Initial load
duke
parents:
diff changeset
303 // we should reach klassKlassObj by following klass link at most 3 times
a61af66fc99e Initial load
duke
parents:
diff changeset
304 for (int i = 0; i < 3; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
305 obj = obj->klass();
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // klass should be aligned and in permspace
a61af66fc99e Initial load
duke
parents:
diff changeset
307 if (!check_obj_alignment(obj)) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
308 if (!Universe::heap()->is_in_permanent(obj)) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 }
a61af66fc99e Initial load
duke
parents:
diff changeset
310 if (obj != Universe::klassKlassObj()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // During a dump, the _klassKlassObj moved to a shared space.
a61af66fc99e Initial load
duke
parents:
diff changeset
312 if (DumpSharedSpaces && Universe::klassKlassObj()->is_shared()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
313 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
314 }
a61af66fc99e Initial load
duke
parents:
diff changeset
315 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 // Header verification: the mark is typically non-NULL. If we're
a61af66fc99e Initial load
duke
parents:
diff changeset
319 // at a safepoint, it must not be null.
a61af66fc99e Initial load
duke
parents:
diff changeset
320 // Outside of a safepoint, the header could be changing (for example,
a61af66fc99e Initial load
duke
parents:
diff changeset
321 // another thread could be inflating a lock on this object).
a61af66fc99e Initial load
duke
parents:
diff changeset
322 if (ignore_mark_word) {
a61af66fc99e Initial load
duke
parents:
diff changeset
323 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
324 }
a61af66fc99e Initial load
duke
parents:
diff changeset
325 if (mark() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
326 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
327 }
a61af66fc99e Initial load
duke
parents:
diff changeset
328 return !SafepointSynchronize::is_at_safepoint();
a61af66fc99e Initial load
duke
parents:
diff changeset
329 }
a61af66fc99e Initial load
duke
parents:
diff changeset
330
a61af66fc99e Initial load
duke
parents:
diff changeset
331
a61af66fc99e Initial load
duke
parents:
diff changeset
332 // used only for asserts
a61af66fc99e Initial load
duke
parents:
diff changeset
333 inline bool oopDesc::is_oop_or_null(bool ignore_mark_word) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
334 return this == NULL ? true : is_oop(ignore_mark_word);
a61af66fc99e Initial load
duke
parents:
diff changeset
335 }
a61af66fc99e Initial load
duke
parents:
diff changeset
336
a61af66fc99e Initial load
duke
parents:
diff changeset
337 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // used only for asserts
a61af66fc99e Initial load
duke
parents:
diff changeset
339 inline bool oopDesc::is_unlocked_oop() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
340 if (!Universe::heap()->is_in_reserved(this)) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
341 return mark()->is_unlocked();
a61af66fc99e Initial load
duke
parents:
diff changeset
342 }
a61af66fc99e Initial load
duke
parents:
diff changeset
343
a61af66fc99e Initial load
duke
parents:
diff changeset
344
a61af66fc99e Initial load
duke
parents:
diff changeset
345 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
346
a61af66fc99e Initial load
duke
parents:
diff changeset
347 inline void oopDesc::follow_header() {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 MarkSweep::mark_and_push((oop*)&_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 }
a61af66fc99e Initial load
duke
parents:
diff changeset
350
a61af66fc99e Initial load
duke
parents:
diff changeset
351 inline void oopDesc::follow_contents() {
a61af66fc99e Initial load
duke
parents:
diff changeset
352 assert (is_gc_marked(), "should be marked");
a61af66fc99e Initial load
duke
parents:
diff changeset
353 blueprint()->oop_follow_contents(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 }
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356
a61af66fc99e Initial load
duke
parents:
diff changeset
357 // Used by scavengers
a61af66fc99e Initial load
duke
parents:
diff changeset
358
a61af66fc99e Initial load
duke
parents:
diff changeset
359 inline bool oopDesc::is_forwarded() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
360 // The extra heap check is needed since the obj might be locked, in which case the
a61af66fc99e Initial load
duke
parents:
diff changeset
361 // mark would point to a stack location and have the sentinel bit cleared
a61af66fc99e Initial load
duke
parents:
diff changeset
362 return mark()->is_marked();
a61af66fc99e Initial load
duke
parents:
diff changeset
363 }
a61af66fc99e Initial load
duke
parents:
diff changeset
364
a61af66fc99e Initial load
duke
parents:
diff changeset
365
a61af66fc99e Initial load
duke
parents:
diff changeset
366 // Used by scavengers
a61af66fc99e Initial load
duke
parents:
diff changeset
367 inline void oopDesc::forward_to(oop p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
368 assert(Universe::heap()->is_in_reserved(p),
a61af66fc99e Initial load
duke
parents:
diff changeset
369 "forwarding to something not in heap");
a61af66fc99e Initial load
duke
parents:
diff changeset
370 markOop m = markOopDesc::encode_pointer_as_mark(p);
a61af66fc99e Initial load
duke
parents:
diff changeset
371 assert(m->decode_pointer() == p, "encoding must be reversable");
a61af66fc99e Initial load
duke
parents:
diff changeset
372 set_mark(m);
a61af66fc99e Initial load
duke
parents:
diff changeset
373 }
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 // Used by parallel scavengers
a61af66fc99e Initial load
duke
parents:
diff changeset
376 inline bool oopDesc::cas_forward_to(oop p, markOop compare) {
a61af66fc99e Initial load
duke
parents:
diff changeset
377 assert(Universe::heap()->is_in_reserved(p),
a61af66fc99e Initial load
duke
parents:
diff changeset
378 "forwarding to something not in heap");
a61af66fc99e Initial load
duke
parents:
diff changeset
379 markOop m = markOopDesc::encode_pointer_as_mark(p);
a61af66fc99e Initial load
duke
parents:
diff changeset
380 assert(m->decode_pointer() == p, "encoding must be reversable");
a61af66fc99e Initial load
duke
parents:
diff changeset
381 return cas_set_mark(m, compare) == compare;
a61af66fc99e Initial load
duke
parents:
diff changeset
382 }
a61af66fc99e Initial load
duke
parents:
diff changeset
383
a61af66fc99e Initial load
duke
parents:
diff changeset
384 // Note that the forwardee is not the same thing as the displaced_mark.
a61af66fc99e Initial load
duke
parents:
diff changeset
385 // The forwardee is used when copying during scavenge and mark-sweep.
a61af66fc99e Initial load
duke
parents:
diff changeset
386 // It does need to clear the low two locking- and GC-related bits.
a61af66fc99e Initial load
duke
parents:
diff changeset
387 inline oop oopDesc::forwardee() const { return (oop) mark()->decode_pointer(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
388
a61af66fc99e Initial load
duke
parents:
diff changeset
389
a61af66fc99e Initial load
duke
parents:
diff changeset
390 inline bool oopDesc::has_displaced_mark() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
391 return mark()->has_displaced_mark_helper();
a61af66fc99e Initial load
duke
parents:
diff changeset
392 }
a61af66fc99e Initial load
duke
parents:
diff changeset
393
a61af66fc99e Initial load
duke
parents:
diff changeset
394 inline markOop oopDesc::displaced_mark() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
395 return mark()->displaced_mark_helper();
a61af66fc99e Initial load
duke
parents:
diff changeset
396 }
a61af66fc99e Initial load
duke
parents:
diff changeset
397
a61af66fc99e Initial load
duke
parents:
diff changeset
398 inline void oopDesc::set_displaced_mark(markOop m) {
a61af66fc99e Initial load
duke
parents:
diff changeset
399 mark()->set_displaced_mark_helper(m);
a61af66fc99e Initial load
duke
parents:
diff changeset
400 }
a61af66fc99e Initial load
duke
parents:
diff changeset
401
a61af66fc99e Initial load
duke
parents:
diff changeset
402 // The following method needs to be MT safe.
a61af66fc99e Initial load
duke
parents:
diff changeset
403 inline int oopDesc::age() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
404 assert(!is_forwarded(), "Attempt to read age from forwarded mark");
a61af66fc99e Initial load
duke
parents:
diff changeset
405 if (has_displaced_mark()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
406 return displaced_mark()->age();
a61af66fc99e Initial load
duke
parents:
diff changeset
407 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
408 return mark()->age();
a61af66fc99e Initial load
duke
parents:
diff changeset
409 }
a61af66fc99e Initial load
duke
parents:
diff changeset
410 }
a61af66fc99e Initial load
duke
parents:
diff changeset
411
a61af66fc99e Initial load
duke
parents:
diff changeset
412 inline void oopDesc::incr_age() {
a61af66fc99e Initial load
duke
parents:
diff changeset
413 assert(!is_forwarded(), "Attempt to increment age of forwarded mark");
a61af66fc99e Initial load
duke
parents:
diff changeset
414 if (has_displaced_mark()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
415 set_displaced_mark(displaced_mark()->incr_age());
a61af66fc99e Initial load
duke
parents:
diff changeset
416 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
417 set_mark(mark()->incr_age());
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419 }
a61af66fc99e Initial load
duke
parents:
diff changeset
420
a61af66fc99e Initial load
duke
parents:
diff changeset
421
a61af66fc99e Initial load
duke
parents:
diff changeset
422 inline intptr_t oopDesc::identity_hash() {
a61af66fc99e Initial load
duke
parents:
diff changeset
423 // Fast case; if the object is unlocked and the hash value is set, no locking is needed
a61af66fc99e Initial load
duke
parents:
diff changeset
424 // Note: The mark must be read into local variable to avoid concurrent updates.
a61af66fc99e Initial load
duke
parents:
diff changeset
425 markOop mrk = mark();
a61af66fc99e Initial load
duke
parents:
diff changeset
426 if (mrk->is_unlocked() && !mrk->has_no_hash()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
427 return mrk->hash();
a61af66fc99e Initial load
duke
parents:
diff changeset
428 } else if (mrk->is_marked()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
429 return mrk->hash();
a61af66fc99e Initial load
duke
parents:
diff changeset
430 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
431 return slow_identity_hash();
a61af66fc99e Initial load
duke
parents:
diff changeset
432 }
a61af66fc99e Initial load
duke
parents:
diff changeset
433 }
a61af66fc99e Initial load
duke
parents:
diff changeset
434
a61af66fc99e Initial load
duke
parents:
diff changeset
435
a61af66fc99e Initial load
duke
parents:
diff changeset
436 inline void oopDesc::oop_iterate_header(OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
437 blk->do_oop((oop*)&_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
438 }
a61af66fc99e Initial load
duke
parents:
diff changeset
439
a61af66fc99e Initial load
duke
parents:
diff changeset
440
a61af66fc99e Initial load
duke
parents:
diff changeset
441 inline void oopDesc::oop_iterate_header(OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
442 if (mr.contains(&_klass)) blk->do_oop((oop*)&_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
443 }
a61af66fc99e Initial load
duke
parents:
diff changeset
444
a61af66fc99e Initial load
duke
parents:
diff changeset
445
a61af66fc99e Initial load
duke
parents:
diff changeset
446 inline int oopDesc::adjust_pointers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
447 debug_only(int check_size = size());
a61af66fc99e Initial load
duke
parents:
diff changeset
448 int s = blueprint()->oop_adjust_pointers(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
449 assert(s == check_size, "should be the same");
a61af66fc99e Initial load
duke
parents:
diff changeset
450 return s;
a61af66fc99e Initial load
duke
parents:
diff changeset
451 }
a61af66fc99e Initial load
duke
parents:
diff changeset
452
a61af66fc99e Initial load
duke
parents:
diff changeset
453 inline void oopDesc::adjust_header() {
a61af66fc99e Initial load
duke
parents:
diff changeset
454 MarkSweep::adjust_pointer((oop*)&_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
455 }
a61af66fc99e Initial load
duke
parents:
diff changeset
456
a61af66fc99e Initial load
duke
parents:
diff changeset
457 #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
a61af66fc99e Initial load
duke
parents:
diff changeset
458 \
a61af66fc99e Initial load
duke
parents:
diff changeset
459 inline int oopDesc::oop_iterate(OopClosureType* blk) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
460 SpecializationStats::record_call(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
461 return blueprint()->oop_oop_iterate##nv_suffix(this, blk); \
a61af66fc99e Initial load
duke
parents:
diff changeset
462 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
463 \
a61af66fc99e Initial load
duke
parents:
diff changeset
464 inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
465 SpecializationStats::record_call(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
466 return blueprint()->oop_oop_iterate##nv_suffix##_m(this, blk, mr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
467 }
a61af66fc99e Initial load
duke
parents:
diff changeset
468
a61af66fc99e Initial load
duke
parents:
diff changeset
469 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DEFN)
a61af66fc99e Initial load
duke
parents:
diff changeset
470 ALL_OOP_OOP_ITERATE_CLOSURES_3(OOP_ITERATE_DEFN)
a61af66fc99e Initial load
duke
parents:
diff changeset
471
a61af66fc99e Initial load
duke
parents:
diff changeset
472
a61af66fc99e Initial load
duke
parents:
diff changeset
473 inline bool oopDesc::is_shared() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
474 return CompactingPermGenGen::is_shared(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
475 }
a61af66fc99e Initial load
duke
parents:
diff changeset
476
a61af66fc99e Initial load
duke
parents:
diff changeset
477 inline bool oopDesc::is_shared_readonly() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
478 return CompactingPermGenGen::is_shared_readonly(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
479 }
a61af66fc99e Initial load
duke
parents:
diff changeset
480
a61af66fc99e Initial load
duke
parents:
diff changeset
481 inline bool oopDesc::is_shared_readwrite() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
482 return CompactingPermGenGen::is_shared_readwrite(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
483 }