128 }
129 return LockingMode == LM_LIGHTWEIGHT || !SafepointSynchronize::is_at_safepoint();
130 }
131
132 // used only for asserts and guarantees
133 bool oopDesc::is_oop_or_null(oop obj, bool ignore_mark_word) {
134 return obj == nullptr ? true : is_oop(obj, ignore_mark_word);
135 }
136
137 VerifyOopClosure VerifyOopClosure::verify_oop;
138
139 template <class T> void VerifyOopClosure::do_oop_work(T* p) {
140 oop obj = RawAccess<>::oop_load(p);
141 guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " PTR_FORMAT, p2i(obj));
142 }
143
144 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
145 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }
146
147 // type test operations that doesn't require inclusion of oop.inline.hpp.
148 bool oopDesc::is_instance_noinline() const { return is_instance(); }
149 bool oopDesc::is_instanceRef_noinline() const { return is_instanceRef(); }
150 bool oopDesc::is_stackChunk_noinline() const { return is_stackChunk(); }
151 bool oopDesc::is_array_noinline() const { return is_array(); }
152 bool oopDesc::is_objArray_noinline() const { return is_objArray(); }
153 bool oopDesc::is_typeArray_noinline() const { return is_typeArray(); }
154
155 bool oopDesc::has_klass_gap() {
156 // Only has a klass gap when compressed class pointers are used.
157 return UseCompressedClassPointers;
158 }
159
160 #if INCLUDE_CDS_JAVA_HEAP
161 void oopDesc::set_narrow_klass(narrowKlass nk) {
162 assert(CDSConfig::is_dumping_heap(), "Used by CDS only. Do not abuse!");
163 assert(UseCompressedClassPointers, "must be");
164 _metadata._compressed_klass = nk;
165 }
166 #endif
167
168 void* oopDesc::load_oop_raw(oop obj, int offset) {
169 uintptr_t addr = (uintptr_t)(void*)obj + (uint)offset;
170 if (UseCompressedOops) {
171 narrowOop narrow_oop = *(narrowOop*)addr;
172 if (CompressedOops::is_null(narrow_oop)) return nullptr;
173 return (void*)CompressedOops::decode_raw(narrow_oop);
|
128 }
129 return LockingMode == LM_LIGHTWEIGHT || !SafepointSynchronize::is_at_safepoint();
130 }
131
132 // used only for asserts and guarantees
133 bool oopDesc::is_oop_or_null(oop obj, bool ignore_mark_word) {
134 return obj == nullptr ? true : is_oop(obj, ignore_mark_word);
135 }
136
137 VerifyOopClosure VerifyOopClosure::verify_oop;
138
139 template <class T> void VerifyOopClosure::do_oop_work(T* p) {
140 oop obj = RawAccess<>::oop_load(p);
141 guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " PTR_FORMAT, p2i(obj));
142 }
143
144 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
145 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }
146
147 // type test operations that doesn't require inclusion of oop.inline.hpp.
148 bool oopDesc::is_instance_noinline() const { return is_instance(); }
149 bool oopDesc::is_instanceRef_noinline() const { return is_instanceRef(); }
150 bool oopDesc::is_stackChunk_noinline() const { return is_stackChunk(); }
151 bool oopDesc::is_array_noinline() const { return is_array(); }
152 bool oopDesc::is_objArray_noinline() const { return is_objArray(); }
153 bool oopDesc::is_typeArray_noinline() const { return is_typeArray(); }
154 bool oopDesc::is_flatArray_noinline() const { return is_flatArray(); }
155 bool oopDesc::is_null_free_array_noinline() const { return is_null_free_array(); }
156
157 bool oopDesc::has_klass_gap() {
158 // Only has a klass gap when compressed class pointers are used.
159 return UseCompressedClassPointers;
160 }
161
162 #if INCLUDE_CDS_JAVA_HEAP
163 void oopDesc::set_narrow_klass(narrowKlass nk) {
164 assert(CDSConfig::is_dumping_heap(), "Used by CDS only. Do not abuse!");
165 assert(UseCompressedClassPointers, "must be");
166 _metadata._compressed_klass = nk;
167 }
168 #endif
169
170 void* oopDesc::load_oop_raw(oop obj, int offset) {
171 uintptr_t addr = (uintptr_t)(void*)obj + (uint)offset;
172 if (UseCompressedOops) {
173 narrowOop narrow_oop = *(narrowOop*)addr;
174 if (CompressedOops::is_null(narrow_oop)) return nullptr;
175 return (void*)CompressedOops::decode_raw(narrow_oop);
|