changeset 1703:6eddcbe17c83

6981746: G1: SEGV with -XX:+TraceGen0Time Summary: Pass correct value for length to NumberSeq constructor. Guard dereferences of "body_summary" pointer with a NULL check. Reviewed-by: tonyp, ysr
author johnc
date Mon, 13 Sep 2010 10:00:24 -0700
parents eeade8e89248
children 432d823638f7
files src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
diffstat 1 files changed, 26 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Sat Sep 11 11:42:09 2010 -0700
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Mon Sep 13 10:00:24 2010 -0700
@@ -2148,7 +2148,7 @@
             body_summary->get_termination_seq()
           };
           NumberSeq calc_other_times_ms(body_summary->get_parallel_seq(),
-                                        7, other_parts);
+                                        6, other_parts);
           check_other_times(2, body_summary->get_parallel_other_seq(),
                             &calc_other_times_ms);
         }
@@ -2166,30 +2166,32 @@
     }
     print_summary(1, "Other", summary->get_other_seq());
     {
-      NumberSeq calc_other_times_ms;
-      if (parallel) {
-        // parallel
-        NumberSeq* other_parts[] = {
-          body_summary->get_satb_drain_seq(),
-          body_summary->get_parallel_seq(),
-          body_summary->get_clear_ct_seq()
-        };
-        calc_other_times_ms = NumberSeq(summary->get_total_seq(),
-                                        3, other_parts);
-      } else {
-        // serial
-        NumberSeq* other_parts[] = {
-          body_summary->get_satb_drain_seq(),
-          body_summary->get_update_rs_seq(),
-          body_summary->get_ext_root_scan_seq(),
-          body_summary->get_mark_stack_scan_seq(),
-          body_summary->get_scan_rs_seq(),
-          body_summary->get_obj_copy_seq()
-        };
-        calc_other_times_ms = NumberSeq(summary->get_total_seq(),
-                                        7, other_parts);
+      if (body_summary != NULL) {
+        NumberSeq calc_other_times_ms;
+        if (parallel) {
+          // parallel
+          NumberSeq* other_parts[] = {
+            body_summary->get_satb_drain_seq(),
+            body_summary->get_parallel_seq(),
+            body_summary->get_clear_ct_seq()
+          };
+          calc_other_times_ms = NumberSeq(summary->get_total_seq(),
+                                                3, other_parts);
+        } else {
+          // serial
+          NumberSeq* other_parts[] = {
+            body_summary->get_satb_drain_seq(),
+            body_summary->get_update_rs_seq(),
+            body_summary->get_ext_root_scan_seq(),
+            body_summary->get_mark_stack_scan_seq(),
+            body_summary->get_scan_rs_seq(),
+            body_summary->get_obj_copy_seq()
+          };
+          calc_other_times_ms = NumberSeq(summary->get_total_seq(),
+                                                6, other_parts);
+        }
+        check_other_times(1,  summary->get_other_seq(), &calc_other_times_ms);
       }
-      check_other_times(1,  summary->get_other_seq(), &calc_other_times_ms);
     }
   } else {
     print_indent(0);