From eba87a0ee0410f61ae764293986ecc162f48c707 Mon Sep 17 00:00:00 2001 From: Justin King Date: Thu, 19 Jan 2023 09:11:22 +0000 Subject: [PATCH] 8300264: Remove metaprogramming/isPointer.hpp Reviewed-by: kbarrett, tschatzl --- .../share/metaprogramming/isPointer.hpp | 40 -------------- src/hotspot/share/oops/accessBackend.hpp | 3 +- src/hotspot/share/runtime/atomic.hpp | 15 +++--- .../utilities/concurrentHashTable.inline.hpp | 4 +- .../gtest/metaprogramming/test_isPointer.cpp | 53 ------------------- 5 files changed, 11 insertions(+), 104 deletions(-) delete mode 100644 src/hotspot/share/metaprogramming/isPointer.hpp delete mode 100644 test/hotspot/gtest/metaprogramming/test_isPointer.cpp diff --git a/src/hotspot/share/metaprogramming/isPointer.hpp b/src/hotspot/share/metaprogramming/isPointer.hpp deleted file mode 100644 index aa1bdefa16b..00000000000 --- a/src/hotspot/share/metaprogramming/isPointer.hpp +++ /dev/null @@ -1,40 +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_ISPOINTER_HPP -#define SHARE_METAPROGRAMMING_ISPOINTER_HPP - -#include "metaprogramming/integralConstant.hpp" - -// This metafunction returns true iff the type T is (irrespective of CV qualifiers) -// a pointer type. - -template class IsPointer: public FalseType {}; - -template class IsPointer: public TrueType {}; -template class IsPointer: public TrueType {}; -template class IsPointer: public TrueType {}; -template class IsPointer: public TrueType {}; - -#endif // SHARE_METAPROGRAMMING_ISPOINTER_HPP diff --git a/src/hotspot/share/oops/accessBackend.hpp b/src/hotspot/share/oops/accessBackend.hpp index b8150b379a6..59befa762bf 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/isPointer.hpp" #include "metaprogramming/isSame.hpp" #include "oops/accessDecorators.hpp" #include "oops/oopsHierarchy.hpp" @@ -1092,7 +1091,7 @@ namespace AccessInternal { // If this fails to compile, then you have sent in something that is // not recognized as a valid primitive type to a primitive Access function. STATIC_ASSERT((HasDecorator::value || // oops have already been validated - (IsPointer::value || std::is_integral::value) || + (std::is_pointer::value || std::is_integral::value) || std::is_floating_point::value)); // not allowed primitive type } diff --git a/src/hotspot/share/runtime/atomic.hpp b/src/hotspot/share/runtime/atomic.hpp index 611588b965c..5c5c4008304 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/isPointer.hpp" #include "metaprogramming/isSame.hpp" #include "metaprogramming/isSigned.hpp" #include "metaprogramming/primitiveConversions.hpp" @@ -391,7 +390,7 @@ template struct Atomic::LoadImpl< T, PlatformOp, - typename EnableIf::value || IsPointer::value>::type> + typename EnableIf::value || std::is_pointer::value>::type> { T operator()(T const volatile* dest) const { // Forward to the platform handler for the size of T. @@ -508,15 +507,15 @@ struct Atomic::PlatformStore { template inline void Atomic::inc(D volatile* dest, atomic_memory_order order) { - STATIC_ASSERT(IsPointer::value || std::is_integral::value); - using I = std::conditional_t::value, ptrdiff_t, D>; + STATIC_ASSERT(std::is_pointer::value || std::is_integral::value); + using I = std::conditional_t::value, ptrdiff_t, D>; Atomic::add(dest, I(1), order); } template inline void Atomic::dec(D volatile* dest, atomic_memory_order order) { - STATIC_ASSERT(IsPointer::value || std::is_integral::value); - using I = std::conditional_t::value, ptrdiff_t, D>; + STATIC_ASSERT(std::is_pointer::value || std::is_integral::value); + using I = std::conditional_t::value, ptrdiff_t, D>; // Assumes two's complement integer representation. #pragma warning(suppress: 4146) Atomic::add(dest, I(-1), order); @@ -524,12 +523,12 @@ inline void Atomic::dec(D volatile* dest, atomic_memory_order order) { template inline D Atomic::sub(D volatile* dest, I sub_value, atomic_memory_order order) { - STATIC_ASSERT(IsPointer::value || std::is_integral::value); + STATIC_ASSERT(std::is_pointer::value || std::is_integral::value); STATIC_ASSERT(std::is_integral::value); // If D is a pointer type, use [u]intptr_t as the addend type, // matching signedness of I. Otherwise, use D as the addend type. using PI = std::conditional_t::value, intptr_t, uintptr_t>; - using AddendType = std::conditional_t::value, PI, D>; + using AddendType = std::conditional_t::value, PI, D>; // Only allow conversions that can't change the value. STATIC_ASSERT(IsSigned::value == IsSigned::value); STATIC_ASSERT(sizeof(I) <= sizeof(AddendType)); diff --git a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp index 285b1c997e2..e0ca3b60add 100644 --- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp +++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp @@ -37,6 +37,8 @@ #include "utilities/numberSeq.hpp" #include "utilities/spinYield.hpp" +#include + // 2^30 = 1G buckets #define SIZE_BIG_LOG2 30 // 2^2 = 4 buckets @@ -502,7 +504,7 @@ inline void ConcurrentHashTable:: Bucket* prefetch_bucket = (bucket_it+1) < stop_idx ? table->get_bucket(bucket_it+1) : NULL; - if (!HaveDeletables::value, EVALUATE_FUNC>:: + if (!HaveDeletables::value, EVALUATE_FUNC>:: have_deletable(bucket, eval_f, prefetch_bucket)) { // Nothing to remove in this bucket. continue; diff --git a/test/hotspot/gtest/metaprogramming/test_isPointer.cpp b/test/hotspot/gtest/metaprogramming/test_isPointer.cpp deleted file mode 100644 index ff3efd3d0c2..00000000000 --- a/test/hotspot/gtest/metaprogramming/test_isPointer.cpp +++ /dev/null @@ -1,53 +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/isPointer.hpp" -#include "utilities/debug.hpp" - -class IsPointerTest: AllStatic { - class A: AllStatic {}; - - static const bool ip_voidptr = IsPointer::value; - STATIC_ASSERT(ip_voidptr); - - static const bool ip_Aptr = IsPointer::value; - STATIC_ASSERT(ip_Aptr); - - static const bool ip_cAptr = IsPointer::value; - STATIC_ASSERT(ip_cAptr); - - static const bool ip_vAptr = IsPointer::value; - STATIC_ASSERT(ip_vAptr); - - static const bool ip_Avptr = IsPointer::value; - STATIC_ASSERT(ip_Avptr); - - static const bool ip_intptrt = IsPointer::value; - STATIC_ASSERT(!ip_intptrt); - - static const bool ip_char = IsPointer::value; - STATIC_ASSERT(!ip_char); -};