# HG changeset patch # User johnc # Date 1284397224 25200 # Node ID 6eddcbe17c83dcc98131abccdc50c4cd20415934 # Parent eeade8e89248ecbd5bf47ac72629aec7421d758b 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 diff -r eeade8e89248 -r 6eddcbe17c83 src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- 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);