8300260: Remove metaprogramming/isSame.hpp

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Justin King 2023-01-21 15:03:26 +00:00 committed by Kim Barrett
parent a6c2a2ae79
commit c8dd7583a9
7 changed files with 18 additions and 109 deletions

View File

@ -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 <typename X, typename Y>
struct IsSame: public FalseType {};
template <typename X>
struct IsSame<X, X>: public TrueType {};
#endif // SHARE_METAPROGRAMMING_ISSAME_HPP

View File

@ -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 <DecoratorSet decorators, typename T>
struct MustConvertCompressedOop: public IntegralConstant<bool,
HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
IsSame<typename HeapOopType<decorators>::type, narrowOop>::value &&
IsSame<T, oop>::value> {};
std::is_same<typename HeapOopType<decorators>::type, narrowOop>::value &&
std::is_same<T, oop>::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<decorators, INTERNAL_VALUE_IS_OOP>::value ||
(IsSame<T, void>::value || std::is_integral<T>::value) ||
(std::is_same<T, void>::value || std::is_integral<T>::value) ||
std::is_floating_point<T>::value)); // arraycopy allows type erased void elements
using DecayedT = std::decay_t<T>;
const DecoratorSet expanded_decorators = DecoratorFixup<decorators | IS_ARRAY | IN_HEAP>::value;

View File

@ -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<typename D, typename U, typename T>
struct Atomic::CmpxchgImpl<
D*, U*, T*,
typename EnableIf<Atomic::IsPointerConvertible<T*, D*>::value &&
IsSame<std::remove_cv_t<D>,
std::remove_cv_t<U>>::value>::type>
std::is_same<std::remove_cv_t<D>,
std::remove_cv_t<U>>::value>::type>
{
D* operator()(D* volatile* dest, U* compare_value, T* exchange_value,
atomic_memory_order order) const {

View File

@ -31,6 +31,8 @@
#include "oops/access.inline.hpp"
#include "utilities/debug.hpp"
#include <type_traits>
// 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 <typename T, typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<std::is_same<Receiver, Base>::value, void>::type
call_do_oop(void (Receiver::*)(T*), void (Base::*)(T*), OopClosureType* closure, T* p) {
closure->do_oop(p);
}
template <typename T, typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<!IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<!std::is_same<Receiver, Base>::value, void>::type
call_do_oop(void (Receiver::*)(T*), void (Base::*)(T*), OopClosureType* closure, T* p) {
// Sanity check
STATIC_ASSERT((!IsSame<OopClosureType, OopIterateClosure>::value));
STATIC_ASSERT((!std::is_same<OopClosureType, OopIterateClosure>::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 <typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<IsSame<Receiver, Base>::value, bool>::type
static typename EnableIf<std::is_same<Receiver, Base>::value, bool>::type
call_do_metadata(bool (Receiver::*)(), bool (Base::*)(), OopClosureType* closure) {
return closure->do_metadata();
}
template <typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<!IsSame<Receiver, Base>::value, bool>::type
static typename EnableIf<!std::is_same<Receiver, Base>::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 <typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<std::is_same<Receiver, Base>::value, void>::type
call_do_klass(void (Receiver::*)(Klass*), void (Base::*)(Klass*), OopClosureType* closure, Klass* k) {
closure->do_klass(k);
}
template <typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<!IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<!std::is_same<Receiver, Base>::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 <typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<std::is_same<Receiver, Base>::value, void>::type
call_do_cld(void (Receiver::*)(ClassLoaderData*), void (Base::*)(ClassLoaderData*), OopClosureType* closure, ClassLoaderData* cld) {
closure->do_cld(cld);
}
template <typename Receiver, typename Base, typename OopClosureType>
static typename EnableIf<!IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<!std::is_same<Receiver, Base>::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 <typename Receiver, typename Base, typename DerivedOopClosureType>
static typename EnableIf<IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<std::is_same<Receiver, Base>::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 <typename Receiver, typename Base, typename DerivedOopClosureType>
static typename EnableIf<!IsSame<Receiver, Base>::value, void>::type
static typename EnableIf<!std::is_same<Receiver, Base>::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);
}

View File

@ -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<const A, A>::value;
STATIC_ASSERT(!const_A_is_A);
static const bool volatile_A_is_A = IsSame<volatile A, A>::value;
STATIC_ASSERT(!volatile_A_is_A);
static const bool Aref_is_A = IsSame<A&, A>::value;
STATIC_ASSERT(!Aref_is_A);
static const bool Aptr_is_A = IsSame<A*, A>::value;
STATIC_ASSERT(!Aptr_is_A);
static const bool A_is_B = IsSame<A, B>::value;
STATIC_ASSERT(!A_is_B);
static const bool A_is_A = IsSame<A, A>::value;
STATIC_ASSERT(A_is_A);
};

View File

@ -24,7 +24,6 @@
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isSame.hpp"
#include "metaprogramming/isSigned.hpp"
#include "utilities/debug.hpp"

View File

@ -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"