# HG changeset patch # User mgerdin # Date 1462360343 -7200 # Node ID ccaa890f86171cabf9fbe05de8a6df386cfe6819 # Parent c432f8466c733596d24326d532e3419dc5df7efa 8155943: Move G1Eden/SurvivorRegions into their own source files Reviewed-by: sjohanss, ehelin diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Wed Apr 27 16:20:05 2016 +0200 +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Wed May 04 13:12:23 2016 +0200 @@ -31,18 +31,19 @@ #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1ConcurrentMark.hpp" +#include "gc/g1/g1EdenRegions.hpp" +#include "gc/g1/g1EvacFailure.hpp" +#include "gc/g1/g1EvacStats.hpp" +#include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1HRPrinter.hpp" #include "gc/g1/g1InCSetState.hpp" #include "gc/g1/g1MonitoringSupport.hpp" -#include "gc/g1/g1EvacFailure.hpp" -#include "gc/g1/g1EvacStats.hpp" -#include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1SATBCardTableModRefBS.hpp" +#include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YCTypes.hpp" #include "gc/g1/hSpaceCounters.hpp" #include "gc/g1/heapRegionManager.hpp" #include "gc/g1/heapRegionSet.hpp" -#include "gc/g1/youngList.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/plab.hpp" diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp --- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp Wed Apr 27 16:20:05 2016 +0200 +++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp Wed May 04 13:12:23 2016 +0200 @@ -34,10 +34,10 @@ #include "gc/g1/g1IHOPControl.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1Policy.hpp" +#include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YoungGenSizer.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" -#include "gc/g1/youngList.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "logging/logStream.hpp" #include "runtime/arguments.hpp" diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/g1EdenRegions.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1EdenRegions.hpp Wed May 04 13:12:23 2016 +0200 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_G1_G1EDENREGIONS_HPP +#define SHARE_VM_GC_G1_G1EDENREGIONS_HPP + +#include "gc/g1/heapRegion.hpp" +#include "memory/allocation.hpp" +#include "runtime/globals.hpp" +#include "utilities/debug.hpp" + +class G1EdenRegions VALUE_OBJ_CLASS_SPEC { +private: + int _length; + +public: + G1EdenRegions() : _length(0) {} + + void add(HeapRegion* hr) { + assert(!hr->is_eden(), "should not already be set"); + _length++; + } + + void clear() { _length = 0; } + + uint length() const { return _length; } +}; + +#endif // SHARE_VM_GC_G1_G1EDENREGIONS_HPP diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp --- a/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp Wed Apr 27 16:20:05 2016 +0200 +++ b/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp Wed May 04 13:12:23 2016 +0200 @@ -36,7 +36,6 @@ #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/g1/g1StringDedup.hpp" -#include "gc/g1/youngList.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/g1SurvivorRegions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.cpp Wed May 04 13:12:23 2016 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2015, 2016, 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/g1/g1SurvivorRegions.hpp" +#include "gc/g1/heapRegion.hpp" +#include "utilities/growableArray.hpp" +#include "utilities/debug.hpp" + +G1SurvivorRegions::G1SurvivorRegions() : _regions(new (ResourceObj::C_HEAP, mtGC) GrowableArray(8, true, mtGC)) {} + +void G1SurvivorRegions::add(HeapRegion* hr) { + assert(hr->is_survivor(), "should be flagged as survivor region"); + _regions->append(hr); +} + +uint G1SurvivorRegions::length() const { + return (uint)_regions->length(); +} + +void G1SurvivorRegions::convert_to_eden() { + for (GrowableArrayIterator it = _regions->begin(); + it != _regions->end(); + ++it) { + HeapRegion* hr = *it; + hr->set_eden_pre_gc(); + } + clear(); +} + +void G1SurvivorRegions::clear() { + _regions->clear(); +} + diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/g1SurvivorRegions.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.hpp Wed May 04 13:12:23 2016 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_G1_G1SURVIVORREGIONS_HPP +#define SHARE_VM_GC_G1_G1SURVIVORREGIONS_HPP + +#include "memory/allocation.hpp" +#include "runtime/globals.hpp" + +template +class GrowableArray; +class HeapRegion; + +class G1SurvivorRegions VALUE_OBJ_CLASS_SPEC { +private: + GrowableArray* _regions; + +public: + G1SurvivorRegions(); + + void add(HeapRegion* hr); + + void convert_to_eden(); + + void clear(); + + uint length() const; + + const GrowableArray* regions() const { + return _regions; + } +}; + +#endif // SHARE_VM_GC_G1_G1SURVIVORREGIONS_HPP diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/youngList.cpp --- a/hotspot/src/share/vm/gc/g1/youngList.cpp Wed Apr 27 16:20:05 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015, 2016, 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/youngList.hpp" -#include "utilities/growableArray.hpp" -#include "utilities/debug.hpp" - -G1SurvivorRegions::G1SurvivorRegions() : _regions(new (ResourceObj::C_HEAP, mtGC) GrowableArray(8, true, mtGC)) {} - -void G1SurvivorRegions::add(HeapRegion* hr) { - assert(hr->is_survivor(), "should be flagged as survivor region"); - _regions->append(hr); -} - -uint G1SurvivorRegions::length() const { - return (uint)_regions->length(); -} - -void G1SurvivorRegions::convert_to_eden() { - for (GrowableArrayIterator it = _regions->begin(); - it != _regions->end(); - ++it) { - HeapRegion* hr = *it; - hr->set_eden_pre_gc(); - } - clear(); -} - -void G1SurvivorRegions::clear() { - _regions->clear(); -} - -void G1EdenRegions::add(HeapRegion* hr) { - assert(!hr->is_eden(), "should not already be set"); - _length++; -} diff -r c432f8466c73 -r ccaa890f8617 hotspot/src/share/vm/gc/g1/youngList.hpp --- a/hotspot/src/share/vm/gc/g1/youngList.hpp Wed Apr 27 16:20:05 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_VM_GC_G1_YOUNGLIST_HPP -#define SHARE_VM_GC_G1_YOUNGLIST_HPP - -#include "memory/allocation.hpp" -#include "runtime/globals.hpp" - -template -class GrowableArray; - -class G1SurvivorRegions VALUE_OBJ_CLASS_SPEC { -private: - GrowableArray* _regions; - -public: - G1SurvivorRegions(); - - void add(HeapRegion* hr); - - void convert_to_eden(); - - void clear(); - - uint length() const; - - const GrowableArray* regions() const { - return _regions; - } -}; - -class G1EdenRegions VALUE_OBJ_CLASS_SPEC { -private: - int _length; - -public: - G1EdenRegions() : _length(0) {} - - void add(HeapRegion* hr); - - void clear() { _length = 0; } - - uint length() const { return _length; } -}; - -#endif // SHARE_VM_GC_G1_YOUNGLIST_HPP