changeset 29472:740ba666f6bb

8073654: Marking statistics should use size_t Summary: Change data type from int to size_t to avoid overflows Reviewed-by: jwilhelm, drwhite, tschatzl
author sangheki
date Mon, 09 Mar 2015 09:30:16 -0700
parents 8db7e3b9922b
children 2724f5121c92 e5203ed6d805
files hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp
diffstat 3 files changed, 48 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Mar 09 11:37:59 2015 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Mar 09 09:30:16 2015 -0700
@@ -3561,6 +3561,15 @@
   _termination_start_time_ms     = 0.0;
 
 #if _MARKING_STATS_
+  _aborted                       = 0;
+  _aborted_overflow              = 0;
+  _aborted_cm_aborted            = 0;
+  _aborted_yield                 = 0;
+  _aborted_timed_out             = 0;
+  _aborted_satb                  = 0;
+  _aborted_termination           = 0;
+  _steal_attempts                = 0;
+  _steals                        = 0;
   _local_pushes                  = 0;
   _local_pops                    = 0;
   _local_max_size                = 0;
@@ -3573,15 +3582,6 @@
   _regions_claimed               = 0;
   _objs_found_on_bitmap          = 0;
   _satb_buffers_processed        = 0;
-  _steal_attempts                = 0;
-  _steals                        = 0;
-  _aborted                       = 0;
-  _aborted_overflow              = 0;
-  _aborted_cm_aborted            = 0;
-  _aborted_yield                 = 0;
-  _aborted_timed_out             = 0;
-  _aborted_satb                  = 0;
-  _aborted_termination           = 0;
 #endif // _MARKING_STATS_
 }
 
@@ -3742,7 +3742,7 @@
         gclog_or_tty->print_cr("[%u] pushed %d entries to the global stack",
                                _worker_id, n);
       }
