8300910: Remove metaprogramming/integralConstant.hpp
Reviewed-by: kbarrett, tschatzl
This commit is contained in:
parent
544c16e0bd
commit
048705c049
@ -1,59 +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_INTEGRALCONSTANT_HPP
|
||||
#define SHARE_METAPROGRAMMING_INTEGRALCONSTANT_HPP
|
||||
|
||||
|
||||
// An Integral Constant is a class providing a compile-time value of an
|
||||
// integral type. An Integral Constant is also a nullary metafunction,
|
||||
// returning itself. An integral constant object is implicitly
|
||||
// convertible to the associated value.
|
||||
//
|
||||
// A type n is a model of Integral Constant if it meets the following
|
||||
// requirements:
|
||||
//
|
||||
// n::ValueType : The integral type of n::value
|
||||
// n::value : An integral constant expression
|
||||
// n::type : IsSame<n::type, n>::value is true
|
||||
// n::value_type const c = n() : c == n::value
|
||||
|
||||
// A model of the Integer Constant concept.
|
||||
// T is an integral type, and is the value_type.
|
||||
// v is an integral constant, and is the value.
|
||||
template<typename T, T v>
|
||||
struct IntegralConstant {
|
||||
typedef T value_type;
|
||||
static const value_type value = v;
|
||||
typedef IntegralConstant<T, v> type;
|
||||
operator value_type() { return value; }
|
||||
};
|
||||
|
||||
// A bool valued IntegralConstant whose value is true.
|
||||
typedef IntegralConstant<bool, true> TrueType;
|
||||
|
||||
// A bool valued IntegralConstant whose value is false.
|
||||
typedef IntegralConstant<bool, false> FalseType;
|
||||
|
||||
#endif // SHARE_METAPROGRAMMING_INTEGRALCONSTANT_HPP
|
@ -28,7 +28,6 @@
|
||||
#include "gc/shared/barrierSetConfig.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "metaprogramming/enableIf.hpp"
|
||||
#include "metaprogramming/integralConstant.hpp"
|
||||
#include "oops/accessDecorators.hpp"
|
||||
#include "oops/oopsHierarchy.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
@ -61,7 +60,7 @@ namespace AccessInternal {
|
||||
};
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
struct MustConvertCompressedOop: public IntegralConstant<bool,
|
||||
struct MustConvertCompressedOop: public std::integral_constant<bool,
|
||||
HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
|
||||
std::is_same<typename HeapOopType<decorators>::type, narrowOop>::value &&
|
||||
std::is_same<T, oop>::value> {};
|
||||
@ -86,9 +85,9 @@ namespace AccessInternal {
|
||||
// locking to support wide atomics or not.
|
||||
template <typename T>
|
||||
#ifdef SUPPORTS_NATIVE_CX8
|
||||
struct PossiblyLockedAccess: public IntegralConstant<bool, false> {};
|
||||
struct PossiblyLockedAccess: public std::false_type {};
|
||||
#else
|
||||
struct PossiblyLockedAccess: public IntegralConstant<bool, (sizeof(T) > 4)> {};
|
||||
struct PossiblyLockedAccess: public std::integral_constant<bool, (sizeof(T) > 4)> {};
|
||||
#endif
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
@ -626,7 +625,7 @@ namespace AccessInternal {
|
||||
// not possible.
|
||||
struct PreRuntimeDispatch: AllStatic {
|
||||
template<DecoratorSet decorators>
|
||||
struct CanHardwireRaw: public IntegralConstant<
|
||||
struct CanHardwireRaw: public std::integral_constant<
|
||||
bool,
|
||||
!HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value || // primitive access
|
||||
!HasDecorator<decorators, INTERNAL_CONVERT_COMPRESSED_OOP>::value || // don't care about compressed oops (oop* address)
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/orderAccess.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
inline typename EnableIf<
|
||||
@ -251,7 +253,7 @@ RawAccessBarrier<ds>::atomic_cmpxchg_maybe_locked(void* addr, T compare_value, T
|
||||
}
|
||||
|
||||
class RawAccessBarrierArrayCopy: public AllStatic {
|
||||
template<typename T> struct IsHeapWordSized: public IntegralConstant<bool, sizeof(T) == HeapWordSize> { };
|
||||
template<typename T> struct IsHeapWordSized: public std::integral_constant<bool, sizeof(T) == HeapWordSize> { };
|
||||
public:
|
||||
template <DecoratorSet decorators, typename T>
|
||||
static inline typename EnableIf<
|
||||
@ -334,7 +336,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct RawAccessBarrierArrayCopy::IsHeapWordSized<void>: public IntegralConstant<bool, false> { };
|
||||
template<> struct RawAccessBarrierArrayCopy::IsHeapWordSized<void>: public std::false_type { };
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
template <typename T>
|
||||
|
@ -27,9 +27,10 @@
|
||||
|
||||
#include "gc/shared/barrierSetConfig.hpp"
|
||||
#include "memory/allStatic.hpp"
|
||||
#include "metaprogramming/integralConstant.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// A decorator is an attribute or property that affects the way a memory access is performed in some way.
|
||||
// There are different groups of decorators. Some have to do with memory ordering, others to do with,
|
||||
// e.g. strength of references, strength of GC barriers, or whether compression should be applied or not.
|
||||
@ -41,7 +42,7 @@ typedef uint64_t DecoratorSet;
|
||||
// The HasDecorator trait can help at compile-time determining whether a decorator set
|
||||
// has an intersection with a certain other decorator set
|
||||
template <DecoratorSet decorators, DecoratorSet decorator>
|
||||
struct HasDecorator: public IntegralConstant<bool, (decorators & decorator) != 0> {};
|
||||
struct HasDecorator: public std::integral_constant<bool, (decorators & decorator) != 0> {};
|
||||
|
||||
// == General Decorators ==
|
||||
// * DECORATORS_NONE: This is the name for the empty decorator set (in absence of other decorators).
|
||||
|
@ -25,11 +25,12 @@
|
||||
#ifndef SHARE_OOPS_MARKWORD_HPP
|
||||
#define SHARE_OOPS_MARKWORD_HPP
|
||||
|
||||
#include "metaprogramming/integralConstant.hpp"
|
||||
#include "metaprogramming/primitiveConversions.hpp"
|
||||
#include "oops/oopsHierarchy.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// The markWord describes the header of an object.
|
||||
//
|
||||
// Bit-format of an object header (most significant first, big endian layout below):
|
||||
@ -248,7 +249,7 @@ class markWord {
|
||||
|
||||
// Support atomic operations.
|
||||
template<>
|
||||
struct PrimitiveConversions::Translate<markWord> : public TrueType {
|
||||
struct PrimitiveConversions::Translate<markWord> : public std::true_type {
|
||||
typedef markWord Value;
|
||||
typedef uintptr_t Decayed;
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "metaprogramming/primitiveConversions.hpp"
|
||||
#include "oops/oopsHierarchy.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
class OopStorage;
|
||||
|
||||
// Simple classes for wrapping oop and atomically accessed oop pointers
|
||||
@ -76,7 +78,7 @@ public:
|
||||
// Convert OopHandle to oop*
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversions::Translate<OopHandle> : public TrueType {
|
||||
struct PrimitiveConversions::Translate<OopHandle> : public std::true_type {
|
||||
typedef OopHandle Value;
|
||||
typedef oop* Decayed;
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
#ifndef SHARE_OOPS_OOPSHIERARCHY_HPP
|
||||
#define SHARE_OOPS_OOPSHIERARCHY_HPP
|
||||
|
||||
#include "metaprogramming/integralConstant.hpp"
|
||||
#include "metaprogramming/primitiveConversions.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
// OBJECT hierarchy
|
||||
// This hierarchy is a representation hierarchy, i.e. if A is a superclass
|
||||
// of B, A's representation is a prefix of B's representation.
|
||||
@ -108,7 +109,7 @@ public:
|
||||
};
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversions::Translate<oop> : public TrueType {
|
||||
struct PrimitiveConversions::Translate<oop> : public std::true_type {
|
||||
typedef oop Value;
|
||||
typedef oopDesc* Decayed;
|
||||
|
||||
@ -116,31 +117,31 @@ struct PrimitiveConversions::Translate<oop> : public TrueType {
|
||||
static Value recover(Decayed x) { return oop(x); }
|
||||
};
|
||||
|
||||
#define DEF_OOP(type) \
|
||||
class type##OopDesc; \
|
||||
class type##Oop : public oop { \
|
||||
public: \
|
||||
type##Oop() : oop() {} \
|
||||
type##Oop(const type##Oop& o) : oop(o) {} \
|
||||
type##Oop(const oop& o) : oop(o) {} \
|
||||
type##Oop(type##OopDesc* o) : oop((oopDesc*)o) {} \
|
||||
operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \
|
||||
type##OopDesc* operator->() const { \
|
||||
return (type##OopDesc*)obj(); \
|
||||
} \
|
||||
type##Oop& operator=(const type##Oop& o) { \
|
||||
oop::operator=(o); \
|
||||
return *this; \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template<> \
|
||||
struct PrimitiveConversions::Translate<type##Oop> : public TrueType { \
|
||||
typedef type##Oop Value; \
|
||||
typedef type##OopDesc* Decayed; \
|
||||
\
|
||||
static Decayed decay(Value x) { return (type##OopDesc*)x.obj(); } \
|
||||
static Value recover(Decayed x) { return type##Oop(x); } \
|
||||
#define DEF_OOP(type) \
|
||||
class type##OopDesc; \
|
||||
class type##Oop : public oop { \
|
||||
public: \
|
||||
type##Oop() : oop() {} \
|
||||
type##Oop(const type##Oop& o) : oop(o) {} \
|
||||
type##Oop(const oop& o) : oop(o) {} \
|
||||
type##Oop(type##OopDesc* o) : oop((oopDesc*)o) {} \
|
||||
operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \
|
||||
type##OopDesc* operator->() const { \
|
||||
return (type##OopDesc*)obj(); \
|
||||
} \
|
||||
type##Oop& operator=(const type##Oop& o) { \
|
||||
oop::operator=(o); \
|
||||
return *this; \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template<> \
|
||||
struct PrimitiveConversions::Translate<type##Oop> : public std::true_type { \
|
||||
typedef type##Oop Value; \
|
||||
typedef type##OopDesc* Decayed; \
|
||||
\
|
||||
static Decayed decay(Value x) { return (type##OopDesc*)x.obj(); } \
|
||||
static Value recover(Decayed x) { return type##Oop(x); } \
|
||||
};
|
||||
|
||||
DEF_OOP(instance);
|
||||
|
@ -26,7 +26,6 @@
|
||||
#define SHARE_RUNTIME_OS_HPP
|
||||
|
||||
#include "jvm_md.h"
|
||||
#include "metaprogramming/integralConstant.hpp"
|
||||
#include "runtime/osInfo.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user