From c8dd7583a92082bcd2a4dfd5429889e7f0a44050 Mon Sep 17 00:00:00 2001 From: Justin King Date: Sat, 21 Jan 2023 15:03:26 +0000 Subject: [PATCH] 8300260: Remove metaprogramming/isSame.hpp Reviewed-by: tschatzl, kbarrett --- src/hotspot/share/metaprogramming/isSame.hpp | 38 -------------- src/hotspot/share/oops/accessBackend.hpp | 7 ++- src/hotspot/share/runtime/atomic.hpp | 5 +- .../share/utilities/devirtualizer.inline.hpp | 24 +++++---- .../gtest/metaprogramming/test_isSame.cpp | 51 ------------------- .../gtest/metaprogramming/test_isSigned.cpp | 1 - .../test_primitiveConversions.cpp | 1 - 7 files changed, 18 insertions(+), 109 deletions(-) delete mode 100644 src/hotspot/share/metaprogramming/isSame.hpp delete mode 100644 test/hotspot/gtest/metaprogramming/test_isSame.cpp diff --git a/src/hotspot/share/metaprogramming/isSame.hpp b/src/hotspot/share/metaprogramming/isSame.hpp deleted file mode 100644 index aaaa621d151..00000000000 --- a/src/hotspot/share/metaprogramming/isSame.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017, 2019, 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_METAPROGRAMMING_ISSAME_HPP -#define SHARE_METAPROGRAMMING_ISSAME_HPP - -#include "metaprogramming/integralConstant.hpp" - -// This trait returns true iff the two types X and Y are the same - -template -struct IsSame: public FalseType {}; - -template -struct IsSame: public TrueType {}; - -#endif // SHARE_METAPROGRAMMING_ISSAME_HPP diff --git a/src/hotspot/share/oops/accessBackend.hpp b/src/hotspot/share/oops/accessBackend.hpp index 59befa762bf..2fdceab3721 100644 --- a/src/hotspot/share/oops/accessBackend.hpp +++ b/src/hotspot/share/oops/accessBackend.hpp @@ -29,7 +29,6 @@ #include "memory/allocation.hpp" #include "metaprogramming/enableIf.hpp" #include "metaprogramming/integralConstant.hpp" -#include "metaprogramming/isSame.hpp" #include "oops/accessDecorators.hpp" #include "oops/oopsHierarchy.hpp" #include "runtime/globals.hpp" @@ -64,8 +63,8 @@ namespace AccessInternal { template struct MustConvertCompressedOop: public IntegralConstant::value && - IsSame::type, narrowOop>::value && - IsSame::value> {}; + std::is_same::type, narrowOop>::value && + std::is_same::value> {}; // This metafunction returns an appropriate oop type if the value is oop-like // and otherwise returns the same type T. @@ -1211,7 +1210,7 @@ namespace AccessInternal { arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, size_t length) { STATIC_ASSERT((HasDecorator::value || - (IsSame::value || std::is_integral::value) || + (std::is_same::value || std::is_integral::value) || std::is_floating_point::value)); // arraycopy allows type erased void elements using DecayedT = std::decay_t; const DecoratorSet expanded_decorators = DecoratorFixup::value; diff --git a/src/hotspot/share/runtime/atomic.hpp b/src/hotspot/share/runtime/atomic.hpp index 5c5c4008304..523a5b9ca42 100644 --- a/src/hotspot/share/runtime/atomic.hpp +++ b/src/hotspot/share/runtime/atomic.hpp @@ -27,7 +27,6 @@ #include "memory/allocation.hpp" #include "metaprogramming/enableIf.hpp" -#include "metaprogramming/isSame.hpp" #include "metaprogramming/isSigned.hpp" #include "metaprogramming/primitiveConversions.hpp" #include "runtime/orderAccess.hpp" @@ -791,8 +790,8 @@ template struct Atomic::CmpxchgImpl< D*, U*, T*, typename EnableIf::value && - IsSame, - std::remove_cv_t>::value>::type> + std::is_same, + std::remove_cv_t>::value>::type> { D* operator()(D* volatile* dest, U* compare_value, T* exchange_value, atomic_memory_order order) const { diff --git a/src/hotspot/share/utilities/devirtualizer.inline.hpp b/src/hotspot/share/utilities/devirtualizer.inline.hpp index d995301c77e..001596874cc 100644 --- a/src/hotspot/share/utilities/devirtualizer.inline.hpp +++ b/src/hotspot/share/utilities/devirtualizer.inline.hpp @@ -31,6 +31,8 @@ #include "oops/access.inline.hpp" #include "utilities/debug.hpp" +#include + // Implementation of the non-virtual do_oop dispatch. // // The same implementation is used for do_metadata, do_klass, and do_cld. @@ -73,16 +75,16 @@ // p - The oop (or narrowOop) field to pass to the closure template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_oop(void (Receiver::*)(T*), void (Base::*)(T*), OopClosureType* closure, T* p) { closure->do_oop(p); } template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_oop(void (Receiver::*)(T*), void (Base::*)(T*), OopClosureType* closure, T* p) { // Sanity check - STATIC_ASSERT((!IsSame::value)); + STATIC_ASSERT((!std::is_same::value)); closure->OopClosureType::do_oop(p); } @@ -94,13 +96,13 @@ inline void Devirtualizer::do_oop(OopClosureType* closure, T* p) { // Implementation of the non-virtual do_metadata dispatch. template -static typename EnableIf::value, bool>::type +static typename EnableIf::value, bool>::type call_do_metadata(bool (Receiver::*)(), bool (Base::*)(), OopClosureType* closure) { return closure->do_metadata(); } template -static typename EnableIf::value, bool>::type +static typename EnableIf::value, bool>::type call_do_metadata(bool (Receiver::*)(), bool (Base::*)(), OopClosureType* closure) { return closure->OopClosureType::do_metadata(); } @@ -113,13 +115,13 @@ inline bool Devirtualizer::do_metadata(OopClosureType* closure) { // Implementation of the non-virtual do_klass dispatch. template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_klass(void (Receiver::*)(Klass*), void (Base::*)(Klass*), OopClosureType* closure, Klass* k) { closure->do_klass(k); } template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_klass(void (Receiver::*)(Klass*), void (Base::*)(Klass*), OopClosureType* closure, Klass* k) { closure->OopClosureType::do_klass(k); } @@ -132,13 +134,13 @@ inline void Devirtualizer::do_klass(OopClosureType* closure, Klass* k) { // Implementation of the non-virtual do_cld dispatch. template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_cld(void (Receiver::*)(ClassLoaderData*), void (Base::*)(ClassLoaderData*), OopClosureType* closure, ClassLoaderData* cld) { closure->do_cld(cld); } template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_cld(void (Receiver::*)(ClassLoaderData*), void (Base::*)(ClassLoaderData*), OopClosureType* closure, ClassLoaderData* cld) { closure->OopClosureType::do_cld(cld); } @@ -151,13 +153,13 @@ void Devirtualizer::do_cld(OopClosureType* closure, ClassLoaderData* cld) { // Implementation of the non-virtual do_derived_oop dispatch. template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_derived_oop(void (Receiver::*)(oop*, derived_pointer*), void (Base::*)(oop*, derived_pointer*), DerivedOopClosureType* closure, oop* base, derived_pointer* derived) { closure->do_derived_oop(base, derived); } template -static typename EnableIf::value, void>::type +static typename EnableIf::value, void>::type call_do_derived_oop(void (Receiver::*)(oop*, derived_pointer*), void (Base::*)(oop*, derived_pointer*), DerivedOopClosureType* closure, oop* base, derived_pointer* derived) { closure->DerivedOopClosureType::do_derived_oop(base, derived); } diff --git a/test/hotspot/gtest/metaprogramming/test_isSame.cpp b/test/hotspot/gtest/metaprogramming/test_isSame.cpp deleted file mode 100644 index c2313bbb175..00000000000 --- a/test/hotspot/gtest/metaprogramming/test_isSame.cpp +++ /dev/null @@ -1,51 +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 "memory/allocation.hpp" -#include "metaprogramming/isSame.hpp" -#include "utilities/debug.hpp" - -class IsSameTest: AllStatic { - class A: AllStatic {}; - class B: AllStatic {}; - - static const bool const_A_is_A = IsSame::value; - STATIC_ASSERT(!const_A_is_A); - - static const bool volatile_A_is_A = IsSame::value; - STATIC_ASSERT(!volatile_A_is_A); - - static const bool Aref_is_A = IsSame::value; - STATIC_ASSERT(!Aref_is_A); - - static const bool Aptr_is_A = IsSame::value; - STATIC_ASSERT(!Aptr_is_A); - - static const bool A_is_B = IsSame::value; - STATIC_ASSERT(!A_is_B); - - static const bool A_is_A = IsSame::value; - STATIC_ASSERT(A_is_A); -}; diff --git a/test/hotspot/gtest/metaprogramming/test_isSigned.cpp b/test/hotspot/gtest/metaprogramming/test_isSigned.cpp index c67f5116553..4da3ab85de6 100644 --- a/test/hotspot/gtest/metaprogramming/test_isSigned.cpp +++ b/test/hotspot/gtest/metaprogramming/test_isSigned.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" -#include "metaprogramming/isSame.hpp" #include "metaprogramming/isSigned.hpp" #include "utilities/debug.hpp" diff --git a/test/hotspot/gtest/metaprogramming/test_primitiveConversions.cpp b/test/hotspot/gtest/metaprogramming/test_primitiveConversions.cpp index e9c70b11562..2a0d78538e7 100644 --- a/test/hotspot/gtest/metaprogramming/test_primitiveConversions.cpp +++ b/test/hotspot/gtest/metaprogramming/test_primitiveConversions.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "memory/allocation.hpp" -#include "metaprogramming/isSame.hpp" #include "metaprogramming/primitiveConversions.hpp" #include "unittest.hpp" #include "utilities/debug.hpp"