src/share/vm/gc_implementation/g1/concurrentMark.hpp

changeset 1793
72f725c5a7be
parent 1746
2a1472c30599
child 1823
7666957bc44d
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Apr 02 12:10:08 2010 -0400
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Apr 05 12:19:22 2010 -0400
     1.3 @@ -252,9 +252,19 @@
     1.4    // with other "push" operations (no pops).
     1.5    void push(MemRegion mr);
     1.6  
     1.7 +#if 0
     1.8 +  // This is currently not used. See the comment in the .cpp file.
     1.9 +
    1.10    // Lock-free; assumes that it will only be called in parallel
    1.11    // with other "pop" operations (no pushes).
    1.12    MemRegion pop();
    1.13 +#endif // 0
    1.14 +
    1.15 +  // These two are the implementations that use a lock. They can be
    1.16 +  // called concurrently with each other but they should not be called
    1.17 +  // concurrently with the lock-free versions (push() / pop()).
    1.18 +  void push_with_lock(MemRegion mr);
    1.19 +  MemRegion pop_with_lock();
    1.20  
    1.21    bool isEmpty()    { return _index == 0; }
    1.22    bool isFull()     { return _index == _capacity; }
    1.23 @@ -540,6 +550,10 @@
    1.24  
    1.25    // Manipulation of the region stack
    1.26    bool region_stack_push(MemRegion mr) {
    1.27 +    // Currently we only call the lock-free version during evacuation
    1.28 +    // pauses.
    1.29 +    assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
    1.30 +
    1.31      _regionStack.push(mr);
    1.32      if (_regionStack.overflow()) {
    1.33        set_has_overflown();
    1.34 @@ -547,7 +561,33 @@
    1.35      }
    1.36      return true;
    1.37    }
    1.38 -  MemRegion region_stack_pop()          { return _regionStack.pop(); }
    1.39 +#if 0
    1.40 +  // Currently this is not used. See the comment in the .cpp file.
    1.41 +  MemRegion region_stack_pop() { return _regionStack.pop(); }
    1.42 +#endif // 0
    1.43 +
    1.44 +  bool region_stack_push_with_lock(MemRegion mr) {
    1.45 +    // Currently we only call the lock-based version during either
    1.46 +    // concurrent marking or remark.
    1.47 +    assert(!SafepointSynchronize::is_at_safepoint() || !concurrent(),
    1.48 +           "if we are at a safepoint it should be the remark safepoint");
    1.49 +
    1.50 +    _regionStack.push_with_lock(mr);
    1.51 +    if (_regionStack.overflow()) {
    1.52 +      set_has_overflown();
    1.53 +      return false;
    1.54 +    }
    1.55 +    return true;
    1.56 +  }
    1.57 +  MemRegion region_stack_pop_with_lock() {
    1.58 +    // Currently we only call the lock-based version during either
    1.59 +    // concurrent marking or remark.
    1.60 +    assert(!SafepointSynchronize::is_at_safepoint() || !concurrent(),
    1.61 +           "if we are at a safepoint it should be the remark safepoint");
    1.62 +
    1.63 +    return _regionStack.pop_with_lock();
    1.64 +  }
    1.65 +
    1.66    int region_stack_size()               { return _regionStack.size(); }
    1.67    bool region_stack_overflow()          { return _regionStack.overflow(); }
    1.68    bool region_stack_empty()             { return _regionStack.isEmpty(); }

mercurial