6981746: G1: SEGV with -XX:+TraceGen0Time

Mon, 13 Sep 2010 10:00:24 -0700

author
johnc
date
Mon, 13 Sep 2010 10:00:24 -0700
changeset 2134
6eddcbe17c83
parent 2133
eeade8e89248
child 2135
432d823638f7

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

src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Sat Sep 11 11:42:09 2010 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Mon Sep 13 10:00:24 2010 -0700
     1.3 @@ -2148,7 +2148,7 @@
     1.4              body_summary->get_termination_seq()
     1.5            };
     1.6            NumberSeq calc_other_times_ms(body_summary->get_parallel_seq(),
     1.7 -                                        7, other_parts);
     1.8 +                                        6, other_parts);
     1.9            check_other_times(2, body_summary->get_parallel_other_seq(),
    1.10                              &calc_other_times_ms);
    1.11          }
    1.12 @@ -2166,30 +2166,32 @@
    1.13      }
    1.14      print_summary(1, "Other", summary->get_other_seq());
    1.15      {
    1.16 -      NumberSeq calc_other_times_ms;
    1.17 -      if (parallel) {
    1.18 -        // parallel
    1.19 -        NumberSeq* other_parts[] = {
    1.20 -          body_summary->get_satb_drain_seq(),
    1.21 -          body_summary->get_parallel_seq(),
    1.22 -          body_summary->get_clear_ct_seq()
    1.23 -        };
    1.24 -        calc_other_times_ms = NumberSeq(summary->get_total_seq(),
    1.25 -                                        3, other_parts);
    1.26 -      } else {
    1.27 -        // serial
    1.28 -        NumberSeq* other_parts[] = {
    1.29 -          body_summary->get_satb_drain_seq(),
    1.30 -          body_summary->get_update_rs_seq(),
    1.31 -          body_summary->get_ext_root_scan_seq(),
    1.32 -          body_summary->get_mark_stack_scan_seq(),
    1.33 -          body_summary->get_scan_rs_seq(),
    1.34 -          body_summary->get_obj_copy_seq()
    1.35 -        };
    1.36 -        calc_other_times_ms = NumberSeq(summary->get_total_seq(),
    1.37 -                                        7, other_parts);
    1.38 +      if (body_summary != NULL) {
    1.39 +        NumberSeq calc_other_times_ms;
    1.40 +        if (parallel) {
    1.41 +          // parallel
    1.42 +          NumberSeq* other_parts[] = {
    1.43 +            body_summary->get_satb_drain_seq(),
    1.44 +            body_summary->get_parallel_seq(),
    1.45 +            body_summary->get_clear_ct_seq()
    1.46 +          };
    1.47 +          calc_other_times_ms = NumberSeq(summary->get_total_seq(),
    1.48 +                                                3, other_parts);
    1.49 +        } else {
    1.50 +          // serial
    1.51 +          NumberSeq* other_parts[] = {
    1.52 +            body_summary->get_satb_drain_seq(),
    1.53 +            body_summary->get_update_rs_seq(),
    1.54 +            body_summary->get_ext_root_scan_seq(),
    1.55 +            body_summary->get_mark_stack_scan_seq(),
    1.56 +            body_summary->get_scan_rs_seq(),
    1.57 +            body_summary->get_obj_copy_seq()
    1.58 +          };
    1.59 +          calc_other_times_ms = NumberSeq(summary->get_total_seq(),
    1.60 +                                                6, other_parts);
    1.61 +        }
    1.62 +        check_other_times(1,  summary->get_other_seq(), &calc_other_times_ms);
    1.63        }
    1.64 -      check_other_times(1,  summary->get_other_seq(), &calc_other_times_ms);
    1.65      }
    1.66    } else {
    1.67      print_indent(0);

mercurial