1 /* 2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 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_INLINE_HPP 26 #define SHARE_VM_OOPS_OOP_INLINE_HPP 27 28 #include "gc/shared/ageTable.hpp" 29 #include "gc/shared/collectedHeap.inline.hpp" 30 #include "gc/shared/genCollectedHeap.hpp" 31 #include "gc/shared/generation.hpp" 32 #include "memory/vtBuffer.hpp" 33 #include "oops/access.inline.hpp" 34 #include "oops/arrayKlass.hpp" 35 #include "oops/arrayOop.hpp" 36 #include "oops/klass.inline.hpp" 37 #include "oops/markOop.inline.hpp" 38 #include "oops/oop.hpp" 39 #include "runtime/atomic.hpp" 40 #include "runtime/orderAccess.inline.hpp" 41 #include "runtime/os.hpp" 42 #include "utilities/align.hpp" 43 #include "utilities/macros.hpp" 44 45 // Implementation of all inlined member functions defined in oop.hpp 46 // We need a separate file to avoid circular references 47 48 void oopDesc::release_set_mark(markOop m) { 49 OrderAccess::release_store(&_mark, m); 50 } 51 52 markOop oopDesc::cas_set_mark(markOop new_mark, markOop old_mark) { 53 return Atomic::cmpxchg(new_mark, &_mark, old_mark); 54 } 55 56 void oopDesc::init_mark() { 57 set_mark(markOopDesc::prototype_for_object(this)); 58 } 59 60 Klass* oopDesc::klass() const { 61 if (UseCompressedClassPointers) { 62 return Klass::decode_klass_not_null(_metadata._compressed_klass); 63 } else { 64 return _metadata._klass; 65 } 66 } 67 68 Klass* oopDesc::klass_or_null() const volatile { 69 if (UseCompressedClassPointers) { 70 return Klass::decode_klass(_metadata._compressed_klass); 71 } else { 72 return _metadata._klass; 73 } 74 } 75 76 Klass* oopDesc::klass_or_null_acquire() const volatile { 77 if (UseCompressedClassPointers) { 78 // Workaround for non-const load_acquire parameter. 79 const volatile narrowKlass* addr = &_metadata._compressed_klass; 80 volatile narrowKlass* xaddr = const_cast<volatile narrowKlass*>(addr); 81 return Klass::decode_klass(OrderAccess::load_acquire(xaddr)); 82 } else { 83 return OrderAccess::load_acquire(&_metadata._klass); 84 } 85 } 86 87 Klass** oopDesc::klass_addr() { 88 // Only used internally and with CMS and will not work with 89 // UseCompressedOops 90 assert(!UseCompressedClassPointers, "only supported with uncompressed klass pointers"); 91 return (Klass**) &_metadata._klass; 92 } 93 94 narrowKlass* oopDesc::compressed_klass_addr() { 95 assert(UseCompressedClassPointers, "only called by compressed klass pointers"); 96 return &_metadata._compressed_klass; 97 } 98 99 // oop only test (does not load klass) 100 bool oopDesc::klass_is_value_type() { 101 if (UseCompressedClassPointers) { 102 return Klass::decode_ptr_is_value_type(_metadata._compressed_klass); 103 } else { 104 return Klass::ptr_is_value_type(_metadata._klass); 105 } 106 } 107 108 109 #define CHECK_SET_KLASS(k) \ 110 do { \ 111 assert(Universe::is_bootstrapping() || k != NULL, "NULL Klass"); \ 112 assert(Universe::is_bootstrapping() || k->is_klass(), "not a Klass"); \ 113 } while (0) 114 115 void oopDesc::set_klass(Klass* k) { 116 CHECK_SET_KLASS(k); 117 if (UseCompressedClassPointers) { 118 *compressed_klass_addr() = Klass::encode_klass_not_null(k); 119 } else { 120 *klass_addr() = k; 121 } 122 } 123 124 void oopDesc::release_set_klass(Klass* k) { 125 CHECK_SET_KLASS(k); 126 if (UseCompressedClassPointers) { 127 OrderAccess::release_store(compressed_klass_addr(), 128 Klass::encode_klass_not_null(k)); 129 } else { 130 OrderAccess::release_store(klass_addr(), k); 131 } 132 } 133 134 #undef CHECK_SET_KLASS 135 136 int oopDesc::klass_gap() const { 137 return *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()); 138 } 139 140 void oopDesc::set_klass_gap(int v) { 141 if (UseCompressedClassPointers) { 142 *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()) = v; 143 } 144 } 145 146 void oopDesc::set_klass_to_list_ptr(oop k) { 147 // This is only to be used during GC, for from-space objects, so no 148 // barrier is needed. 149 if (UseCompressedClassPointers) { 150 _metadata._compressed_klass = (narrowKlass)encode_heap_oop(k); // may be null (parnew overflow handling) 151 } else { 152 _metadata._klass = (Klass*)(address)k; 153 } 154 } 155 156 oop oopDesc::list_ptr_from_klass() { 157 // This is only to be used during GC, for from-space objects. 158 if (UseCompressedClassPointers) { 159 return decode_heap_oop((narrowOop)_metadata._compressed_klass); 160 } else { 161 // Special case for GC 162 return (oop)(address)_metadata._klass; 163 } 164 } 165 166 bool oopDesc::is_a(Klass* k) const { 167 return klass()->is_subtype_of(k); 168 } 169 170 int oopDesc::size() { 171 return size_given_klass(klass()); 172 } 173 174 int oopDesc::size_given_klass(Klass* klass) { 175 int lh = klass->layout_helper(); 176 int s; 177 178 // lh is now a value computed at class initialization that may hint 179 // at the size. For instances, this is positive and equal to the 180 // size. For arrays, this is negative and provides log2 of the 181 // array element size. For other oops, it is zero and thus requires 182 // a virtual call. 183 // 184 // We go to all this trouble because the size computation is at the 185 // heart of phase 2 of mark-compaction, and called for every object, 186 // alive or dead. So the speed here is equal in importance to the 187 // speed of allocation. 188 189 if (lh > Klass::_lh_neutral_value) { 190 if (!Klass::layout_helper_needs_slow_path(lh)) { 191 s = lh >> LogHeapWordSize; // deliver size scaled by wordSize 192 } else { 193 s = klass->oop_size(this); 194 } 195 } else if (lh <= Klass::_lh_neutral_value) { 196 // The most common case is instances; fall through if so. 197 if (lh < Klass::_lh_neutral_value) { 198 // Second most common case is arrays. We have to fetch the 199 // length of the array, shift (multiply) it appropriately, 200 // up to wordSize, add the header, and align to object size. 201 size_t size_in_bytes; 202 size_t array_length = (size_t) ((arrayOop)this)->length(); 203 size_in_bytes = array_length << Klass::layout_helper_log2_element_size(lh); 204 size_in_bytes += Klass::layout_helper_header_size(lh); 205 206 // This code could be simplified, but by keeping array_header_in_bytes 207 // in units of bytes and doing it this way we can round up just once, 208 // skipping the intermediate round to HeapWordSize. 209 s = (int)(align_up(size_in_bytes, MinObjAlignmentInBytes) / HeapWordSize); 210 211 // ParNew (used by CMS), UseParallelGC and UseG1GC can change the length field 212 // of an "old copy" of an object array in the young gen so it indicates 213 // the grey portion of an already copied array. This will cause the first 214 // disjunct below to fail if the two comparands are computed across such 215 // a concurrent change. 216 // ParNew also runs with promotion labs (which look like int 217 // filler arrays) which are subject to changing their declared size 218 // when finally retiring a PLAB; this also can cause the first disjunct 219 // to fail for another worker thread that is concurrently walking the block 220 // offset table. Both these invariant failures are benign for their 221 // current uses; we relax the assertion checking to cover these two cases below: 222 // is_objArray() && is_forwarded() // covers first scenario above 223 // || is_typeArray() // covers second scenario above 224 // If and when UseParallelGC uses the same obj array oop stealing/chunking 225 // technique, we will need to suitably modify the assertion. 226 assert((s == klass->oop_size(this)) || 227 (Universe::heap()->is_gc_active() && 228 ((is_typeArray() && UseConcMarkSweepGC) || 229 (is_objArray() && is_forwarded() && (UseConcMarkSweepGC || UseParallelGC || UseG1GC)))), 230 "wrong array object size"); 231 } else { 232 // Must be zero, so bite the bullet and take the virtual call. 233 s = klass->oop_size(this); 234 } 235 } 236 237 assert(s > 0, "Oop size must be greater than zero, not %d", s); 238 assert(is_object_aligned(s), "Oop size is not properly aligned: %d", s); 239 return s; 240 } 241 242 bool oopDesc::is_instance() const { return klass()->is_instance_klass(); } 243 bool oopDesc::is_array() const { return klass()->is_array_klass(); } 244 bool oopDesc::is_objArray() const { return klass()->is_objArray_klass(); } 245 bool oopDesc::is_typeArray() const { return klass()->is_typeArray_klass(); } 246 bool oopDesc::is_value() const { return klass()->is_value(); } 247 bool oopDesc::is_valueArray() const { return klass()->is_valueArray_klass(); } 248 249 void* oopDesc::field_addr_raw(int offset) const { return reinterpret_cast<void*>(cast_from_oop<intptr_t>(as_oop()) + offset); } 250 void* oopDesc::field_addr(int offset) const { return Access<>::resolve(as_oop())->field_addr_raw(offset); } 251 252 template <class T> 253 T* oopDesc::obj_field_addr_raw(int offset) const { return (T*) field_addr_raw(offset); } 254 255 // Functions for getting and setting oops within instance objects. 256 // If the oops are compressed, the type passed to these overloaded functions 257 // is narrowOop. All functions are overloaded so they can be called by 258 // template functions without conditionals (the compiler instantiates via 259 // the right type and inlines the appopriate code). 260 261 // Algorithm for encoding and decoding oops from 64 bit pointers to 32 bit 262 // offset from the heap base. Saving the check for null can save instructions 263 // in inner GC loops so these are separated. 264 265 inline bool check_obj_alignment(oop obj) { 266 return (cast_from_oop<intptr_t>(obj) & MinObjAlignmentInBytesMask) == 0; 267 } 268 269 oop oopDesc::decode_heap_oop_not_null(narrowOop v) { 270 assert(!is_null(v), "narrow oop value can never be zero"); 271 address base = Universe::narrow_oop_base(); 272 int shift = Universe::narrow_oop_shift(); 273 oop result = (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift)); 274 assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result)); 275 return result; 276 } 277 278 oop oopDesc::decode_heap_oop(narrowOop v) { 279 return is_null(v) ? (oop)NULL : decode_heap_oop_not_null(v); 280 } 281 282 narrowOop oopDesc::encode_heap_oop_not_null(oop v) { 283 assert(!is_null(v), "oop value can never be zero"); 284 assert(check_obj_alignment(v), "Address not aligned"); 285 assert(Universe::heap()->is_in_reserved(v), "Address not in heap"); 286 address base = Universe::narrow_oop_base(); 287 int shift = Universe::narrow_oop_shift(); 288 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1)); 289 assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); 290 uint64_t result = pd >> shift; 291 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow"); 292 assert(decode_heap_oop(result) == v, "reversibility"); 293 return (narrowOop)result; 294 } 295 296 narrowOop oopDesc::encode_heap_oop(oop v) { 297 return (is_null(v)) ? (narrowOop)0 : encode_heap_oop_not_null(v); 298 } 299 300 narrowOop oopDesc::load_heap_oop(narrowOop* p) { return *p; } 301 oop oopDesc::load_heap_oop(oop* p) { return *p; } 302 303 void oopDesc::store_heap_oop(narrowOop* p, narrowOop v) { *p = v; } 304 void oopDesc::store_heap_oop(oop* p, oop v) { *p = v; } 305 306 // Load and decode an oop out of the Java heap into a wide oop. 307 oop oopDesc::load_decode_heap_oop_not_null(narrowOop* p) { 308 return decode_heap_oop_not_null(load_heap_oop(p)); 309 } 310 311 // Load and decode an oop out of the heap accepting null 312 oop oopDesc::load_decode_heap_oop(narrowOop* p) { 313 return decode_heap_oop(load_heap_oop(p)); 314 } 315 316 oop oopDesc::load_decode_heap_oop_not_null(oop* p) { return *p; } 317 oop oopDesc::load_decode_heap_oop(oop* p) { return *p; } 318 319 void oopDesc::encode_store_heap_oop_not_null(oop* p, oop v) { *p = v; } 320 void oopDesc::encode_store_heap_oop(oop* p, oop v) { *p = v; } 321 322 // Encode and store a heap oop. 323 void oopDesc::encode_store_heap_oop_not_null(narrowOop* p, oop v) { 324 *p = encode_heap_oop_not_null(v); 325 } 326 327 // Encode and store a heap oop allowing for null. 328 void oopDesc::encode_store_heap_oop(narrowOop* p, oop v) { 329 *p = encode_heap_oop(v); 330 } 331 332 template <DecoratorSet decorators> 333 inline oop oopDesc::obj_field_access(int offset) const { return HeapAccess<decorators>::oop_load_at(as_oop(), offset); } 334 inline oop oopDesc::obj_field(int offset) const { return HeapAccess<>::oop_load_at(as_oop(), offset); } 335 336 inline void oopDesc::obj_field_put(int offset, oop value) { HeapAccess<>::oop_store_at(as_oop(), offset, value); } 337 338 inline jbyte oopDesc::byte_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 339 inline void oopDesc::byte_field_put(int offset, jbyte value) { HeapAccess<>::store_at(as_oop(), offset, value); } 340 341 inline jchar oopDesc::char_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 342 inline void oopDesc::char_field_put(int offset, jchar value) { HeapAccess<>::store_at(as_oop(), offset, value); } 343 344 inline jboolean oopDesc::bool_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 345 inline void oopDesc::bool_field_put(int offset, jboolean value) { HeapAccess<>::store_at(as_oop(), offset, jboolean(value & 1)); } 346 347 inline jshort oopDesc::short_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 348 inline void oopDesc::short_field_put(int offset, jshort value) { HeapAccess<>::store_at(as_oop(), offset, value); } 349 350 inline jint oopDesc::int_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 351 inline void oopDesc::int_field_put(int offset, jint value) { HeapAccess<>::store_at(as_oop(), offset, value); } 352 353 inline jlong oopDesc::long_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 354 inline void oopDesc::long_field_put(int offset, jlong value) { HeapAccess<>::store_at(as_oop(), offset, value); } 355 356 inline jfloat oopDesc::float_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 357 inline void oopDesc::float_field_put(int offset, jfloat value) { HeapAccess<>::store_at(as_oop(), offset, value); } 358 359 inline jdouble oopDesc::double_field(int offset) const { return HeapAccess<>::load_at(as_oop(), offset); } 360 inline void oopDesc::double_field_put(int offset, jdouble value) { HeapAccess<>::store_at(as_oop(), offset, value); } 361 362 bool oopDesc::is_locked() const { 363 return mark()->is_locked(); 364 } 365 366 bool oopDesc::is_unlocked() const { 367 return mark()->is_unlocked(); 368 } 369 370 bool oopDesc::has_bias_pattern() const { 371 return mark()->has_bias_pattern(); 372 } 373 374 375 // Used only for markSweep, scavenging 376 bool oopDesc::is_gc_marked() const { 377 return mark()->is_marked(); 378 } 379 380 bool oopDesc::is_scavengable() const { 381 return Universe::heap()->is_scavengable(oop(const_cast<oopDesc*>(this))); 382 } 383 384 // Used by scavengers 385 bool oopDesc::is_forwarded() const { 386 // The extra heap check is needed since the obj might be locked, in which case the 387 // mark would point to a stack location and have the sentinel bit cleared 388 return mark()->is_marked(); 389 } 390 391 // Used by scavengers 392 void oopDesc::forward_to(oop p) { 393 assert(check_obj_alignment(p), 394 "forwarding to something not aligned"); 395 assert(Universe::heap()->is_in_reserved(p), 396 "forwarding to something not in heap"); 397 assert(!is_archive_object(oop(this)) && 398 !is_archive_object(p), 399 "forwarding archive object"); 400 markOop m = markOopDesc::encode_pointer_as_mark(p); 401 assert(m->decode_pointer() == p, "encoding must be reversable"); 402 set_mark(m); 403 } 404 405 // Used by parallel scavengers 406 bool oopDesc::cas_forward_to(oop p, markOop compare) { 407 assert(check_obj_alignment(p), 408 "forwarding to something not aligned"); 409 assert(Universe::heap()->is_in_reserved(p), 410 "forwarding to something not in heap"); 411 markOop m = markOopDesc::encode_pointer_as_mark(p); 412 assert(m->decode_pointer() == p, "encoding must be reversable"); 413 return cas_set_mark(m, compare) == compare; 414 } 415 416 #if INCLUDE_ALL_GCS 417 oop oopDesc::forward_to_atomic(oop p) { 418 markOop oldMark = mark(); 419 markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p); 420 markOop curMark; 421 422 assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable"); 423 assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this."); 424 425 while (!oldMark->is_marked()) { 426 curMark = Atomic::cmpxchg(forwardPtrMark, &_mark, oldMark); 427 assert(is_forwarded(), "object should have been forwarded"); 428 if (curMark == oldMark) { 429 return NULL; 430 } 431 // If the CAS was unsuccessful then curMark->is_marked() 432 // should return true as another thread has CAS'd in another 433 // forwarding pointer. 434 oldMark = curMark; 435 } 436 return forwardee(); 437 } 438 #endif 439 440 // Note that the forwardee is not the same thing as the displaced_mark. 441 // The forwardee is used when copying during scavenge and mark-sweep. 442 // It does need to clear the low two locking- and GC-related bits. 443 oop oopDesc::forwardee() const { 444 return (oop) mark()->decode_pointer(); 445 } 446 447 // The following method needs to be MT safe. 448 uint oopDesc::age() const { 449 assert(!is_forwarded(), "Attempt to read age from forwarded mark"); 450 if (has_displaced_mark()) { 451 return displaced_mark()->age(); 452 } else { 453 return mark()->age(); 454 } 455 } 456 457 void oopDesc::incr_age() { 458 assert(!is_forwarded(), "Attempt to increment age of forwarded mark"); 459 if (has_displaced_mark()) { 460 set_displaced_mark(displaced_mark()->incr_age()); 461 } else { 462 set_mark(mark()->incr_age()); 463 } 464 } 465 466 #if INCLUDE_ALL_GCS 467 void oopDesc::pc_follow_contents(ParCompactionManager* cm) { 468 klass()->oop_pc_follow_contents(this, cm); 469 } 470 471 void oopDesc::pc_update_contents(ParCompactionManager* cm) { 472 Klass* k = klass(); 473 if (!k->is_typeArray_klass()) { 474 // It might contain oops beyond the header, so take the virtual call. 475 k->oop_pc_update_pointers(this, cm); 476 } 477 // Else skip it. The TypeArrayKlass in the header never needs scavenging. 478 } 479 480 void oopDesc::ps_push_contents(PSPromotionManager* pm) { 481 Klass* k = klass(); 482 if (!k->is_typeArray_klass()) { 483 // It might contain oops beyond the header, so take the virtual call. 484 k->oop_ps_push_contents(this, pm); 485 } 486 // Else skip it. The TypeArrayKlass in the header never needs scavenging. 487 } 488 #endif // INCLUDE_ALL_GCS 489 490 #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ 491 \ 492 void oopDesc::oop_iterate(OopClosureType* blk) { \ 493 klass()->oop_oop_iterate##nv_suffix(this, blk); \ 494 } \ 495 \ 496 void oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \ 497 klass()->oop_oop_iterate_bounded##nv_suffix(this, blk, mr); \ 498 } 499 500 #define OOP_ITERATE_SIZE_DEFN(OopClosureType, nv_suffix) \ 501 \ 502 int oopDesc::oop_iterate_size(OopClosureType* blk) { \ 503 Klass* k = klass(); \ 504 int size = size_given_klass(k); \ 505 k->oop_oop_iterate##nv_suffix(this, blk); \ 506 return size; \ 507 } \ 508 \ 509 int oopDesc::oop_iterate_size(OopClosureType* blk, MemRegion mr) { \ 510 Klass* k = klass(); \ 511 int size = size_given_klass(k); \ 512 k->oop_oop_iterate_bounded##nv_suffix(this, blk, mr); \ 513 return size; \ 514 } 515 516 int oopDesc::oop_iterate_no_header(OopClosure* blk) { 517 // The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all 518 // the do_oop calls, but turns off all other features in ExtendedOopClosure. 519 NoHeaderExtendedOopClosure cl(blk); 520 return oop_iterate_size(&cl); 521 } 522 523 int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) { 524 NoHeaderExtendedOopClosure cl(blk); 525 return oop_iterate_size(&cl, mr); 526 } 527 528 #if INCLUDE_ALL_GCS 529 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ 530 \ 531 inline void oopDesc::oop_iterate_backwards(OopClosureType* blk) { \ 532 klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \ 533 } 534 #else 535 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) 536 #endif // INCLUDE_ALL_GCS 537 538 #define ALL_OOPDESC_OOP_ITERATE(OopClosureType, nv_suffix) \ 539 OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ 540 OOP_ITERATE_SIZE_DEFN(OopClosureType, nv_suffix) \ 541 OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) 542 543 ALL_OOP_OOP_ITERATE_CLOSURES_1(ALL_OOPDESC_OOP_ITERATE) 544 ALL_OOP_OOP_ITERATE_CLOSURES_2(ALL_OOPDESC_OOP_ITERATE) 545 546 intptr_t oopDesc::identity_hash() { 547 // Fast case; if the object is unlocked and the hash value is set, no locking is needed 548 // Note: The mark must be read into local variable to avoid concurrent updates. 549 markOop mrk = mark(); 550 if (mrk->is_unlocked() && !mrk->has_no_hash()) { 551 return mrk->hash(); 552 } else if (mrk->is_marked()) { 553 return mrk->hash(); 554 } else { 555 return slow_identity_hash(); 556 } 557 } 558 559 bool oopDesc::has_displaced_mark() const { 560 return mark()->has_displaced_mark_helper(); 561 } 562 563 markOop oopDesc::displaced_mark() const { 564 return mark()->displaced_mark_helper(); 565 } 566 567 void oopDesc::set_displaced_mark(markOop m) { 568 mark()->set_displaced_mark_helper(m); 569 } 570 571 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP