< prev index next >

src/share/vm/gc/parallel/psScavenge.inline.hpp

Print this page




  85 typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure;
  86 typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure;
  87 
  88 // Scavenges a single oop in a Klass.
  89 class PSScavengeFromKlassClosure: public OopClosure {
  90  private:
  91   PSPromotionManager* _pm;
  92   // Used to redirty a scanned klass if it has oops
  93   // pointing to the young generation after being scanned.
  94   Klass*             _scanned_klass;
  95  public:
  96   PSScavengeFromKlassClosure(PSPromotionManager* pm) : _pm(pm), _scanned_klass(NULL) { }
  97   void do_oop(narrowOop* p) { ShouldNotReachHere(); }
  98   void do_oop(oop* p)       {
  99     ParallelScavengeHeap* psh = ParallelScavengeHeap::heap();
 100     assert(!psh->is_in_reserved(p), "GC barrier needed");
 101     if (PSScavenge::should_scavenge(p)) {
 102       assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
 103 
 104       oop o = *p;
 105       oop new_obj;
 106       if (o->is_forwarded()) {
 107         new_obj = o->forwardee();
 108       } else {
 109         new_obj = _pm->copy_to_survivor_space</*promote_immediately=*/false>(o);
 110       }

 111       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
 112 
 113       if (PSScavenge::is_obj_in_young(new_obj)) {
 114         do_klass_barrier();
 115       }
 116     }
 117   }
 118 
 119   void set_scanned_klass(Klass* klass) {
 120     assert(_scanned_klass == NULL || klass == NULL, "Should always only handling one klass at a time");
 121     _scanned_klass = klass;
 122   }
 123 
 124  private:
 125   void do_klass_barrier() {
 126     assert(_scanned_klass != NULL, "Should not be called without having a scanned klass");
 127     _scanned_klass->record_modified_oops();
 128   }
 129 
 130 };




  85 typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure;
  86 typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure;
  87 
  88 // Scavenges a single oop in a Klass.
  89 class PSScavengeFromKlassClosure: public OopClosure {
  90  private:
  91   PSPromotionManager* _pm;
  92   // Used to redirty a scanned klass if it has oops
  93   // pointing to the young generation after being scanned.
  94   Klass*             _scanned_klass;
  95  public:
  96   PSScavengeFromKlassClosure(PSPromotionManager* pm) : _pm(pm), _scanned_klass(NULL) { }
  97   void do_oop(narrowOop* p) { ShouldNotReachHere(); }
  98   void do_oop(oop* p)       {
  99     ParallelScavengeHeap* psh = ParallelScavengeHeap::heap();
 100     assert(!psh->is_in_reserved(p), "GC barrier needed");
 101     if (PSScavenge::should_scavenge(p)) {
 102       assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
 103 
 104       oop o = *p;
 105       if (!o->is_forwarded()) {
 106          _pm->copy_to_survivor_space</*promote_immediately=*/false>(o);



 107       }
 108       oop new_obj = o->forwardee();
 109       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
 110 
 111       if (PSScavenge::is_obj_in_young(new_obj)) {
 112         do_klass_barrier();
 113       }
 114     }
 115   }
 116 
 117   void set_scanned_klass(Klass* klass) {
 118     assert(_scanned_klass == NULL || klass == NULL, "Should always only handling one klass at a time");
 119     _scanned_klass = klass;
 120   }
 121 
 122  private:
 123   void do_klass_barrier() {
 124     assert(_scanned_klass != NULL, "Should not be called without having a scanned klass");
 125     _scanned_klass->record_modified_oops();
 126   }
 127 
 128 };


< prev index next >