Thu, 22 Jul 2010 10:27:41 -0400
6962589: remove breadth first scanning code from parallel gc
Summary: Remove the breadth-first copying order from ParallelScavenge and use depth-first by default.
Reviewed-by: jcoomes, ysr, johnc
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 | |
duke@435 | 25 | inline PSPromotionManager* PSPromotionManager::manager_array(int index) { |
duke@435 | 26 | assert(_manager_array != NULL, "access of NULL manager_array"); |
duke@435 | 27 | assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access"); |
duke@435 | 28 | return _manager_array[index]; |
duke@435 | 29 | } |
duke@435 | 30 | |
coleenp@548 | 31 | template <class T> |
coleenp@548 | 32 | inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) { |
coleenp@548 | 33 | if (p != NULL) { // XXX: error if p != NULL here |
coleenp@548 | 34 | oop o = oopDesc::load_decode_heap_oop_not_null(p); |
duke@435 | 35 | if (o->is_forwarded()) { |
duke@435 | 36 | o = o->forwardee(); |
duke@435 | 37 | // Card mark |
duke@435 | 38 | if (PSScavenge::is_obj_in_young((HeapWord*) o)) { |
duke@435 | 39 | PSScavenge::card_table()->inline_write_ref_field_gc(p, o); |
duke@435 | 40 | } |
coleenp@548 | 41 | oopDesc::encode_store_heap_oop_not_null(p, o); |
duke@435 | 42 | } else { |
duke@435 | 43 | push_depth(p); |
duke@435 | 44 | } |
duke@435 | 45 | } |
duke@435 | 46 | } |
duke@435 | 47 | |
coleenp@548 | 48 | template <class T> |
coleenp@548 | 49 | inline void PSPromotionManager::claim_or_forward_depth(T* p) { |
coleenp@548 | 50 | assert(PSScavenge::should_scavenge(p, true), "revisiting object?"); |
coleenp@548 | 51 | assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, |
coleenp@548 | 52 | "Sanity"); |
duke@435 | 53 | assert(Universe::heap()->is_in(p), "pointer outside heap"); |
duke@435 | 54 | |
duke@435 | 55 | claim_or_forward_internal_depth(p); |
duke@435 | 56 | } |
duke@435 | 57 | |
coleenp@548 | 58 | inline void PSPromotionManager::process_popped_location_depth(StarTask p) { |
duke@435 | 59 | if (is_oop_masked(p)) { |
duke@435 | 60 | assert(PSChunkLargeArrays, "invariant"); |
duke@435 | 61 | oop const old = unmask_chunked_array_oop(p); |
duke@435 | 62 | process_array_chunk(old); |
duke@435 | 63 | } else { |
coleenp@548 | 64 | if (p.is_narrow()) { |
ysr@1280 | 65 | assert(UseCompressedOops, "Error"); |
coleenp@548 | 66 | PSScavenge::copy_and_push_safe_barrier(this, (narrowOop*)p); |
coleenp@548 | 67 | } else { |
coleenp@548 | 68 | PSScavenge::copy_and_push_safe_barrier(this, (oop*)p); |
coleenp@548 | 69 | } |
duke@435 | 70 | } |
duke@435 | 71 | } |
jcoomes@2020 | 72 | |
jcoomes@2020 | 73 | #if TASKQUEUE_STATS |
jcoomes@2020 | 74 | void PSPromotionManager::record_steal(StarTask& p) { |
jcoomes@2020 | 75 | if (is_oop_masked(p)) { |
jcoomes@2020 | 76 | ++_masked_steals; |
jcoomes@2020 | 77 | } |
jcoomes@2020 | 78 | } |
jcoomes@2020 | 79 | #endif // TASKQUEUE_STATS |