# HG changeset patch # User stefank # Date 1429788851 -7200 # Thu Apr 23 13:34:11 2015 +0200 # Node ID 1955a2f1bbe0d40368846aa0d7b0e9bc334640a1 # Parent 4b3dd32f564ac59eeb8c0e551e837f7411d6b49e imported patch movePush diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -66,6 +66,7 @@ #include "services/memoryService.hpp" #include "services/runtimeService.hpp" #include "utilities/stack.inline.hpp" +#include "utilities/taskqueue.inline.hpp" // statics CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -54,6 +54,7 @@ #include "runtime/atomic.inline.hpp" #include "runtime/prefetch.inline.hpp" #include "services/memTracker.hpp" +#include "utilities/taskqueue.inline.hpp" // Concurrent marking bit map wrapper diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp b/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp --- a/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp +++ b/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp @@ -27,6 +27,7 @@ #include "gc_implementation/g1/concurrentMark.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" +#include "utilities/taskqueue.inline.hpp" // Utility routine to set an exclusive range of cards on the given // card liveness bitmap diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -66,6 +66,7 @@ #include "runtime/vmThread.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/stack.inline.hpp" +#include "utilities/taskqueue.inline.hpp" size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0; diff --git a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp --- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -54,6 +54,7 @@ #include "utilities/copy.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/stack.inline.hpp" +#include "utilities/taskqueue.inline.hpp" #include "utilities/workgroup.hpp" #ifdef _MSC_VER diff --git a/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp b/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp --- a/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp @@ -31,6 +31,7 @@ #include "oops/oop.inline.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/taskqueue.inline.hpp" inline void ParCompactionManager::push(oop obj) { _marking_stack.push(obj); diff --git a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp @@ -143,9 +143,7 @@ int start, int end); void process_array_chunk(oop old); - template void push_depth(T* p) { - claimed_stack_depth()->push(p); - } + template void push_depth(T* p); inline void promotion_trace_event(oop new_obj, oop old_obj, size_t obj_size, uint age, bool tenured, diff --git a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp @@ -31,6 +31,7 @@ #include "gc_implementation/parallelScavenge/psPromotionLAB.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" #include "oops/oop.inline.hpp" +#include "utilities/taskqueue.inline.hpp" inline PSPromotionManager* PSPromotionManager::manager_array(int index) { assert(_manager_array != NULL, "access of NULL manager_array"); @@ -39,6 +40,11 @@ } template +inline void PSPromotionManager::push_depth(T* p) { + claimed_stack_depth()->push(p); +} + +template inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) { if (p != NULL) { // XXX: error if p != NULL here oop o = oopDesc::load_decode_heap_oop_not_null(p); @@ -99,7 +105,7 @@ // performance. // template -oop PSPromotionManager::copy_to_survivor_space(oop o) { +inline oop PSPromotionManager::copy_to_survivor_space(oop o) { assert(should_scavenge(&o), "Sanity"); oop new_obj = NULL; diff --git a/src/share/vm/utilities/taskqueue.hpp b/src/share/vm/utilities/taskqueue.hpp --- a/src/share/vm/utilities/taskqueue.hpp +++ b/src/share/vm/utilities/taskqueue.hpp @@ -337,24 +337,6 @@ // tty->print_cr("END OopTaskQueue::oops_do"); } -template -bool GenericTaskQueue::push_slow(E t, uint dirty_n_elems) { - if (dirty_n_elems == N - 1) { - // Actually means 0, so do the push. - uint localBot = _bottom; - // g++ complains if the volatile result of the assignment is - // unused, so we cast the volatile away. We cannot cast directly - // to void, because gcc treats that as not using the result of the - // assignment. However, casting to E& means that we trigger an - // unused-value warning. So, we cast the E& to void. - (void)const_cast(_elems[localBot] = t); - OrderAccess::release_store(&_bottom, increment_index(localBot)); - TASKQUEUE_STATS_ONLY(stats.record_push()); - return true; - } - return false; -} - // pop_local_slow() is done by the owning thread and is trying to // get the last task in the queue. It will compete with pop_global() // that will be used by other threads. The tag age is incremented @@ -469,16 +451,6 @@ }; template -bool OverflowTaskQueue::push(E t) -{ - if (!taskqueue_t::push(t)) { - overflow_stack()->push(t); - TASKQUEUE_STATS_ONLY(stats.record_overflow(overflow_stack()->size())); - } - return true; -} - -template bool OverflowTaskQueue::pop_overflow(E& t) { if (overflow_empty()) return false; @@ -650,28 +622,6 @@ }; template inline bool -GenericTaskQueue::push(E t) { - uint localBot = _bottom; - assert(localBot < N, "_bottom out of range."); - idx_t top = _age.top(); - uint dirty_n_elems = dirty_size(localBot, top); - assert(dirty_n_elems < N, "n_elems out of range."); - if (dirty_n_elems < max_elems()) { - // g++ complains if the volatile result of the assignment is - // unused, so we cast the volatile away. We cannot cast directly - // to void, because gcc treats that as not using the result of the - // assignment. However, casting to E& means that we trigger an - // unused-value warning. So, we cast the E& to void. - (void) const_cast(_elems[localBot] = t); - OrderAccess::release_store(&_bottom, increment_index(localBot)); - TASKQUEUE_STATS_ONLY(stats.record_push()); - return true; - } else { - return push_slow(t, dirty_n_elems); - } -} - -template inline bool GenericTaskQueue::pop_local(volatile E& t) { uint localBot = _bottom; // This value cannot be N-1. That can only occur as a result of diff --git a/src/share/vm/utilities/taskqueue.inline.hpp b/src/share/vm/utilities/taskqueue.inline.hpp new file mode 100644 --- /dev/null +++ b/src/share/vm/utilities/taskqueue.inline.hpp @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_UTILITIES_TASKQUEUE_INLINE_HPP +#define SHARE_VM_UTILITIES_TASKQUEUE_INLINE_HPP + +#include "utilities/debug.hpp" +#include "utilities/taskqueue.hpp" +#include "utilities/stack.inline.hpp" +#include "runtime/orderAccess.inline.hpp" + +template +bool GenericTaskQueue::push_slow(E t, uint dirty_n_elems) { + if (dirty_n_elems == N - 1) { + // Actually means 0, so do the push. + uint localBot = _bottom; + // g++ complains if the volatile result of the assignment is + // unused, so we cast the volatile away. We cannot cast directly + // to void, because gcc treats that as not using the result of the + // assignment. However, casting to E& means that we trigger an + // unused-value warning. So, we cast the E& to void. + (void)const_cast(_elems[localBot] = t); + OrderAccess::release_store(&_bottom, increment_index(localBot)); + TASKQUEUE_STATS_ONLY(stats.record_push()); + return true; + } + return false; +} + +template inline bool +GenericTaskQueue::push(E t) { + uint localBot = _bottom; + assert(localBot < N, "_bottom out of range."); + idx_t top = _age.top(); + uint dirty_n_elems = dirty_size(localBot, top); + assert(dirty_n_elems < N, "n_elems out of range."); + if (dirty_n_elems < max_elems()) { + // g++ complains if the volatile result of the assignment is + // unused, so we cast the volatile away. We cannot cast directly + // to void, because gcc treats that as not using the result of the + // assignment. However, casting to E& means that we trigger an + // unused-value warning. So, we cast the E& to void. + (void) const_cast(_elems[localBot] = t); + OrderAccess::release_store(&_bottom, increment_index(localBot)); + TASKQUEUE_STATS_ONLY(stats.record_push()); + return true; + } else { + return push_slow(t, dirty_n_elems); + } +} + +template +inline bool OverflowTaskQueue::push(E t) +{ + if (!taskqueue_t::push(t)) { + overflow_stack()->push(t); + TASKQUEUE_STATS_ONLY(stats.record_overflow(overflow_stack()->size())); + } + return true; +} + +#endif // SHARE_VM_UTILITIES_TASKQUEUE_INLINE_HPP