< prev index next >

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

Print this page

 29 #include "gc/shared/barrierSetNMethod.hpp"
 30 #include "gc/shenandoah/shenandoahAsserts.hpp"
 31 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
 32 #include "gc/shenandoah/shenandoahEvacOOMHandler.inline.hpp"
 33 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 34 #include "gc/shenandoah/shenandoahNMethod.inline.hpp"
 35 #include "oops/compressedOops.inline.hpp"
 36 #include "runtime/atomic.hpp"
 37 #include "runtime/thread.hpp"
 38 
 39 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
 40   _mark_context(ShenandoahHeap::heap()->marking_context()) {
 41 }
 42 
 43 bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
 44   if (CompressedOops::is_null(obj)) {
 45     return false;
 46   }
 47   obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 48   shenandoah_assert_not_forwarded_if(NULL, obj, ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
 49   return _mark_context->is_marked(obj);
 50 }
 51 
 52 ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
 53   _mark_context(ShenandoahHeap::heap()->marking_context()) {
 54 }
 55 
 56 bool ShenandoahIsAliveClosure::do_object_b(oop obj) {
 57   if (CompressedOops::is_null(obj)) {
 58     return false;
 59   }
 60   shenandoah_assert_not_forwarded(NULL, obj);
 61   return _mark_context->is_marked(obj);
 62 }
 63 
 64 BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() {
 65   return ShenandoahHeap::heap()->has_forwarded_objects() ?
 66          reinterpret_cast<BoolObjectClosure*>(&_fwd_alive_cl) :
 67          reinterpret_cast<BoolObjectClosure*>(&_alive_cl);
 68 }
 69 
 70 ShenandoahKeepAliveClosure::ShenandoahKeepAliveClosure() :
 71   _bs(static_cast<ShenandoahBarrierSet*>(BarrierSet::barrier_set())) {
 72 }
 73 
 74 void ShenandoahKeepAliveClosure::do_oop(oop* p) {
 75   do_oop_work(p);
 76 }
 77 
 78 void ShenandoahKeepAliveClosure::do_oop(narrowOop* p) {
 79   do_oop_work(p);
 80 }
 81 
 82 template <typename T>
 83 void ShenandoahKeepAliveClosure::do_oop_work(T* p) {
 84   assert(ShenandoahHeap::heap()->is_concurrent_mark_in_progress(), "Only for concurrent marking phase");
 85   assert(!ShenandoahHeap::heap()->has_forwarded_objects(), "Not expected");
 86 
 87   T o = RawAccess<>::oop_load(p);
 88   if (!CompressedOops::is_null(o)) {
 89     oop obj = CompressedOops::decode_not_null(o);
 90     _bs->enqueue(obj);
 91   }
 92 }
 93 
 94 ShenandoahUpdateRefsClosure::ShenandoahUpdateRefsClosure() :
 95   _heap(ShenandoahHeap::heap()) {
 96 }
 97 
 98 template <class T>
 99 void ShenandoahUpdateRefsClosure::do_oop_work(T* p) {
100   _heap->update_with_forwarded(p);
101 }
102 
103 void ShenandoahUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
104 void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
105 

 29 #include "gc/shared/barrierSetNMethod.hpp"
 30 #include "gc/shenandoah/shenandoahAsserts.hpp"
 31 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
 32 #include "gc/shenandoah/shenandoahEvacOOMHandler.inline.hpp"
 33 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 34 #include "gc/shenandoah/shenandoahNMethod.inline.hpp"
 35 #include "oops/compressedOops.inline.hpp"
 36 #include "runtime/atomic.hpp"
 37 #include "runtime/thread.hpp"
 38 
 39 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
 40   _mark_context(ShenandoahHeap::heap()->marking_context()) {
 41 }
 42 
 43 bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
 44   if (CompressedOops::is_null(obj)) {
 45     return false;
 46   }
 47   obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 48   shenandoah_assert_not_forwarded_if(NULL, obj, ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
 49   return _mark_context->is_marked_or_old(obj);
 50 }
 51 
 52 ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
 53   _mark_context(ShenandoahHeap::heap()->marking_context()) {
 54 }
 55 
 56 bool ShenandoahIsAliveClosure::do_object_b(oop obj) {
 57   if (CompressedOops::is_null(obj)) {
 58     return false;
 59   }
 60   shenandoah_assert_not_forwarded(NULL, obj);
 61   return _mark_context->is_marked_or_old(obj);
 62 }
 63 
 64 BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() {
 65   return ShenandoahHeap::heap()->has_forwarded_objects() ?
 66          reinterpret_cast<BoolObjectClosure*>(&_fwd_alive_cl) :
 67          reinterpret_cast<BoolObjectClosure*>(&_alive_cl);
 68 }
 69 
 70 ShenandoahKeepAliveClosure::ShenandoahKeepAliveClosure() :
 71   _bs(static_cast<ShenandoahBarrierSet*>(BarrierSet::barrier_set())) {
 72 }
 73 
 74 void ShenandoahKeepAliveClosure::do_oop(oop* p) {
 75   do_oop_work(p);
 76 }
 77 
 78 void ShenandoahKeepAliveClosure::do_oop(narrowOop* p) {
 79   do_oop_work(p);
 80 }
 81 
 82 template <typename T>
 83 void ShenandoahKeepAliveClosure::do_oop_work(T* p) {
 84   assert(ShenandoahHeap::heap()->is_concurrent_mark_in_progress(), "Only for concurrent marking phase");
 85   assert(ShenandoahHeap::heap()->is_concurrent_old_mark_in_progress() || !ShenandoahHeap::heap()->has_forwarded_objects(), "Not expected");
 86 
 87   T o = RawAccess<>::oop_load(p);
 88   if (!CompressedOops::is_null(o)) {
 89     oop obj = CompressedOops::decode_not_null(o);
 90     _bs->enqueue(obj);
 91   }
 92 }
 93 
 94 ShenandoahUpdateRefsClosure::ShenandoahUpdateRefsClosure() :
 95   _heap(ShenandoahHeap::heap()) {
 96 }
 97 
 98 template <class T>
 99 void ShenandoahUpdateRefsClosure::do_oop_work(T* p) {
100   _heap->update_with_forwarded(p);
101 }
102 
103 void ShenandoahUpdateRefsClosure::do_oop(oop* p)       { do_oop_work(p); }
104 void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
105 
< prev index next >