109 oop_desc->klass()->oop_verify_on(oop_desc, st);
110 }
111 }
112
113
114 void oopDesc::verify(oopDesc* oop_desc) {
115 verify_on(tty, oop_desc);
116 }
117
118 intptr_t oopDesc::slow_identity_hash() {
119 // slow case; we have to acquire the micro lock in order to locate the header
120 Thread* current = Thread::current();
121 return ObjectSynchronizer::FastHashCode(current, this);
122 }
123
124 // used only for asserts and guarantees
125 bool oopDesc::is_oop(oop obj) {
126 return Universe::heap()->is_oop(obj);
127 }
128
129 // used only for asserts and guarantees
130 bool oopDesc::is_oop_or_null(oop obj) {
131 return obj == nullptr ? true : is_oop(obj);
132 }
133
134 VerifyOopClosure VerifyOopClosure::verify_oop;
135
136 template <class T> void VerifyOopClosure::do_oop_work(T* p) {
137 oop obj = RawAccess<>::oop_load(p);
138 guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " PTR_FORMAT, p2i(obj));
139 }
140
141 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
142 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }
143
144 // type test operations that doesn't require inclusion of oop.inline.hpp.
145 bool oopDesc::is_instance_noinline() const { return is_instance(); }
146 bool oopDesc::is_instanceRef_noinline() const { return is_instanceRef(); }
147 bool oopDesc::is_stackChunk_noinline() const { return is_stackChunk(); }
148 bool oopDesc::is_array_noinline() const { return is_array(); }
|
109 oop_desc->klass()->oop_verify_on(oop_desc, st);
110 }
111 }
112
113
114 void oopDesc::verify(oopDesc* oop_desc) {
115 verify_on(tty, oop_desc);
116 }
117
118 intptr_t oopDesc::slow_identity_hash() {
119 // slow case; we have to acquire the micro lock in order to locate the header
120 Thread* current = Thread::current();
121 return ObjectSynchronizer::FastHashCode(current, this);
122 }
123
124 // used only for asserts and guarantees
125 bool oopDesc::is_oop(oop obj) {
126 return Universe::heap()->is_oop(obj);
127 }
128
129 markWord oopDesc::initialize_hash_if_necessary(oop obj, Klass* k, markWord m) {
130 assert(UseCompactObjectHeaders, "only with compact object headers");
131 assert(!m.has_displaced_mark_helper(), "must not be displaced header");
132 assert(m.is_hashed_not_expanded(), "must be hashed but not moved");
133 assert(!m.is_hashed_expanded(), "must not be moved: " INTPTR_FORMAT, m.value());
134 uint32_t hash = static_cast<uint32_t>(ObjectSynchronizer::get_next_hash(nullptr, obj));
135 int offset = k->hash_offset_in_bytes(cast_to_oop(this), m);
136 assert(offset >= 4, "hash offset must not be in header");
137 log_develop_trace(gc)("Initializing hash for " PTR_FORMAT ", old: " PTR_FORMAT ", hash: %d, offset: %d, is_mirror: %s", p2i(this), p2i(obj), hash, offset, BOOL_TO_STR(k->is_mirror_instance_klass()));
138 int_field_put(offset, (jint) hash);
139 m = m.set_hashed_expanded();
140 assert(static_cast<uint32_t>(ObjectSynchronizer::get_hash(m, cast_to_oop(this), k)) == hash,
141 "hash must remain the same");
142 assert(m.narrow_klass() != 0, "must not be null");
143 return m;
144 }
145
146 // used only for asserts and guarantees
147 bool oopDesc::is_oop_or_null(oop obj) {
148 return obj == nullptr ? true : is_oop(obj);
149 }
150
151 VerifyOopClosure VerifyOopClosure::verify_oop;
152
153 template <class T> void VerifyOopClosure::do_oop_work(T* p) {
154 oop obj = RawAccess<>::oop_load(p);
155 guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " PTR_FORMAT, p2i(obj));
156 }
157
158 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
159 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }
160
161 // type test operations that doesn't require inclusion of oop.inline.hpp.
162 bool oopDesc::is_instance_noinline() const { return is_instance(); }
163 bool oopDesc::is_instanceRef_noinline() const { return is_instanceRef(); }
164 bool oopDesc::is_stackChunk_noinline() const { return is_stackChunk(); }
165 bool oopDesc::is_array_noinline() const { return is_array(); }
|