< prev index next >

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

Print this page




  37 
  38 inline void oopDesc::update_contents(ParCompactionManager* cm) {
  39   // The klass field must be updated before anything else
  40   // can be done.
  41   DEBUG_ONLY(Klass* original_klass = klass());
  42 
  43   Klass* new_klass = klass();
  44   if (!new_klass->oop_is_typeArray()) {
  45     // It might contain oops beyond the header, so take the virtual call.
  46     new_klass->oop_update_pointers(cm, this);
  47   }
  48   // Else skip it.  The TypeArrayKlass in the header never needs scavenging.
  49 }
  50 
  51 inline void oopDesc::follow_contents(ParCompactionManager* cm) {
  52   assert (PSParallelCompact::mark_bitmap()->is_marked(this),
  53     "should be marked");
  54   klass()->oop_follow_contents(cm, this);
  55 }
  56 
  57 inline oop oopDesc::forward_to_atomic(oop p) {
  58   assert(ParNewGeneration::is_legal_forward_ptr(p),
  59          "illegal forwarding pointer value.");
  60   markOop oldMark = mark();
  61   markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
  62   markOop curMark;
  63 
  64   assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable");
  65   assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
  66 
  67   while (!oldMark->is_marked()) {
  68     curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark);
  69     assert(is_forwarded(), "object should have been forwarded");
  70     if (curMark == oldMark) {
  71       return NULL;
  72     }
  73     // If the CAS was unsuccessful then curMark->is_marked()
  74     // should return true as another thread has CAS'd in another
  75     // forwarding pointer.
  76     oldMark = curMark;
  77   }
  78   return forwardee();
  79 }
  80 
  81 #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP


  37 
  38 inline void oopDesc::update_contents(ParCompactionManager* cm) {
  39   // The klass field must be updated before anything else
  40   // can be done.
  41   DEBUG_ONLY(Klass* original_klass = klass());
  42 
  43   Klass* new_klass = klass();
  44   if (!new_klass->oop_is_typeArray()) {
  45     // It might contain oops beyond the header, so take the virtual call.
  46     new_klass->oop_update_pointers(cm, this);
  47   }
  48   // Else skip it.  The TypeArrayKlass in the header never needs scavenging.
  49 }
  50 
  51 inline void oopDesc::follow_contents(ParCompactionManager* cm) {
  52   assert (PSParallelCompact::mark_bitmap()->is_marked(this),
  53     "should be marked");
  54   klass()->oop_follow_contents(cm, this);
  55 }
  56 
























  57 #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
< prev index next >