diff src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp @ 17844:8847586c9037

8016302: Change type of the number of GC workers to unsigned int (2) Reviewed-by: tschatzl, jwilhelm
author vkempik
date Thu, 03 Apr 2014 17:49:31 +0400
parents bfdf528be8e8
children 570cb6369f17
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Tue Apr 08 14:55:16 2014 -0700
+++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Thu Apr 03 17:49:31 2014 +0400
@@ -34,12 +34,12 @@
 
 bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl,
                                    bool consume,
-                                   size_t worker_i) {
+                                   uint worker_i) {
   bool res = true;
   if (_buf != NULL) {
     res = apply_closure_to_buffer(cl, _buf, _index, _sz,
                                   consume,
-                                  (int) worker_i);
+                                  worker_i);
     if (res && consume) _index = _sz;
   }
   return res;
@@ -49,7 +49,7 @@
                                              void** buf,
                                              size_t index, size_t sz,
                                              bool consume,
-                                             int worker_i) {
+                                             uint worker_i) {
   if (cl == NULL) return true;
   for (size_t i = index; i < sz; i += oopSize) {
     int ind = byte_index_to_index((int)i);
@@ -79,8 +79,8 @@
 }
 
 // Determines how many mutator threads can process the buffers in parallel.
-size_t DirtyCardQueueSet::num_par_ids() {
-  return os::processor_count();
+uint DirtyCardQueueSet::num_par_ids() {
+  return (uint)os::processor_count();
 }
 
 void DirtyCardQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
@@ -103,7 +103,7 @@
 }
 
 void DirtyCardQueueSet::iterate_closure_all_threads(bool consume,
-                                                    size_t worker_i) {
+                                                    uint worker_i) {
   assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
   for(JavaThread* t = Threads::first(); t; t = t->next()) {
     bool b = t->dirty_card_queue().apply_closure(_closure, consume);
@@ -126,11 +126,11 @@
 
   // We get the the number of any par_id that this thread
   // might have already claimed.
-  int worker_i = thread->get_claimed_par_id();
+  uint worker_i = thread->get_claimed_par_id();
 
-  // If worker_i is not -1 then the thread has already claimed
+  // If worker_i is not UINT_MAX then the thread has already claimed
   // a par_id. We make note of it using the already_claimed value
-  if (worker_i != -1) {
+  if (worker_i != UINT_MAX) {
     already_claimed = true;
   } else {
 
@@ -142,7 +142,7 @@
   }
 
   bool b = false;
-  if (worker_i != -1) {
+  if (worker_i != UINT_MAX) {
     b = DirtyCardQueue::apply_closure_to_buffer(_closure, buf, 0,
                                                 _sz, true, worker_i);
     if (b) Atomic::inc(&_processed_buffers_mut);
@@ -154,8 +154,8 @@
       // we release the id
       _free_ids->release_par_id(worker_i);
 
-      // and set the claimed_id in the thread to -1
-      thread->set_claimed_par_id(-1);
+      // and set the claimed_id in the thread to UINT_MAX
+      thread->set_claimed_par_id(UINT_MAX);
     }
   }
   return b;
@@ -186,7 +186,7 @@
 
 bool DirtyCardQueueSet::
 apply_closure_to_completed_buffer_helper(CardTableEntryClosure* cl,
-                                         int worker_i,
+                                         uint worker_i,
                                          BufferNode* nd) {
   if (nd != NULL) {
     void **buf = BufferNode::make_buffer_from_node(nd);
@@ -208,7 +208,7 @@
 }
 
 bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
-                                                          int worker_i,
+                                                          uint worker_i,
                                                           int stop_at,
                                                           bool during_pause) {
   assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
@@ -218,7 +218,7 @@
   return res;
 }
 
-bool DirtyCardQueueSet::apply_closure_to_completed_buffer(int worker_i,
+bool DirtyCardQueueSet::apply_closure_to_completed_buffer(uint worker_i,
                                                           int stop_at,
                                                           bool during_pause) {
   return apply_closure_to_completed_buffer(_closure, worker_i,