src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp

changeset 2060
2d160770d2e5
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Sat Jul 31 15:10:59 2010 +0100
     1.2 +++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Mon Aug 02 12:51:43 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -178,13 +178,14 @@
    1.11  }
    1.12  
    1.13  bool DirtyCardQueueSet::
    1.14 -apply_closure_to_completed_buffer_helper(int worker_i,
    1.15 +apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
    1.16 +                                         int worker_i,
    1.17                                           BufferNode* nd) {
    1.18    if (nd != NULL) {
    1.19      void **buf = BufferNode::make_buffer_from_node(nd);
    1.20      size_t index = nd->index();
    1.21      bool b =
    1.22 -      DirtyCardQueue::apply_closure_to_buffer(_closure, buf,
    1.23 +      DirtyCardQueue::apply_closure_to_buffer(cl, buf,
    1.24                                                index, _sz,
    1.25                                                true, worker_i);
    1.26      if (b) {
    1.27 @@ -199,15 +200,22 @@
    1.28    }
    1.29  }
    1.30  
    1.31 +bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
    1.32 +                                                          int worker_i,
    1.33 +                                                          int stop_at,
    1.34 +                                                          bool during_pause) {
    1.35 +  assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
    1.36 +  BufferNode* nd = get_completed_buffer(stop_at);
    1.37 +  bool res = apply_closure_to_completed_buffer_helper(cl, worker_i, nd);
    1.38 +  if (res) Atomic::inc(&_processed_buffers_rs_thread);
    1.39 +  return res;
    1.40 +}
    1.41 +
    1.42  bool DirtyCardQueueSet::apply_closure_to_completed_buffer(int worker_i,
    1.43                                                            int stop_at,
    1.44 -                                                          bool during_pause)
    1.45 -{
    1.46 -  assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
    1.47 -  BufferNode* nd = get_completed_buffer(stop_at);
    1.48 -  bool res = apply_closure_to_completed_buffer_helper(worker_i, nd);
    1.49 -  if (res) Atomic::inc(&_processed_buffers_rs_thread);
    1.50 -  return res;
    1.51 +                                                          bool during_pause) {
    1.52 +  return apply_closure_to_completed_buffer(_closure, worker_i,
    1.53 +                                           stop_at, during_pause);
    1.54  }
    1.55  
    1.56  void DirtyCardQueueSet::apply_closure_to_all_completed_buffers() {
    1.57 @@ -222,8 +230,8 @@
    1.58    }
    1.59  }
    1.60  
    1.61 -void DirtyCardQueueSet::abandon_logs() {
    1.62 -  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
    1.63 +// Deallocates any completed log buffers
    1.64 +void DirtyCardQueueSet::clear() {
    1.65    BufferNode* buffers_to_delete = NULL;
    1.66    {
    1.67      MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
    1.68 @@ -242,6 +250,12 @@
    1.69      buffers_to_delete = nd->next();
    1.70      deallocate_buffer(BufferNode::make_buffer_from_node(nd));
    1.71    }
    1.72 +
    1.73 +}
    1.74 +
    1.75 +void DirtyCardQueueSet::abandon_logs() {
    1.76 +  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
    1.77 +  clear();
    1.78    // Since abandon is done only at safepoints, we can safely manipulate
    1.79    // these queues.
    1.80    for (JavaThread* t = Threads::first(); t; t = t->next()) {

mercurial