src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp

Print this page
rev 3148 : 7147806: G1: Crash in vm bootstrap when running with -XX:+UseG1GC -XX:-UsePerfData
Summary: Update generation and collector counters only if UsePerfData is enabled.
Reviewed-by:

*** 1,7 **** /* ! * Copyright (c) 2011, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2011, 2012 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 42,61 **** --- 42,65 ---- const char* name) : G1GenerationCounters(g1mm, name, 0 /* ordinal */, 3 /* spaces */, G1MonitoringSupport::pad_capacity(0, 3) /* min_capacity */, G1MonitoringSupport::pad_capacity(g1mm->young_gen_max(), 3), G1MonitoringSupport::pad_capacity(0, 3) /* curr_capacity */) { + if (UsePerfData) { update_all(); + } } G1OldGenerationCounters::G1OldGenerationCounters(G1MonitoringSupport* g1mm, const char* name) : G1GenerationCounters(g1mm, name, 1 /* ordinal */, 1 /* spaces */, G1MonitoringSupport::pad_capacity(0) /* min_capacity */, G1MonitoringSupport::pad_capacity(g1mm->old_gen_max()), G1MonitoringSupport::pad_capacity(0) /* curr_capacity */) { + if (UsePerfData) { update_all(); + } } void G1YoungGenerationCounters::update_all() { size_t committed = G1MonitoringSupport::pad_capacity(_g1mm->young_gen_committed(), 3);
*** 147,167 **** // Set the arguments to indicate that this survivor space is not used. _from_counters = new HSpaceCounters("s0", 1 /* ordinal */, pad_capacity(0) /* max_capacity */, pad_capacity(0) /* init_capacity */, _young_collection_counters); - // Given that this survivor space is not used, we update it here - // once to reflect that its used space is 0 so that we don't have to - // worry about updating it again later. - _from_counters->update_used(0); // name "generation.0.space.2" // See _old_space_counters for additional counters _to_counters = new HSpaceCounters("s1", 2 /* ordinal */, pad_capacity(overall_reserved()) /* max_capacity */, pad_capacity(survivor_space_committed()) /* init_capacity */, _young_collection_counters); } void G1MonitoringSupport::recalculate_sizes() { G1CollectedHeap* g1 = g1h(); --- 151,174 ---- // Set the arguments to indicate that this survivor space is not used. _from_counters = new HSpaceCounters("s0", 1 /* ordinal */, pad_capacity(0) /* max_capacity */, pad_capacity(0) /* init_capacity */, _young_collection_counters); // name "generation.0.space.2" // See _old_space_counters for additional counters _to_counters = new HSpaceCounters("s1", 2 /* ordinal */, pad_capacity(overall_reserved()) /* max_capacity */, pad_capacity(survivor_space_committed()) /* init_capacity */, _young_collection_counters); + + if (UsePerfData) { + // Given that this survivor space is not used, we update it here + // once to reflect that its used space is 0 so that we don't have to + // worry about updating it again later. + _from_counters->update_used(0); + } } void G1MonitoringSupport::recalculate_sizes() { G1CollectedHeap* g1 = g1h();