Skip to content

Commit

Permalink
8300265: Remove metaprogramming/isSigned.hpp
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, tschatzl
  • Loading branch information
jcking authored and Thomas Schatzl committed Jan 23, 2023
1 parent 5a4945c commit 03a9a88
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 101 deletions.
7 changes: 4 additions & 3 deletions src/hotspot/share/memory/metaspace/counters.hpp
Expand Up @@ -26,11 +26,12 @@
#ifndef SHARE_MEMORY_METASPACE_COUNTERS_HPP
#define SHARE_MEMORY_METASPACE_COUNTERS_HPP

#include "metaprogramming/isSigned.hpp"
#include "runtime/atomic.hpp"
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"

#include <type_traits>

namespace metaspace {

// We seem to be counting a lot of things which makes it worthwhile to
Expand All @@ -43,7 +44,7 @@ class AbstractCounter {
T _c;

// Only allow unsigned values for now
STATIC_ASSERT(IsSigned<T>::value == false);
STATIC_ASSERT(std::is_signed<T>::value == false);

public:

Expand Down Expand Up @@ -86,7 +87,7 @@ class AbstractAtomicCounter {
volatile T _c;

// Only allow unsigned values for now
STATIC_ASSERT(IsSigned<T>::value == false);
STATIC_ASSERT(std::is_signed<T>::value == false);

public:

Expand Down
38 changes: 0 additions & 38 deletions src/hotspot/share/metaprogramming/isSigned.hpp

This file was deleted.

9 changes: 4 additions & 5 deletions src/hotspot/share/runtime/atomic.hpp
Expand Up @@ -27,7 +27,6 @@

#include "memory/allocation.hpp"
#include "metaprogramming/enableIf.hpp"
#include "metaprogramming/isSigned.hpp"
#include "metaprogramming/primitiveConversions.hpp"
#include "runtime/orderAccess.hpp"
#include "utilities/align.hpp"
Expand Down Expand Up @@ -526,10 +525,10 @@ inline D Atomic::sub(D volatile* dest, I sub_value, atomic_memory_order order) {
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 PI = std::conditional_t<std::is_signed<I>::value, intptr_t, uintptr_t>;
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(std::is_signed<I>::value == std::is_signed<AddendType>::value);
STATIC_ASSERT(sizeof(I) <= sizeof(AddendType));
AddendType addend = sub_value;
// Assumes two's complement integer representation.
Expand Down Expand Up @@ -675,7 +674,7 @@ struct Atomic::AddImpl<
typename EnableIf<std::is_integral<I>::value &&
std::is_integral<D>::value &&
(sizeof(I) <= sizeof(D)) &&
(IsSigned<I>::value == IsSigned<D>::value)>::type>
(std::is_signed<I>::value == std::is_signed<D>::value)>::type>
{
static D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) {
D addend = add_value;
Expand All @@ -697,7 +696,7 @@ struct Atomic::AddImpl<

// Type of the scaled addend. An integral type of the same size as a
// pointer, and the same signedness as I.
using SI = std::conditional_t<IsSigned<I>::value, intptr_t, uintptr_t>;
using SI = std::conditional_t<std::is_signed<I>::value, intptr_t, uintptr_t>;

// Type of the unscaled destination. A pointer type with pointee size == 1.
using UP = const char*;
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/utilities/population_count.hpp
Expand Up @@ -26,7 +26,6 @@
#define SHARE_UTILITIES_POPULATION_COUNT_HPP

#include "metaprogramming/enableIf.hpp"
#include "metaprogramming/isSigned.hpp"
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"

Expand All @@ -48,7 +47,7 @@ inline unsigned population_count(T x) {
STATIC_ASSERT(BitsPerWord <= 128);
STATIC_ASSERT(BitsPerByte == 8);
STATIC_ASSERT(std::is_integral<T>::value);
STATIC_ASSERT(!IsSigned<T>::value);
STATIC_ASSERT(!std::is_signed<T>::value);
// We need to take care with implicit integer promotion when dealing with
// integers < 32-bit. We chose to do this by explicitly widening constants
// to unsigned
Expand Down
48 changes: 0 additions & 48 deletions test/hotspot/gtest/metaprogramming/test_isSigned.cpp

This file was deleted.

10 changes: 5 additions & 5 deletions test/hotspot/gtest/utilities/test_count_leading_zeros.cpp
Expand Up @@ -23,17 +23,17 @@
*/

#include "precompiled.hpp"
#include "metaprogramming/isSigned.hpp"
#include "utilities/count_leading_zeros.hpp"
#include "utilities/globalDefinitions.hpp"
#include "unittest.hpp"

#include <limits>
#include <type_traits>

template <typename T> void one_or_two_set_bits() {
uint32_t bit1_pos = 0;
uint32_t bits = sizeof(T) * BitsPerByte;
uint32_t limit = bits - (IsSigned<T>::value ? 1 : 0);
uint32_t limit = bits - (std::is_signed<T>::value ? 1 : 0);
for (uint64_t ix = 1; bit1_pos < limit; ix = ix * 2, ++bit1_pos) {
uint32_t bit2_pos = 0;
for (uint64_t jx = 1; bit2_pos < limit; jx = jx * 2, ++bit2_pos) {
Expand All @@ -56,7 +56,7 @@ TEST(count_leading_zeros, one_or_two_set_bits) {
}

template <typename T> void high_zeros_low_ones() {
uint32_t number_of_leading_zeros = (IsSigned<T>::value ? 1 : 0);
uint32_t number_of_leading_zeros = (std::is_signed<T>::value ? 1 : 0);
T value = std::numeric_limits<T>::max();
for ( ; value != 0; value >>= 1, ++number_of_leading_zeros) {
EXPECT_EQ(number_of_leading_zeros, count_leading_zeros(value))
Expand All @@ -78,7 +78,7 @@ TEST(count_leading_zeros, high_zeros_low_ones) {
template <typename T> void high_ones_low_zeros() {
T value = std::numeric_limits<T>::max();

uint32_t number_of_leading_zeros = (IsSigned<T>::value ? 1 : 0);
uint32_t number_of_leading_zeros = (std::is_signed<T>::value ? 1 : 0);
for (uint64_t i = 1; value != 0; value -= i, i <<= 1) {
EXPECT_EQ(number_of_leading_zeros, count_leading_zeros(value))
<< "value = " << value;
Expand All @@ -97,4 +97,4 @@ TEST(count_leading_zeros, high_ones_low_zeros) {
high_ones_low_zeros<uint16_t>();
high_ones_low_zeros<uint32_t>();
high_ones_low_zeros<uint64_t>();
}
}

1 comment on commit 03a9a88

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.