src/share/vm/gc_implementation/g1/g1MarkSweep.hpp

Fri, 10 Oct 2014 15:51:58 +0200

author
tschatzl
date
Fri, 10 Oct 2014 15:51:58 +0200
changeset 7257
e7d0505c8a30
parent 7131
d35872270666
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

8059758: Footprint regressions with JDK-8038423
Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything.
Reviewed-by: jwilhelm, brutisso

ysr@777 1 /*
sla@5237 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
ysr@777 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@777 4 *
ysr@777 5 * This code is free software; you can redistribute it and/or modify it
ysr@777 6 * under the terms of the GNU General Public License version 2 only, as
ysr@777 7 * published by the Free Software Foundation.
ysr@777 8 *
ysr@777 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@777 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@777 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@777 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@777 13 * accompanied this code).
ysr@777 14 *
ysr@777 15 * You should have received a copy of the GNU General Public License version
ysr@777 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@777 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@777 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
ysr@777 22 *
ysr@777 23 */
ysr@777 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
stefank@2314 29 #include "gc_implementation/g1/heapRegion.hpp"
stefank@2314 30 #include "memory/genMarkSweep.hpp"
stefank@2314 31 #include "memory/generation.hpp"
stefank@2314 32 #include "memory/universe.hpp"
stefank@2314 33 #include "oops/markOop.hpp"
stefank@2314 34 #include "oops/oop.hpp"
stefank@2314 35 #include "runtime/timer.hpp"
stefank@2314 36 #include "utilities/growableArray.hpp"
stefank@2314 37
ysr@777 38 class ReferenceProcessor;
ysr@777 39
ysr@777 40 // G1MarkSweep takes care of global mark-compact garbage collection for a
ysr@777 41 // G1CollectedHeap using a four-phase pointer forwarding algorithm. All
ysr@777 42 // generations are assumed to support marking; those that can also support
ysr@777 43 // compaction.
ysr@777 44 //
ysr@777 45 // Class unloading will only occur when a full gc is invoked.
sjohanss@7131 46 class G1PrepareCompactClosure;
ysr@777 47
ysr@777 48 class G1MarkSweep : AllStatic {
ysr@777 49 friend class VM_G1MarkSweep;
ysr@777 50 friend class Scavenge;
ysr@777 51
ysr@777 52 public:
ysr@777 53
ysr@777 54 static void invoke_at_safepoint(ReferenceProcessor* rp,
ysr@777 55 bool clear_all_softrefs);
ysr@777 56
sla@5237 57 static STWGCTimer* gc_timer() { return GenMarkSweep::_gc_timer; }
sla@5237 58 static SerialOldTracer* gc_tracer() { return GenMarkSweep::_gc_tracer; }
sla@5237 59
ysr@777 60 private:
ysr@777 61
ysr@777 62 // Mark live objects
ysr@777 63 static void mark_sweep_phase1(bool& marked_for_deopt,
ysr@777 64 bool clear_all_softrefs);
ysr@777 65 // Calculate new addresses
ysr@777 66 static void mark_sweep_phase2();
ysr@777 67 // Update pointers
ysr@777 68 static void mark_sweep_phase3();
ysr@777 69 // Move objects to new positions
ysr@777 70 static void mark_sweep_phase4();
ysr@777 71
ysr@777 72 static void allocate_stacks();
sjohanss@7131 73 static void prepare_compaction();
sjohanss@7131 74 static void prepare_compaction_work(G1PrepareCompactClosure* blk);
sjohanss@7131 75 };
sjohanss@7131 76
sjohanss@7131 77 class G1PrepareCompactClosure : public HeapRegionClosure {
sjohanss@7131 78 protected:
sjohanss@7131 79 G1CollectedHeap* _g1h;
sjohanss@7131 80 ModRefBarrierSet* _mrbs;
sjohanss@7131 81 CompactPoint _cp;
sjohanss@7131 82 HeapRegionSetCount _humongous_regions_removed;
sjohanss@7131 83
sjohanss@7131 84 virtual void prepare_for_compaction(HeapRegion* hr, HeapWord* end);
sjohanss@7131 85 void prepare_for_compaction_work(CompactPoint* cp, HeapRegion* hr, HeapWord* end);
sjohanss@7131 86 void free_humongous_region(HeapRegion* hr);
sjohanss@7131 87 bool is_cp_initialized() const { return _cp.space != NULL; }
sjohanss@7131 88
sjohanss@7131 89 public:
sjohanss@7131 90 G1PrepareCompactClosure() :
sjohanss@7131 91 _g1h(G1CollectedHeap::heap()),
sjohanss@7131 92 _mrbs(_g1h->g1_barrier_set()),
sjohanss@7131 93 _humongous_regions_removed() { }
sjohanss@7131 94
sjohanss@7131 95 void update_sets();
sjohanss@7131 96 bool doHeapRegion(HeapRegion* hr);
ysr@777 97 };
stefank@2314 98
stefank@2314 99 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MARKSWEEP_HPP

mercurial