mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-06 03:35:10 +00:00
8300264: Remove metaprogramming/isPointer.hpp
Reviewed-by: kbarrett, tschatzl
This commit is contained in:
parent
08e621829b
commit
eba87a0ee0
@ -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 <typename T> class IsPointer: public FalseType {};
|
||||
|
||||
template <typename T> class IsPointer<T*>: public TrueType {};
|
||||
template <typename T> class IsPointer<T* const>: public TrueType {};
|
||||
template <typename T> class IsPointer<T* volatile>: public TrueType {};
|
||||
template <typename T> class IsPointer<T* const volatile>: public TrueType {};
|
||||
|
||||
#endif // SHARE_METAPROGRAMMING_ISPOINTER_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<decorators, INTERNAL_VALUE_IS_OOP>::value || // oops have already been validated
|
||||
(IsPointer<T>::value || std::is_integral<T>::value) ||
|
||||
(std::is_pointer<T>::value || std::is_integral<T>::value) ||
|
||||
std::is_floating_point<T>::value)); // not allowed primitive type
|
||||
}
|
||||
|
||||
|
||||
@ -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<typename T, typename PlatformOp>
|
||||
struct Atomic::LoadImpl<
|
||||
T,
|
||||
PlatformOp,
|
||||
typename EnableIf<std::is_integral<T>::value || IsPointer<T>::value>::type>
|
||||
typename EnableIf<std::is_integral<T>::value || std::is_pointer<T>::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<typename D>
|
||||
inline void Atomic::inc(D volatile* dest, atomic_memory_order order) {
|
||||
STATIC_ASSERT(IsPointer<D>::value || std::is_integral<D>::value);
|
||||
using I = std::conditional_t<IsPointer<D>::value, ptrdiff_t, D>;
|
||||
STATIC_ASSERT(std::is_pointer<D>::value || std::is_integral<D>::value);
|
||||
using I = std::conditional_t<std::is_pointer<D>::value, ptrdiff_t, D>;
|
||||
Atomic::add(dest, I(1), order);
|
||||
}
|
||||
|
||||
template<typename D>
|
||||
inline void Atomic::dec(D volatile* dest, atomic_memory_order order) {
|
||||
STATIC_ASSERT(IsPointer<D>::value || std::is_integral<D>::value);
|
||||
using I = std::conditional_t<IsPointer<D>::value, ptrdiff_t, D>;
|
||||
STATIC_ASSERT(std::is_pointer<D>::value || std::is_integral<D>::value);
|
||||
using I = std::conditional_t<std::is_pointer<D>::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<typename D, typename I>
|
||||
inline D Atomic::sub(D volatile* dest, I sub_value, atomic_memory_order order) {
|
||||
STATIC_ASSERT(IsPointer<D>::value || std::is_integral<D>::value);
|
||||
STATIC_ASSERT(std::is_pointer<D>::value || std::is_integral<D>::value);
|
||||
STATIC_ASSERT(std::is_integral<I>::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<IsSigned<I>::value, intptr_t, uintptr_t>;
|
||||
using AddendType = std::conditional_t<IsPointer<D>::value, PI, D>;
|
||||
using AddendType = std::conditional_t<std::is_pointer<D>::value, PI, D>;
|
||||
// Only allow conversions that can't change the value.
|
||||
STATIC_ASSERT(IsSigned<I>::value == IsSigned<AddendType>::value);
|
||||
STATIC_ASSERT(sizeof(I) <= sizeof(AddendType));
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#include "utilities/numberSeq.hpp"
|
||||
#include "utilities/spinYield.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// 2^30 = 1G buckets
|
||||
#define SIZE_BIG_LOG2 30
|
||||
// 2^2 = 4 buckets
|
||||
@ -502,7 +504,7 @@ inline void ConcurrentHashTable<CONFIG, F>::
|
||||
Bucket* prefetch_bucket = (bucket_it+1) < stop_idx ?
|
||||
table->get_bucket(bucket_it+1) : NULL;
|
||||
|
||||
if (!HaveDeletables<IsPointer<VALUE>::value, EVALUATE_FUNC>::
|
||||
if (!HaveDeletables<std::is_pointer<VALUE>::value, EVALUATE_FUNC>::
|
||||
have_deletable(bucket, eval_f, prefetch_bucket)) {
|
||||
// Nothing to remove in this bucket.
|
||||
continue;
|
||||
|
||||
@ -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<void*>::value;
|
||||
STATIC_ASSERT(ip_voidptr);
|
||||
|
||||
static const bool ip_Aptr = IsPointer<A*>::value;
|
||||
STATIC_ASSERT(ip_Aptr);
|
||||
|
||||
static const bool ip_cAptr = IsPointer<const A*>::value;
|
||||
STATIC_ASSERT(ip_cAptr);
|
||||
|
||||
static const bool ip_vAptr = IsPointer<volatile A*>::value;
|
||||
STATIC_ASSERT(ip_vAptr);
|
||||
|
||||
static const bool ip_Avptr = IsPointer<A* volatile>::value;
|
||||
STATIC_ASSERT(ip_Avptr);
|
||||
|
||||
static const bool ip_intptrt = IsPointer<intptr_t>::value;
|
||||
STATIC_ASSERT(!ip_intptrt);
|
||||
|
||||
static const bool ip_char = IsPointer<char>::value;
|
||||
STATIC_ASSERT(!ip_char);
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user