< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp

Print this page
rev 59271 : 8240870: Shenandoah: merge evac and update phases
Reviewed-by: XXX


  72 void ShenandoahUpdateRefsClosure::do_oop_work(T* p) {
  73   T o = RawAccess<>::oop_load(p);
  74   if (!CompressedOops::is_null(o)) {
  75     oop obj = CompressedOops::decode_not_null(o);
  76     _heap->update_with_forwarded_not_null(p, obj);
  77   }
  78 }
  79 
  80 void ShenandoahUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
  81 void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
  82 
  83 template <DecoratorSet MO>
  84 ShenandoahEvacuateUpdateRootsClosure<MO>::ShenandoahEvacuateUpdateRootsClosure() :
  85   _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
  86 }
  87 
  88 template <DecoratorSet MO>
  89 template <class T>
  90 void ShenandoahEvacuateUpdateRootsClosure<MO>::do_oop_work(T* p) {
  91   assert(_heap->is_concurrent_weak_root_in_progress() ||
  92          _heap->is_concurrent_strong_root_in_progress(),

  93          "Only do this in root processing phase");
  94 
  95   T o = RawAccess<>::oop_load(p);
  96   if (! CompressedOops::is_null(o)) {
  97     oop obj = CompressedOops::decode_not_null(o);
  98     if (_heap->in_collection_set(obj)) {
  99       assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
 100       shenandoah_assert_marked(p, obj);
 101       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 102       if (resolved == obj) {
 103         resolved = _heap->evacuate_object(obj, _thread);
 104       }
 105       RawAccess<IS_NOT_NULL | MO>::oop_store(p, resolved);
 106     }
 107   }
 108 }
 109 template <DecoratorSet MO>
 110 void ShenandoahEvacuateUpdateRootsClosure<MO>::do_oop(oop* p) {
 111   do_oop_work(p);
 112 }
 113 
 114 template <DecoratorSet MO>
 115 void ShenandoahEvacuateUpdateRootsClosure<MO>::do_oop(narrowOop* p) {
 116   do_oop_work(p);
 117 }
 118 
 119 ShenandoahEvacUpdateOopStorageRootsClosure::ShenandoahEvacUpdateOopStorageRootsClosure() :
 120   _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
 121 }
 122 
 123 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
 124   assert(_heap->is_concurrent_weak_root_in_progress() ||
 125          _heap->is_concurrent_strong_root_in_progress(),
 126          "Only do this in root processing phase");
 127 
 128   oop obj = RawAccess<>::oop_load(p);
 129   if (! CompressedOops::is_null(obj)) {
 130     if (_heap->in_collection_set(obj)) {
 131       assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
 132       shenandoah_assert_marked(p, obj);
 133       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 134       if (resolved == obj) {
 135         resolved = _heap->evacuate_object(obj, _thread);
 136       }
 137 
 138       Atomic::cmpxchg(p, obj, resolved);
 139     }
 140   }
 141 }
 142 
 143 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(narrowOop* p) {
 144   ShouldNotReachHere();
 145 }
 146 
 147 ShenandoahCodeBlobAndDisarmClosure::ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl) :
 148   CodeBlobToOopClosure(cl, true /* fix_relocations */),
 149    _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {
 150 }
 151 
 152 void ShenandoahCodeBlobAndDisarmClosure::do_code_blob(CodeBlob* cb) {
 153   nmethod* const nm = cb->as_nmethod_or_null();
 154   if (nm != NULL && nm->oops_do_try_claim()) {
 155     assert(!ShenandoahNMethod::gc_data(nm)->is_unregistered(), "Should not be here");


  72 void ShenandoahUpdateRefsClosure::do_oop_work(T* p) {
  73   T o = RawAccess<>::oop_load(p);
  74   if (!CompressedOops::is_null(o)) {
  75     oop obj = CompressedOops::decode_not_null(o);
  76     _heap->update_with_forwarded_not_null(p, obj);
  77   }
  78 }
  79 
  80 void ShenandoahUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
  81 void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
  82 
  83 template <DecoratorSet MO>
  84 ShenandoahEvacuateUpdateRootsClosure<MO>::ShenandoahEvacuateUpdateRootsClosure() :
  85   _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
  86 }
  87 
  88 template <DecoratorSet MO>
  89 template <class T>
  90 void ShenandoahEvacuateUpdateRootsClosure<MO>::do_oop_work(T* p) {
  91   assert(_heap->is_concurrent_weak_root_in_progress() ||
  92          _heap->is_concurrent_strong_root_in_progress() ||
  93          _heap->is_degenerated_gc_in_progress(),
  94          "Only do this in root processing phase");
  95 
  96   T o = RawAccess<>::oop_load(p);
  97   if (! CompressedOops::is_null(o)) {
  98     oop obj = CompressedOops::decode_not_null(o);
  99     if (_heap->in_collection_set(obj)) {
 100       assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
 101       shenandoah_assert_marked(p, obj);
 102       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 103       if (resolved == obj) {
 104         resolved = _heap->evacuate_object_recursively(obj, p, _thread);
 105       }
 106       RawAccess<IS_NOT_NULL | MO>::oop_store(p, resolved);
 107     }
 108   }
 109 }
 110 template <DecoratorSet MO>
 111 void ShenandoahEvacuateUpdateRootsClosure<MO>::do_oop(oop* p) {
 112   do_oop_work(p);
 113 }
 114 
 115 template <DecoratorSet MO>
 116 void ShenandoahEvacuateUpdateRootsClosure<MO>::do_oop(narrowOop* p) {
 117   do_oop_work(p);
 118 }
 119 
 120 ShenandoahEvacUpdateOopStorageRootsClosure::ShenandoahEvacUpdateOopStorageRootsClosure() :
 121   _heap(ShenandoahHeap::heap()), _thread(Thread::current()) {
 122 }
 123 
 124 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
 125   assert(_heap->is_concurrent_weak_root_in_progress() ||
 126          _heap->is_concurrent_strong_root_in_progress(),
 127          "Only do this in root processing phase");
 128 
 129   oop obj = RawAccess<>::oop_load(p);
 130   if (! CompressedOops::is_null(obj)) {
 131     if (_heap->in_collection_set(obj)) {
 132       assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
 133       shenandoah_assert_marked(p, obj);
 134       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 135       if (resolved == obj) {
 136         resolved = _heap->evacuate_object_recursively(obj, p, _thread);
 137       }
 138 
 139       Atomic::cmpxchg(p, obj, resolved);
 140     }
 141   }
 142 }
 143 
 144 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(narrowOop* p) {
 145   ShouldNotReachHere();
 146 }
 147 
 148 ShenandoahCodeBlobAndDisarmClosure::ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl) :
 149   CodeBlobToOopClosure(cl, true /* fix_relocations */),
 150    _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {
 151 }
 152 
 153 void ShenandoahCodeBlobAndDisarmClosure::do_code_blob(CodeBlob* cb) {
 154   nmethod* const nm = cb->as_nmethod_or_null();
 155   if (nm != NULL && nm->oops_do_try_claim()) {
 156     assert(!ShenandoahNMethod::gc_data(nm)->is_unregistered(), "Should not be here");
< prev index next >