src/share/vm/gc_implementation/g1/g1AllocRegion.inline.hpp

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

author
tschatzl
date
Fri, 10 Oct 2014 15:51:58 +0200
changeset 7257
e7d0505c8a30
parent 6990
1526a938e670
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

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP
aoqi@0 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP
aoqi@0 27
aoqi@0 28 #include "gc_implementation/g1/g1AllocRegion.hpp"
mgerdin@6990 29 #include "gc_implementation/g1/heapRegion.inline.hpp"
aoqi@0 30
aoqi@0 31 inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region,
aoqi@0 32 size_t word_size,
aoqi@0 33 bool bot_updates) {
aoqi@0 34 assert(alloc_region != NULL, err_msg("pre-condition"));
aoqi@0 35
aoqi@0 36 if (!bot_updates) {
aoqi@0 37 return alloc_region->allocate_no_bot_updates(word_size);
aoqi@0 38 } else {
aoqi@0 39 return alloc_region->allocate(word_size);
aoqi@0 40 }
aoqi@0 41 }
aoqi@0 42
aoqi@0 43 inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region,
aoqi@0 44 size_t word_size,
aoqi@0 45 bool bot_updates) {
aoqi@0 46 assert(alloc_region != NULL, err_msg("pre-condition"));
aoqi@0 47 assert(!alloc_region->is_empty(), err_msg("pre-condition"));
aoqi@0 48
aoqi@0 49 if (!bot_updates) {
aoqi@0 50 return alloc_region->par_allocate_no_bot_updates(word_size);
aoqi@0 51 } else {
aoqi@0 52 return alloc_region->par_allocate(word_size);
aoqi@0 53 }
aoqi@0 54 }
aoqi@0 55
aoqi@0 56 inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size,
aoqi@0 57 bool bot_updates) {
aoqi@0 58 assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition"));
aoqi@0 59
aoqi@0 60 HeapRegion* alloc_region = _alloc_region;
aoqi@0 61 assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
aoqi@0 62
aoqi@0 63 HeapWord* result = par_allocate(alloc_region, word_size, bot_updates);
aoqi@0 64 if (result != NULL) {
aoqi@0 65 trace("alloc", word_size, result);
aoqi@0 66 return result;
aoqi@0 67 }
aoqi@0 68 trace("alloc failed", word_size);
aoqi@0 69 return NULL;
aoqi@0 70 }
aoqi@0 71
aoqi@0 72 inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size,
aoqi@0 73 bool bot_updates) {
aoqi@0 74 // First we have to tedo the allocation, assuming we're holding the
aoqi@0 75 // appropriate lock, in case another thread changed the region while
aoqi@0 76 // we were waiting to get the lock.
aoqi@0 77 HeapWord* result = attempt_allocation(word_size, bot_updates);
aoqi@0 78 if (result != NULL) {
aoqi@0 79 return result;
aoqi@0 80 }
aoqi@0 81
aoqi@0 82 retire(true /* fill_up */);
aoqi@0 83 result = new_alloc_region_and_allocate(word_size, false /* force */);
aoqi@0 84 if (result != NULL) {
aoqi@0 85 trace("alloc locked (second attempt)", word_size, result);
aoqi@0 86 return result;
aoqi@0 87 }
aoqi@0 88 trace("alloc locked failed", word_size);
aoqi@0 89 return NULL;
aoqi@0 90 }
aoqi@0 91
aoqi@0 92 inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size,
aoqi@0 93 bool bot_updates) {
aoqi@0 94 assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition"));
aoqi@0 95 assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly"));
aoqi@0 96
aoqi@0 97 trace("forcing alloc");
aoqi@0 98 HeapWord* result = new_alloc_region_and_allocate(word_size, true /* force */);
aoqi@0 99 if (result != NULL) {
aoqi@0 100 trace("alloc forced", word_size, result);
aoqi@0 101 return result;
aoqi@0 102 }
aoqi@0 103 trace("alloc forced failed", word_size);
aoqi@0 104 return NULL;
aoqi@0 105 }
aoqi@0 106
aoqi@0 107 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_INLINE_HPP

mercurial