< prev index next >

src/share/vm/oops/oop.inline.hpp

Print this page




  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/barrierSet.inline.hpp"
  30 #include "gc/shared/cardTableModRefBS.hpp"
  31 #include "gc/shared/collectedHeap.inline.hpp"
  32 #include "gc/shared/genCollectedHeap.hpp"
  33 #include "gc/shared/generation.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/macros.hpp"
  43 
  44 inline void update_barrier_set(void* p, oop v, bool release = false) {
  45   assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!");
  46   oopDesc::bs()->write_ref_field(p, v, release);
  47 }
  48 
  49 template <class T> inline void update_barrier_set_pre(T* p, oop v) {
  50   oopDesc::bs()->write_ref_field_pre(p, v);
  51 }
  52 
  53 template <class T> void oop_store(T* p, oop v) {


 530 
 531 address oopDesc::address_field_acquire(int offset) const              { return (address) OrderAccess::load_ptr_acquire(address_field_addr(offset)); }
 532 void oopDesc::release_address_field_put(int offset, address contents) { OrderAccess::release_store_ptr(address_field_addr(offset), contents); }
 533 
 534 bool oopDesc::is_locked() const {
 535   return mark()->is_locked();
 536 }
 537 
 538 bool oopDesc::is_unlocked() const {
 539   return mark()->is_unlocked();
 540 }
 541 
 542 bool oopDesc::has_bias_pattern() const {
 543   return mark()->has_bias_pattern();
 544 }
 545 
 546 // used only for asserts
 547 bool oopDesc::is_oop(bool ignore_mark_word) const {
 548   oop obj = (oop) this;
 549   if (!check_obj_alignment(obj)) return false;
 550   if (!Universe::heap()->is_in_reserved(obj)) return false;





 551   // obj is aligned and accessible in heap
 552   if (Universe::heap()->is_in_reserved(obj->klass_or_null())) return false;
 553 
 554   // Header verification: the mark is typically non-NULL. If we're
 555   // at a safepoint, it must not be null.
 556   // Outside of a safepoint, the header could be changing (for example,
 557   // another thread could be inflating a lock on this object).
 558   if (ignore_mark_word) {
 559     return true;
 560   }
 561   if (mark() != NULL) {
 562     return true;
 563   }
 564   return !SafepointSynchronize::is_at_safepoint();

 565 }
 566 
 567 
 568 // used only for asserts
 569 bool oopDesc::is_oop_or_null(bool ignore_mark_word) const {
 570   return this == NULL ? true : is_oop(ignore_mark_word);
 571 }
 572 
 573 #ifndef PRODUCT
 574 // used only for asserts
 575 bool oopDesc::is_unlocked_oop() const {
 576   if (!Universe::heap()->is_in_reserved(this)) return false;
 577   return mark()->is_unlocked();
 578 }
 579 #endif // PRODUCT
 580 
 581 // Used only for markSweep, scavenging
 582 bool oopDesc::is_gc_marked() const {
 583   return mark()->is_marked();
 584 }




  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/barrierSet.inline.hpp"
  30 #include "gc/shared/cardTableModRefBS.hpp"
  31 #include "gc/shared/collectedHeap.inline.hpp"
  32 #include "gc/shared/genCollectedHeap.hpp"
  33 #include "gc/shared/generation.hpp"
  34 #include "memory/vtBuffer.hpp"
  35 #include "oops/arrayKlass.hpp"
  36 #include "oops/arrayOop.hpp"
  37 #include "oops/klass.inline.hpp"
  38 #include "oops/markOop.inline.hpp"
  39 #include "oops/oop.hpp"
  40 #include "runtime/atomic.hpp"
  41 #include "runtime/orderAccess.inline.hpp"
  42 #include "runtime/os.hpp"
  43 #include "utilities/macros.hpp"
  44 
  45 inline void update_barrier_set(void* p, oop v, bool release = false) {
  46   assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!");
  47   oopDesc::bs()->write_ref_field(p, v, release);
  48 }
  49 
  50 template <class T> inline void update_barrier_set_pre(T* p, oop v) {
  51   oopDesc::bs()->write_ref_field_pre(p, v);
  52 }
  53 
  54 template <class T> void oop_store(T* p, oop v) {


 531 
 532 address oopDesc::address_field_acquire(int offset) const              { return (address) OrderAccess::load_ptr_acquire(address_field_addr(offset)); }
 533 void oopDesc::release_address_field_put(int offset, address contents) { OrderAccess::release_store_ptr(address_field_addr(offset), contents); }
 534 
 535 bool oopDesc::is_locked() const {
 536   return mark()->is_locked();
 537 }
 538 
 539 bool oopDesc::is_unlocked() const {
 540   return mark()->is_unlocked();
 541 }
 542 
 543 bool oopDesc::has_bias_pattern() const {
 544   return mark()->has_bias_pattern();
 545 }
 546 
 547 // used only for asserts
 548 bool oopDesc::is_oop(bool ignore_mark_word) const {
 549   oop obj = (oop) this;
 550   if (!check_obj_alignment(obj)) return false;
 551   if (!Universe::heap()->is_in_reserved(obj)) {
 552     assert(obj->klass()->is_value(), "Only value type can be outside of the Java heap");
 553     VTBufferChunk* chunk = VTBufferChunk::chunk(obj);
 554     assert(chunk->is_valid(), "if not in the heap, should a buffered VT");
 555     if (!VTBuffer::is_in_vt_buffer(obj)) return false;
 556   }
 557   // obj is aligned and accessible in heap
 558   if (Universe::heap()->is_in_reserved(obj->klass_or_null())) return false;
 559 
 560   // Header verification: the mark is typically non-NULL. If we're
 561   // at a safepoint, it must not be null.
 562   // Outside of a safepoint, the header could be changing (for example,
 563   // another thread could be inflating a lock on this object).
 564   if (ignore_mark_word) {
 565     return true;
 566   }
 567   if (mark() != NULL) {
 568     return true;
 569   }
 570   return !SafepointSynchronize::is_at_safepoint()
 571     || (obj->klass()->is_value() && !Universe::heap()->is_in_reserved(obj)) ;
 572 }
 573 
 574 
 575 // used only for asserts
 576 bool oopDesc::is_oop_or_null(bool ignore_mark_word) const {
 577   return this == NULL ? true : is_oop(ignore_mark_word);
 578 }
 579 
 580 #ifndef PRODUCT
 581 // used only for asserts
 582 bool oopDesc::is_unlocked_oop() const {
 583   if (!Universe::heap()->is_in_reserved(this)) return false;
 584   return mark()->is_unlocked();
 585 }
 586 #endif // PRODUCT
 587 
 588 // Used only for markSweep, scavenging
 589 bool oopDesc::is_gc_marked() const {
 590   return mark()->is_marked();
 591 }


< prev index next >