src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp

Thu, 22 Sep 2011 10:57:37 -0700

author
johnc
date
Thu, 22 Sep 2011 10:57:37 -0700
changeset 3175
4dfb2df418f2
parent 2314
f95d63e2154a
child 3536
95f6641e38e0
permissions
-rw-r--r--

6484982: G1: process references during evacuation pauses
Summary: G1 now uses two reference processors - one is used by concurrent marking and the other is used by STW GCs (both full and incremental evacuation pauses). In an evacuation pause, the reference processor is embedded into the closures used to scan objects. Doing so causes causes reference objects to be 'discovered' by the reference processor. At the end of the evacuation pause, these discovered reference objects are processed - preserving (and copying) referent objects (and their reachable graphs) as appropriate.
Reviewed-by: ysr, jwilhelm, brutisso, stefank, tonyp

duke@435 1 /*
jcoomes@2020 2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 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.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
stefank@2314 29 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
stefank@2314 30
duke@435 31 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
duke@435 32 assert(_manager_array != NULL, "access of NULL manager_array");
duke@435 33 assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
duke@435 34 return _manager_array[index];
duke@435 35 }
duke@435 36
coleenp@548 37 template <class T>
coleenp@548 38 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
coleenp@548 39 if (p != NULL) { // XXX: error if p != NULL here
coleenp@548 40 oop o = oopDesc::load_decode_heap_oop_not_null(p);
duke@435 41 if (o->is_forwarded()) {
duke@435 42 o = o->forwardee();
duke@435 43 // Card mark
duke@435 44 if (PSScavenge::is_obj_in_young((HeapWord*) o)) {
duke@435 45 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
duke@435 46 }
coleenp@548 47 oopDesc::encode_store_heap_oop_not_null(p, o);
duke@435 48 } else {
duke@435 49 push_depth(p);
duke@435 50 }
duke@435 51 }
duke@435 52 }
duke@435 53
coleenp@548 54 template <class T>
coleenp@548 55 inline void PSPromotionManager::claim_or_forward_depth(T* p) {
coleenp@548 56 assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
coleenp@548 57 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
coleenp@548 58 "Sanity");
duke@435 59 assert(Universe::heap()->is_in(p), "pointer outside heap");
duke@435 60
duke@435 61 claim_or_forward_internal_depth(p);
duke@435 62 }
duke@435 63
coleenp@548 64 inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
duke@435 65 if (is_oop_masked(p)) {
duke@435 66 assert(PSChunkLargeArrays, "invariant");
duke@435 67 oop const old = unmask_chunked_array_oop(p);
duke@435 68 process_array_chunk(old);
duke@435 69 } else {
coleenp@548 70 if (p.is_narrow()) {
ysr@1280 71 assert(UseCompressedOops, "Error");
coleenp@548 72 PSScavenge::copy_and_push_safe_barrier(this, (narrowOop*)p);
coleenp@548 73 } else {
coleenp@548 74 PSScavenge::copy_and_push_safe_barrier(this, (oop*)p);
coleenp@548 75 }
duke@435 76 }
duke@435 77 }
jcoomes@2020 78
jcoomes@2020 79 #if TASKQUEUE_STATS
jcoomes@2020 80 void PSPromotionManager::record_steal(StarTask& p) {
jcoomes@2020 81 if (is_oop_masked(p)) {
jcoomes@2020 82 ++_masked_steals;
jcoomes@2020 83 }
jcoomes@2020 84 }
jcoomes@2020 85 #endif // TASKQUEUE_STATS
stefank@2314 86
stefank@2314 87 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP

mercurial