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

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

author
tschatzl
date
Fri, 10 Oct 2014 15:51:58 +0200
changeset 7257
e7d0505c8a30
parent 7118
227a9e5e4b4a
child 7285
1d6eb209432a
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 /*
johnc@3666 2 * Copyright (c) 2001, 2012, 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_VM_OPERATIONS_G1_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP
stefank@2314 27
sjohanss@7118 28 #include "gc_implementation/g1/g1AllocationContext.hpp"
stefank@2314 29 #include "gc_implementation/shared/vmGCOperations.hpp"
stefank@2314 30
ysr@777 31 // VM_operations for the G1 collector.
ysr@777 32 // VM_GC_Operation:
ysr@777 33 // - VM_CGC_Operation
ysr@777 34 // - VM_G1CollectFull
tonyp@2315 35 // - VM_G1OperationWithAllocRequest
tonyp@2315 36 // - VM_G1CollectForAllocation
tonyp@2315 37 // - VM_G1IncCollectionPause
tonyp@2315 38
tonyp@2315 39 class VM_G1OperationWithAllocRequest: public VM_GC_Operation {
tonyp@2315 40 protected:
tonyp@2315 41 size_t _word_size;
tonyp@2315 42 HeapWord* _result;
tonyp@2315 43 bool _pause_succeeded;
sjohanss@7118 44 AllocationContext_t _allocation_context;
tonyp@2315 45
tonyp@2315 46 public:
tonyp@2315 47 VM_G1OperationWithAllocRequest(unsigned int gc_count_before,
johnc@3666 48 size_t word_size,
johnc@3666 49 GCCause::Cause gc_cause)
johnc@3666 50 : VM_GC_Operation(gc_count_before, gc_cause),
tonyp@2315 51 _word_size(word_size), _result(NULL), _pause_succeeded(false) { }
tonyp@2315 52 HeapWord* result() { return _result; }
tonyp@2315 53 bool pause_succeeded() { return _pause_succeeded; }
sjohanss@7118 54 void set_allocation_context(AllocationContext_t context) { _allocation_context = context; }
sjohanss@7118 55 AllocationContext_t allocation_context() { return _allocation_context; }
tonyp@2315 56 };
ysr@777 57
ysr@777 58 class VM_G1CollectFull: public VM_GC_Operation {
tonyp@2315 59 public:
tonyp@2011 60 VM_G1CollectFull(unsigned int gc_count_before,
tonyp@2011 61 unsigned int full_gc_count_before,
tonyp@2011 62 GCCause::Cause cause)
brutisso@2532 63 : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { }
ysr@777 64 virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
ysr@777 65 virtual void doit();
ysr@777 66 virtual const char* name() const {
ysr@777 67 return "full garbage-first collection";
ysr@777 68 }
ysr@777 69 };
ysr@777 70
tonyp@2315 71 class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest {
tonyp@2315 72 public:
tonyp@2315 73 VM_G1CollectForAllocation(unsigned int gc_count_before,
tonyp@2315 74 size_t word_size);
ysr@777 75 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
ysr@777 76 virtual void doit();
ysr@777 77 virtual const char* name() const {
ysr@777 78 return "garbage-first collection to satisfy allocation";
ysr@777 79 }
ysr@777 80 };
ysr@777 81
tonyp@2315 82 class VM_G1IncCollectionPause: public VM_G1OperationWithAllocRequest {
tonyp@2011 83 private:
tonyp@2315 84 bool _should_initiate_conc_mark;
johnc@3666 85 bool _should_retry_gc;
tonyp@2315 86 double _target_pause_time_ms;
brutisso@3823 87 unsigned int _old_marking_cycles_completed_before;
tonyp@2011 88 public:
tonyp@2011 89 VM_G1IncCollectionPause(unsigned int gc_count_before,
tonyp@2315 90 size_t word_size,
tonyp@2011 91 bool should_initiate_conc_mark,
tonyp@2011 92 double target_pause_time_ms,
tonyp@2315 93 GCCause::Cause gc_cause);
ysr@777 94 virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
johnc@3666 95 virtual bool doit_prologue();
ysr@777 96 virtual void doit();
tonyp@2011 97 virtual void doit_epilogue();
ysr@777 98 virtual const char* name() const {
ysr@777 99 return "garbage-first incremental collection pause";
ysr@777 100 }
johnc@3666 101 bool should_retry_gc() const { return _should_retry_gc; }
ysr@777 102 };
ysr@777 103
johnc@3218 104 // Concurrent GC stop-the-world operations such as remark and cleanup;
ysr@777 105 // consider sharing these with CMS's counterparts.
ysr@777 106 class VM_CGC_Operation: public VM_Operation {
ysr@777 107 VoidClosure* _cl;
ysr@777 108 const char* _printGCMessage;
johnc@3666 109 bool _needs_pll;
johnc@3218 110
johnc@3218 111 protected:
johnc@3218 112 // java.lang.ref.Reference support
johnc@3218 113 void acquire_pending_list_lock();
johnc@3218 114 void release_and_notify_pending_list_lock();
johnc@3218 115
tonyp@2315 116 public:
johnc@3666 117 VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg, bool needs_pll)
johnc@3666 118 : _cl(cl), _printGCMessage(printGCMsg), _needs_pll(needs_pll) { }
ysr@777 119 virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
ysr@777 120 virtual void doit();
ysr@777 121 virtual bool doit_prologue();
ysr@777 122 virtual void doit_epilogue();
ysr@777 123 virtual const char* name() const {
ysr@777 124 return "concurrent gc";
ysr@777 125 }
ysr@777 126 };
stefank@2314 127
stefank@2314 128 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP

mercurial