< prev index next >

src/hotspot/share/gc/serial/markSweep.cpp

Print this page
@@ -60,11 +60,10 @@
  
  MarkSweep::FollowRootClosure  MarkSweep::follow_root_closure;
  
  MarkAndPushClosure MarkSweep::mark_and_push_closure;
  CLDToOopClosure    MarkSweep::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
- CLDToOopClosure    MarkSweep::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_strong);
  
  template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
    mark_and_push(p);
  }
  

@@ -142,12 +141,13 @@
  }
  
  void MarkSweep::FollowRootClosure::do_oop(oop* p)       { follow_root(p); }
  void MarkSweep::FollowRootClosure::do_oop(narrowOop* p) { follow_root(p); }
  
+ template <bool ALT_FWD>
  void PreservedMark::adjust_pointer() {
-   MarkSweep::adjust_pointer(&_obj);
+   MarkSweep::adjust_pointer<ALT_FWD>(&_obj);
  }
  
  void PreservedMark::restore() {
    _obj->set_mark(_mark);
  }

@@ -171,26 +171,33 @@
  void MarkSweep::set_ref_processor(ReferenceProcessor* rp) {
    _ref_processor = rp;
    mark_and_push_closure.set_ref_discoverer(_ref_processor);
  }
  
- AdjustPointerClosure MarkSweep::adjust_pointer_closure;
- 
- void MarkSweep::adjust_marks() {
+ template <bool ALT_FWD>
+ void MarkSweep::adjust_marks_impl() {
    assert( _preserved_oop_stack.size() == _preserved_mark_stack.size(),
           "inconsistent preserved oop stacks");
  
    // adjust the oops we saved earlier
    for (size_t i = 0; i < _preserved_count; i++) {
-     _preserved_marks[i].adjust_pointer();
+     _preserved_marks[i].adjust_pointer<ALT_FWD>();
    }
  
    // deal with the overflow stack
    StackIterator<oop, mtGC> iter(_preserved_oop_stack);
    while (!iter.is_empty()) {
      oop* p = iter.next_addr();
-     adjust_pointer(p);
+     adjust_pointer<ALT_FWD>(p);
+   }
+ }
+ 
+ void MarkSweep::adjust_marks() {
+   if (UseAltGCForwarding) {
+     adjust_marks_impl<true>();
+   } else {
+     adjust_marks_impl<false>();
    }
  }
  
  void MarkSweep::restore_marks() {
    assert(_preserved_oop_stack.size() == _preserved_mark_stack.size(),
< prev index next >