8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
authorkbarrett
Wed, 17 Feb 2016 16:00:27 -0500
changeset 36179 03a0d7b8450f
parent 36177 b2b76aba8e42
child 36180 bf3fb9bcb8b3
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful Summary: Merge helper into sole caller. Reviewed-by: brutisso, jwilhelm, tschatzl
hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp
hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp
hotspot/src/share/vm/gc/g1/dirtyCardQueue.hpp
--- a/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp	Tue Feb 16 13:20:38 2016 -0800
+++ b/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp	Wed Feb 17 16:00:27 2016 -0500
@@ -154,7 +154,10 @@
         if (_next != NULL && !_next->is_active() && curr_buffer_num > _next->_threshold) {
           _next->activate();
         }
-      } while (dcqs.apply_closure_to_completed_buffer(_refine_closure, _worker_id + _worker_id_offset, cg1r()->green_zone()));
+      } while (dcqs.apply_closure_to_completed_buffer(_refine_closure,
+                                                      _worker_id + _worker_id_offset,
+                                                      cg1r()->green_zone(),
+                                                      false /* during_pause */));
 
       // We can exit the loop above while being active if there was a yield request.
       if (is_active()) {
--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Tue Feb 16 13:20:38 2016 -0800
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp	Wed Feb 17 16:00:27 2016 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -228,37 +228,30 @@
   return nd;
 }
 
-bool DirtyCardQueueSet::apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
-                                                                 uint worker_i,
-                                                                 BufferNode* nd) {
-  if (nd != NULL) {
-    void **buf = BufferNode::make_buffer_from_node(nd);
-    size_t index = nd->index();
-    bool b =
-      DirtyCardQueue::apply_closure_to_buffer(cl, buf,
-                                              index, _sz,
-                                              true, worker_i);
-    if (b) {
-      deallocate_buffer(buf);
-      return true;  // In normal case, go on to next buffer.
-    } else {
-      enqueue_complete_buffer(buf, index);
-      return false;
-    }
-  } else {
-    return false;
-  }
-}
-
 bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
                                                           uint worker_i,
                                                           int stop_at,
                                                           bool during_pause) {
   assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
   BufferNode* nd = get_completed_buffer(stop_at);
-  bool res = apply_closure_to_completed_buffer_helper(cl, worker_i, nd);
-  if (res) Atomic::inc(&_processed_buffers_rs_thread);
-  return res;
+  if (nd == NULL) {
+    return false;
+  } else {
+    void** buf = BufferNode::make_buffer_from_node(nd);
+    size_t index = nd->index();
+    if (DirtyCardQueue::apply_closure_to_buffer(cl,
+                                                buf, index, _sz,
+                                                true, worker_i)) {
+      // Done with fully processed buffer.
+      deallocate_buffer(buf);
+      Atomic::inc(&_processed_buffers_rs_thread);
+      return true;
+    } else {
+      // Return partially processed buffer to the queue.
+      enqueue_complete_buffer(buf, index);
+      return false;
+    }
+  }
 }
 
 void DirtyCardQueueSet::apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {
--- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.hpp	Tue Feb 16 13:20:38 2016 -0800
+++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.hpp	Wed Feb 17 16:00:27 2016 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,14 +133,9 @@
   // partially completed buffer (with its processed elements set to NULL)
   // is returned to the completed buffer set, and this call returns false.
   bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
-                                         uint worker_i = 0,
-                                         int stop_at = 0,
-                                         bool during_pause = false);
-
-  // Helper routine for the above.
-  bool apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
-                                                uint worker_i,
-                                                BufferNode* nd);
+                                         uint worker_i,
+                                         int stop_at,
+                                         bool during_pause);
 
   BufferNode* get_completed_buffer(int stop_at);