-      statsOnly( int tmp_size = _cm->mark_stack_size();
+      statsOnly( size_t tmp_size = _cm->mark_stack_size();
                  if (tmp_size > _global_max_size) {
                    _global_max_size = tmp_size;
                  }
@@ -3777,7 +3777,7 @@
       assert(success, "invariant");
     }
 
-    statsOnly( int tmp_size = _task_queue->size();
+    statsOnly( size_t tmp_size = (size_t)_task_queue->size();
                if (tmp_size > _local_max_size) {
                  _local_max_size = tmp_size;
                }
@@ -3934,24 +3934,24 @@
   gclog_or_tty->print_cr("                         max = %1.2lfms, total = %1.2lfms",
                          _all_clock_intervals_ms.maximum(),
                          _all_clock_intervals_ms.sum());
-  gclog_or_tty->print_cr("  Clock Causes (cum): scanning = %d, marking = %d",
+  gclog_or_tty->print_cr("  Clock Causes (cum): scanning = " SIZE_FORMAT ", marking = " SIZE_FORMAT,
                          _clock_due_to_scanning, _clock_due_to_marking);
-  gclog_or_tty->print_cr("  Objects: scanned = %d, found on the bitmap = %d",
+  gclog_or_tty->print_cr("  Objects: scanned = " SIZE_FORMAT ", found on the bitmap = " SIZE_FORMAT,
                          _objs_scanned, _objs_found_on_bitmap);
-  gclog_or_tty->print_cr("  Local Queue:  pushes = %d, pops = %d, max size = %d",
+  gclog_or_tty->print_cr("  Local Queue:  pushes = " SIZE_FORMAT ", pops = " SIZE_FORMAT ", max size = " SIZE_FORMAT,
                          _local_pushes, _local_pops, _local_max_size);
-  gclog_or_tty->print_cr("  Global Stack: pushes = %d, pops = %d, max size = %d",
+  gclog_or_tty->print_cr("  Global Stack: pushes = " SIZE_FORMAT ", pops = " SIZE_FORMAT ", max size = " SIZE_FORMAT,
                          _global_pushes, _global_pops, _global_max_size);
-  gclog_or_tty->print_cr("                transfers to = %d, transfers from = %d",
+  gclog_or_tty->print_cr("                transfers to = " SIZE_FORMAT ", transfers from = " SIZE_FORMAT,
                          _global_transfers_to,_global_transfers_from);
-  gclog_or_tty->print_cr("  Regions: claimed = %d", _regions_claimed);
-  gclog_or_tty->print_cr("  SATB buffers: processed = %d", _satb_buffers_processed);
-  gclog_or_tty->print_cr("  Steals: attempts = %d, successes = %d",
+  gclog_or_tty->print_cr("  Regions: claimed = " SIZE_FORMAT, _regions_claimed);
+  gclog_or_tty->print_cr("  SATB buffers: processed = " SIZE_FORMAT, _satb_buffers_processed);
+  gclog_or_tty->print_cr("  Steals: attempts = " SIZE_FORMAT ", successes = " SIZE_FORMAT,
                          _steal_attempts, _steals);
-  gclog_or_tty->print_cr("  Aborted: %d, due to", _aborted);
-  gclog_or_tty->print_cr("    overflow: %d, global abort: %d, yield: %d",
+  gclog_or_tty->print_cr("  Aborted: " SIZE_FORMAT ", due to", _aborted);
+  gclog_or_tty->print_cr("    overflow: " SIZE_FORMAT ", global abort: " SIZE_FORMAT ", yield: " SIZE_FORMAT,
                          _aborted_overflow, _aborted_cm_aborted, _aborted_yield);
-  gclog_or_tty->print_cr("    time out: %d, SATB: %d, termination: %d",
+  gclog_or_tty->print_cr("    time out: " SIZE_FORMAT ", SATB: " SIZE_FORMAT ", termination: " SIZE_FORMAT,
                          _aborted_timed_out, _aborted_satb, _aborted_termination);
 #endif // _MARKING_STATS_
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Mar 09 11:37:59 2015 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Mar 09 09:30:16 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -1039,36 +1039,36 @@
   NumberSeq                   _all_clock_intervals_ms;
   double                      _interval_start_time_ms;
 
-  int                         _aborted;
-  int                         _aborted_overflow;
-  int                         _aborted_cm_aborted;
-  int                         _aborted_yield;
-  int                         _aborted_timed_out;
-  int                         _aborted_satb;
-  int                         _aborted_termination;
+  size_t                      _aborted;
+  size_t                      _aborted_overflow;
+  size_t                      _aborted_cm_aborted;
+  size_t                      _aborted_yield;
+  size_t                      _aborted_timed_out;
+  size_t                      _aborted_satb;
+  size_t                      _aborted_termination;
 
-  int                         _steal_attempts;
-  int                         _steals;
+  size_t                      _steal_attempts;
+  size_t                      _steals;
 
-  int                         _clock_due_to_marking;
-  int                         _clock_due_to_scanning;
+  size_t                      _clock_due_to_marking;
+  size_t                      _clock_due_to_scanning;
 
-  int                         _local_pushes;
-  int                         _local_pops;
-  int                         _local_max_size;
-  int                         _objs_scanned;
+  size_t                      _local_pushes;
+  size_t                      _local_pops;
+  size_t                      _local_max_size;
+  size_t                      _objs_scanned;
 
-  int                         _global_pushes;
-  int                         _global_pops;
-  int                         _global_max_size;
+  size_t                      _global_pushes;
+  size_t                      _global_pops;
+  size_t                      _global_max_size;
 
-  int                         _global_transfers_to;
-  int                         _global_transfers_from;
+  size_t                      _global_transfers_to;
+  size_t                      _global_transfers_from;
 
-  int                         _regions_claimed;
-  int                         _objs_found_on_bitmap;
+  size_t                      _regions_claimed;
+  size_t                      _objs_found_on_bitmap;
 
-  int                         _satb_buffers_processed;
+  size_t                      _satb_buffers_processed;
 #endif // _MARKING_STATS_
 
   // it updates the local fields after this task has claimed
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Mon Mar 09 11:37:59 2015 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Mon Mar 09 09:30:16 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -252,7 +252,7 @@
     assert(success, "invariant");
   }
 
-  statsOnly( int tmp_size = _task_queue->size();
+  statsOnly( size_t tmp_size = (size_t)_task_queue->size();
              if (tmp_size > _local_max_size) {
                _local_max_size = tmp_size;
              }