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

Fri, 29 Apr 2011 14:59:04 -0400

author
tonyp
date
Fri, 29 Apr 2011 14:59:04 -0400
changeset 2849
063382f9b575
parent 2643
1216415d8e35
child 2974
e8b0b0392037
permissions
-rw-r--r--

7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
Summary: We should only undirty cards after we decide that they are not on a young region, not before. The fix also includes improvements to the verify_dirty_region() method which print out which cards were not found dirty.
Reviewed-by: johnc, brutisso

tonyp@2472 1 /*
tonyp@2472 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
tonyp@2472 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
tonyp@2472 4 *
tonyp@2472 5 * This code is free software; you can redistribute it and/or modify it
tonyp@2472 6 * under the terms of the GNU General Public License version 2 only, as
tonyp@2472 7 * published by the Free Software Foundation.
tonyp@2472 8 *
tonyp@2472 9 * This code is distributed in the hope that it will be useful, but WITHOUT
tonyp@2472 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
tonyp@2472 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
tonyp@2472 12 * version 2 for more details (a copy is included in the LICENSE file that
tonyp@2472 13 * accompanied this code).
tonyp@2472 14 *
tonyp@2472 15 * You should have received a copy of the GNU General Public License version
tonyp@2472 16 * 2 along with this work; if not, write to the Free Software Foundation,
tonyp@2472 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
tonyp@2472 18 *
tonyp@2472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
tonyp@2472 20 * or visit www.oracle.com if you need additional information or have any
tonyp@2472 21 * questions.
tonyp@2472 22 *
tonyp@2472 23 */
tonyp@2472 24
tonyp@2472 25 #include "precompiled.hpp"
tonyp@2472 26 #include "gc_implementation/g1/heapRegionSets.hpp"
tonyp@2472 27
tonyp@2472 28 //////////////////// FreeRegionList ////////////////////
tonyp@2472 29
tonyp@2472 30 const char* FreeRegionList::verify_region_extra(HeapRegion* hr) {
tonyp@2472 31 if (hr->is_young()) {
tonyp@2472 32 return "the region should not be young";
tonyp@2472 33 }
tonyp@2472 34 // The superclass will check that the region is empty and
tonyp@2472 35 // not-humongous.
tonyp@2472 36 return HeapRegionLinkedList::verify_region_extra(hr);
tonyp@2472 37 }
tonyp@2472 38
tonyp@2472 39 //////////////////// MasterFreeRegionList ////////////////////
tonyp@2472 40
tonyp@2472 41 bool MasterFreeRegionList::check_mt_safety() {
tonyp@2472 42 // Master Free List MT safety protocol:
tonyp@2472 43 // (a) If we're at a safepoint, operations on the master free list
tonyp@2472 44 // should be invoked by either the VM thread (which will serialize
tonyp@2472 45 // them) or by the GC workers while holding the
tonyp@2472 46 // FreeList_lock.
tonyp@2472 47 // (b) If we're not at a safepoint, operations on the master free
tonyp@2472 48 // list should be invoked while holding the Heap_lock.
tonyp@2472 49
tonyp@2472 50 guarantee((SafepointSynchronize::is_at_safepoint() &&
tonyp@2472 51 (Thread::current()->is_VM_thread() ||
tonyp@2472 52 FreeList_lock->owned_by_self())) ||
tonyp@2472 53 (!SafepointSynchronize::is_at_safepoint() &&
tonyp@2472 54 Heap_lock->owned_by_self()),
tonyp@2643 55 hrs_ext_msg(this, "master free list MT safety protocol"));
tonyp@2472 56
tonyp@2472 57 return FreeRegionList::check_mt_safety();
tonyp@2472 58 }
tonyp@2472 59
tonyp@2472 60 //////////////////// SecondaryFreeRegionList ////////////////////
tonyp@2472 61
tonyp@2472 62 bool SecondaryFreeRegionList::check_mt_safety() {
tonyp@2472 63 // Secondary Free List MT safety protocol:
tonyp@2472 64 // Operations on the secondary free list should always be invoked
tonyp@2472 65 // while holding the SecondaryFreeList_lock.
tonyp@2472 66
tonyp@2472 67 guarantee(SecondaryFreeList_lock->owned_by_self(),
tonyp@2643 68 hrs_ext_msg(this, "secondary free list MT safety protocol"));
tonyp@2472 69
tonyp@2472 70 return FreeRegionList::check_mt_safety();
tonyp@2472 71 }
tonyp@2472 72
tonyp@2472 73 //////////////////// HumongousRegionSet ////////////////////
tonyp@2472 74
tonyp@2472 75 const char* HumongousRegionSet::verify_region_extra(HeapRegion* hr) {
tonyp@2472 76 if (hr->is_young()) {
tonyp@2472 77 return "the region should not be young";
tonyp@2472 78 }
tonyp@2472 79 // The superclass will check that the region is not empty and
tonyp@2472 80 // humongous.
tonyp@2472 81 return HeapRegionSet::verify_region_extra(hr);
tonyp@2472 82 }
tonyp@2472 83
tonyp@2643 84 //////////////////// MasterHumongousRegionSet ////////////////////
tonyp@2472 85
tonyp@2472 86 bool MasterHumongousRegionSet::check_mt_safety() {
tonyp@2472 87 // Master Humongous Set MT safety protocol:
tonyp@2472 88 // (a) If we're at a safepoint, operations on the master humongous
tonyp@2472 89 // set should be invoked by either the VM thread (which will
tonyp@2472 90 // serialize them) or by the GC workers while holding the
tonyp@2472 91 // OldSets_lock.
tonyp@2472 92 // (b) If we're not at a safepoint, operations on the master
tonyp@2472 93 // humongous set should be invoked while holding the Heap_lock.
tonyp@2472 94
tonyp@2472 95 guarantee((SafepointSynchronize::is_at_safepoint() &&
tonyp@2472 96 (Thread::current()->is_VM_thread() ||
tonyp@2472 97 OldSets_lock->owned_by_self())) ||
tonyp@2472 98 (!SafepointSynchronize::is_at_safepoint() &&
tonyp@2472 99 Heap_lock->owned_by_self()),
tonyp@2643 100 hrs_ext_msg(this, "master humongous set MT safety protocol"));
tonyp@2472 101 return HumongousRegionSet::check_mt_safety();
tonyp@2472 102 }

mercurial