annotate src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp @ 196:d1605aabd0a1

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents ba764ed4b6f2
children df6caf649ff7
rev   line source
duke@0 1 /*
xdono@196 2 * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
duke@0 26 assert(_manager_array != NULL, "access of NULL manager_array");
duke@0 27 assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
duke@0 28 return _manager_array[index];
duke@0 29 }
duke@0 30
coleenp@113 31 template <class T>
coleenp@113 32 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
coleenp@113 33 if (p != NULL) { // XXX: error if p != NULL here
coleenp@113 34 oop o = oopDesc::load_decode_heap_oop_not_null(p);
duke@0 35 if (o->is_forwarded()) {
duke@0 36 o = o->forwardee();
duke@0 37 // Card mark
duke@0 38 if (PSScavenge::is_obj_in_young((HeapWord*) o)) {
duke@0 39 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
duke@0 40 }
coleenp@113 41 oopDesc::encode_store_heap_oop_not_null(p, o);
duke@0 42 } else {
duke@0 43 push_depth(p);
duke@0 44 }
duke@0 45 }
duke@0 46 }
duke@0 47
coleenp@113 48 template <class T>
coleenp@113 49 inline void PSPromotionManager::claim_or_forward_internal_breadth(T* p) {
coleenp@113 50 if (p != NULL) { // XXX: error if p != NULL here
coleenp@113 51 oop o = oopDesc::load_decode_heap_oop_not_null(p);
duke@0 52 if (o->is_forwarded()) {
duke@0 53 o = o->forwardee();
duke@0 54 } else {
duke@0 55 o = copy_to_survivor_space(o, false);
duke@0 56 }
duke@0 57 // Card mark
duke@0 58 if (PSScavenge::is_obj_in_young((HeapWord*) o)) {
duke@0 59 PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
duke@0 60 }
coleenp@113 61 oopDesc::encode_store_heap_oop_not_null(p, o);
duke@0 62 }
duke@0 63 }
duke@0 64
duke@0 65 inline void PSPromotionManager::flush_prefetch_queue() {
duke@0 66 assert(!depth_first(), "invariant");
coleenp@113 67 for (int i = 0; i < _prefetch_queue.length(); i++) {
coleenp@113 68 claim_or_forward_internal_breadth((oop*)_prefetch_queue.pop());
duke@0 69 }
duke@0 70 }
duke@0 71
coleenp@113 72 template <class T>
coleenp@113 73 inline void PSPromotionManager::claim_or_forward_depth(T* p) {
duke@0 74 assert(depth_first(), "invariant");
coleenp@113 75 assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
coleenp@113 76 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
coleenp@113 77 "Sanity");
duke@0 78 assert(Universe::heap()->is_in(p), "pointer outside heap");
duke@0 79
duke@0 80 claim_or_forward_internal_depth(p);
duke@0 81 }
duke@0 82
coleenp@113 83 template <class T>
coleenp@113 84 inline void PSPromotionManager::claim_or_forward_breadth(T* p) {
duke@0 85 assert(!depth_first(), "invariant");
coleenp@113 86 assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
coleenp@113 87 assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
coleenp@113 88 "Sanity");
duke@0 89 assert(Universe::heap()->is_in(p), "pointer outside heap");
duke@0 90
duke@0 91 if (UsePrefetchQueue) {
coleenp@113 92 claim_or_forward_internal_breadth((T*)_prefetch_queue.push_and_pop(p));
duke@0 93 } else {
duke@0 94 // This option is used for testing. The use of the prefetch
duke@0 95 // queue can delay the processing of the objects and thus
duke@0 96 // change the order of object scans. For example, remembered
duke@0 97 // set updates are typically the clearing of the remembered
duke@0 98 // set (the cards) followed by updates of the remembered set
duke@0 99 // for young-to-old pointers. In a situation where there
duke@0 100 // is an error in the sequence of clearing and updating
duke@0 101 // (e.g. clear card A, update card A, erroneously clear
duke@0 102 // card A again) the error can be obscured by a delay
duke@0 103 // in the update due to the use of the prefetch queue
duke@0 104 // (e.g., clear card A, erroneously clear card A again,
duke@0 105 // update card A that was pushed into the prefetch queue
duke@0 106 // and thus delayed until after the erronous clear). The
duke@0 107 // length of the delay is random depending on the objects
duke@0 108 // in the queue and the delay can be zero.
duke@0 109 claim_or_forward_internal_breadth(p);
duke@0 110 }
duke@0 111 }
duke@0 112
coleenp@113 113 inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
duke@0 114 if (is_oop_masked(p)) {
duke@0 115 assert(PSChunkLargeArrays, "invariant");
duke@0 116 oop const old = unmask_chunked_array_oop(p);
duke@0 117 process_array_chunk(old);
duke@0 118 } else {
coleenp@113 119 if (p.is_narrow()) {
coleenp@113 120 PSScavenge::copy_and_push_safe_barrier(this, (narrowOop*)p);
coleenp@113 121 } else {
coleenp@113 122 PSScavenge::copy_and_push_safe_barrier(this, (oop*)p);
coleenp@113 123 }
duke@0 124 }
duke@0 125 }