--- old/src/hotspot/share/gc/z/zAddress.cpp 2018-02-22 08:31:55.161714252 +0100 +++ new/src/hotspot/share/gc/z/zAddress.cpp 2018-02-22 08:31:55.004707524 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -31,8 +31,6 @@ ZAddressGoodMask = mask; ZAddressBadMask = ZAddressGoodMask ^ ZAddressMetadataMask; ZAddressWeakBadMask = (ZAddressGoodMask | ZAddressMetadataRemapped | ZAddressMetadataFinalizable) ^ ZAddressMetadataMask; - - platform_set_bad_mask(old_bad_mask, ZAddressBadMask); } void ZAddressMasks::initialize() { --- old/src/hotspot/share/gc/z/zAddress.hpp 2018-02-22 08:31:55.417725222 +0100 +++ new/src/hotspot/share/gc/z/zAddress.hpp 2018-02-22 08:31:55.257718366 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -55,7 +55,6 @@ friend class ZAddressTest; private: - static void platform_set_bad_mask(uintptr_t old_mask, uintptr_t new_mask); static void set_good_mask(uintptr_t mask); public: --- old/src/hotspot/share/gc/z/zRootsIterator.cpp 2018-02-22 08:31:55.659735593 +0100 +++ new/src/hotspot/share/gc/z/zRootsIterator.cpp 2018-02-22 08:31:55.501728822 +0100 @@ -29,6 +29,7 @@ #include "code/codeCache.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/oopStorageParState.inline.hpp" +#include "gc/z/zGlobals.hpp" #include "gc/z/zNMethodTable.hpp" #include "gc/z/zOopClosures.inline.hpp" #include "gc/z/zRootsIterator.hpp" @@ -214,10 +215,31 @@ ClassLoaderDataGraph::cld_do(&cld_cl); } +class ZRootsIteratorThreadClosure : public ThreadClosure { +private: + OopClosure* const _cl; + +public: + ZRootsIteratorThreadClosure(OopClosure* cl) : + _cl(cl) {} + + virtual void do_thread(Thread* thread) { + if (thread->is_Java_thread()) { + // Update thread local adddress bad mask + JavaThread* const java_thread = (JavaThread*)thread; + java_thread->set_zaddress_bad_mask(ZAddressBadMask); + } + + // Process thread oops + thread->oops_do(_cl, NULL); + } +}; + void ZRootsIterator::do_threads(OopClosure* cl) { ZStatTimer timer(ZSubPhasePauseRootsThreads); ResourceMark rm; - Threads::possibly_parallel_oops_do(true, cl, NULL); + ZRootsIteratorThreadClosure thread_cl(cl); + Threads::possibly_parallel_threads_do(true, &thread_cl); } void ZRootsIterator::do_code_cache(OopClosure* cl) { --- old/src/hotspot/os_cpu/linux_x86/zAddress_linux_x86.cpp 2018-02-22 08:31:55.922746863 +0100 +++ /dev/null 2018-02-16 08:22:25.482788954 +0100 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -#include "precompiled.hpp" -#include "gc/z/zAddress.hpp" -#include "runtime/thread.hpp" -#include "runtime/threadSMR.hpp" -#include "utilities/debug.hpp" - -void ZAddressMasks::platform_set_bad_mask(uintptr_t old_mask, uintptr_t new_mask) { - if (!UseR15TestInLoadBarrier) { - // R15-based test not used in load barriers - return; - } - - // Update bad mask in all Java threads - for (JavaThreadIteratorWithHandle jtiwh; JavaThread* thread = jtiwh.next();) { - assert(thread->zaddress_bad_mask() == old_mask, "Previous bad mask is invalid"); - thread->set_zaddress_bad_mask(new_mask); - } -} --- old/src/hotspot/os_cpu/solaris_sparc/zAddress_solaris_sparc.cpp 2018-02-22 08:31:56.131755820 +0100 +++ /dev/null 2018-02-16 08:22:25.482788954 +0100 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -#include "precompiled.hpp" -#include "gc/z/zAddress.hpp" - -void ZAddressMasks::platform_set_bad_mask(uintptr_t old_mask, uintptr_t new_mask) { - // Does nothing -} -