diff --git a/src/hotspot/share/metaprogramming/integralConstant.hpp b/src/hotspot/share/metaprogramming/integralConstant.hpp deleted file mode 100644 index ce22849e3be..00000000000 --- a/src/hotspot/share/metaprogramming/integralConstant.hpp +++ /dev/null @@ -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::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 -struct IntegralConstant { - typedef T value_type; - static const value_type value = v; - typedef IntegralConstant type; - operator value_type() { return value; } -}; - -// A bool valued IntegralConstant whose value is true. -typedef IntegralConstant TrueType; - -// A bool valued IntegralConstant whose value is false. -typedef IntegralConstant FalseType; - -#endif // SHARE_METAPROGRAMMING_INTEGRALCONSTANT_HPP diff --git a/src/hotspot/share/oops/accessBackend.hpp b/src/hotspot/share/oops/accessBackend.hpp index 2fdceab3721..91dd7b85f06 100644 --- a/src/hotspot/share/oops/accessBackend.hpp +++ b/src/hotspot/share/oops/accessBackend.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 - struct MustConvertCompressedOop: public IntegralConstant::value && std::is_same::type, narrowOop>::value && std::is_same::value> {}; @@ -86,9 +85,9 @@ namespace AccessInternal { // locking to support wide atomics or not. template #ifdef SUPPORTS_NATIVE_CX8 - struct PossiblyLockedAccess: public IntegralConstant {}; + struct PossiblyLockedAccess: public std::false_type {}; #else - struct PossiblyLockedAccess: public IntegralConstant 4)> {}; + struct PossiblyLockedAccess: public std::integral_constant 4)> {}; #endif template @@ -626,7 +625,7 @@ namespace AccessInternal { // not possible. struct PreRuntimeDispatch: AllStatic { template - struct CanHardwireRaw: public IntegralConstant< + struct CanHardwireRaw: public std::integral_constant< bool, !HasDecorator::value || // primitive access !HasDecorator::value || // don't care about compressed oops (oop* address) diff --git a/src/hotspot/share/oops/accessBackend.inline.hpp b/src/hotspot/share/oops/accessBackend.inline.hpp index 1dacb48427f..677af8115c3 100644 --- a/src/hotspot/share/oops/accessBackend.inline.hpp +++ b/src/hotspot/share/oops/accessBackend.inline.hpp @@ -34,6 +34,8 @@ #include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" +#include + template template inline typename EnableIf< @@ -251,7 +253,7 @@ RawAccessBarrier::atomic_cmpxchg_maybe_locked(void* addr, T compare_value, T } class RawAccessBarrierArrayCopy: public AllStatic { - template struct IsHeapWordSized: public IntegralConstant { }; + template struct IsHeapWordSized: public std::integral_constant { }; public: template static inline typename EnableIf< @@ -334,7 +336,7 @@ public: } }; -template<> struct RawAccessBarrierArrayCopy::IsHeapWordSized: public IntegralConstant { }; +template<> struct RawAccessBarrierArrayCopy::IsHeapWordSized: public std::false_type { }; template template diff --git a/src/hotspot/share/oops/accessDecorators.hpp b/src/hotspot/share/oops/accessDecorators.hpp index d6f0f59c5d9..fc5860d6487 100644 --- a/src/hotspot/share/oops/accessDecorators.hpp +++ b/src/hotspot/share/oops/accessDecorators.hpp @@ -27,9 +27,10 @@ #include "gc/shared/barrierSetConfig.hpp" #include "memory/allStatic.hpp" -#include "metaprogramming/integralConstant.hpp" #include "utilities/globalDefinitions.hpp" +#include + // 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 -struct HasDecorator: public IntegralConstant {}; +struct HasDecorator: public std::integral_constant {}; // == General Decorators == // * DECORATORS_NONE: This is the name for the empty decorator set (in absence of other decorators). diff --git a/src/hotspot/share/oops/markWord.hpp b/src/hotspot/share/oops/markWord.hpp index c23fa0459e8..2250d2a95bf 100644 --- a/src/hotspot/share/oops/markWord.hpp +++ b/src/hotspot/share/oops/markWord.hpp @@ -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 + // 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 : public TrueType { +struct PrimitiveConversions::Translate : public std::true_type { typedef markWord Value; typedef uintptr_t Decayed; diff --git a/src/hotspot/share/oops/oopHandle.hpp b/src/hotspot/share/oops/oopHandle.hpp index 77bdbfd8f9a..490c9f9eec4 100644 --- a/src/hotspot/share/oops/oopHandle.hpp +++ b/src/hotspot/share/oops/oopHandle.hpp @@ -28,6 +28,8 @@ #include "metaprogramming/primitiveConversions.hpp" #include "oops/oopsHierarchy.hpp" +#include + 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 : public TrueType { +struct PrimitiveConversions::Translate : public std::true_type { typedef OopHandle Value; typedef oop* Decayed; diff --git a/src/hotspot/share/oops/oopsHierarchy.hpp b/src/hotspot/share/oops/oopsHierarchy.hpp index d2a82b9ca1b..bdfb47fe38d 100644 --- a/src/hotspot/share/oops/oopsHierarchy.hpp +++ b/src/hotspot/share/oops/oopsHierarchy.hpp @@ -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 + // 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 : public TrueType { +struct PrimitiveConversions::Translate : public std::true_type { typedef oop Value; typedef oopDesc* Decayed; @@ -116,31 +117,31 @@ struct PrimitiveConversions::Translate : 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 : 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 : 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); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index fc97d59d263..1780ebc4916 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -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"