diff --git a/src/hotspot/cpu/ppc/icache_ppc.hpp b/src/hotspot/cpu/ppc/icache_ppc.hpp index 449d2f2525e..d348cad1c72 100644 --- a/src/hotspot/cpu/ppc/icache_ppc.hpp +++ b/src/hotspot/cpu/ppc/icache_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2013 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -44,7 +44,7 @@ class ICache : public AbstractICache { static void ppc64_flush_icache_bytes(address start, int bytes) { // Align start address to an icache line boundary and transform // nbytes to an icache line count. - const uint line_offset = mask_address_bits(start, line_size - 1); + const uint line_offset = (uintptr_t)start & (line_size - 1); ppc64_flush_icache(start - line_offset, (bytes + line_offset + line_size - 1) >> log2_line_size, 0); } }; diff --git a/src/hotspot/share/oops/markWord.hpp b/src/hotspot/share/oops/markWord.hpp index 7a21dccc5dd..be85fb8ba82 100644 --- a/src/hotspot/share/oops/markWord.hpp +++ b/src/hotspot/share/oops/markWord.hpp @@ -125,7 +125,7 @@ class markWord { static const uintptr_t marked_value = 3; static const uintptr_t no_hash = 0 ; // no hash value assigned - static const uintptr_t no_hash_in_place = (address_word)no_hash << hash_shift; + static const uintptr_t no_hash_in_place = (uintptr_t)no_hash << hash_shift; static const uintptr_t no_lock_in_place = unlocked_value; static const uint max_age = age_mask; diff --git a/src/hotspot/share/prims/stackwalk.hpp b/src/hotspot/share/prims/stackwalk.hpp index 0af68127b46..1a6e6409b71 100644 --- a/src/hotspot/share/prims/stackwalk.hpp +++ b/src/hotspot/share/prims/stackwalk.hpp @@ -78,7 +78,7 @@ public: } jlong address_value() { - return (jlong) castable_address(this); + return (jlong) this; } static BaseFrameStream* from_current(JavaThread* thread, jlong magic, objArrayHandle frames_array); diff --git a/src/hotspot/share/runtime/icache.cpp b/src/hotspot/share/runtime/icache.cpp index bce33201073..eebafb07b6a 100644 --- a/src/hotspot/share/runtime/icache.cpp +++ b/src/hotspot/share/runtime/icache.cpp @@ -96,7 +96,7 @@ void AbstractICache::invalidate_range(address start, int nbytes) { } // Align start address to an icache line boundary and transform // nbytes to an icache line count. - const uint line_offset = mask_address_bits(start, ICache::line_size-1); + const uint line_offset = uintptr_t(start) & (ICache::line_size-1); if (line_offset != 0) { start -= line_offset; nbytes += line_offset; diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index ce08f147a54..6cb00d338ff 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -444,23 +444,6 @@ typedef unsigned int uint; NEEDS_CLEANUP typedef signed char s_char; typedef unsigned char u_char; typedef u_char* address; -typedef uintptr_t address_word; // unsigned integer which will hold a pointer - // except for some implementations of a C++ - // linkage pointer to function. Should never - // need one of those to be placed in this - // type anyway. - -// Utility functions to "portably" (?) bit twiddle pointers -// Where portable means keep ANSI C++ compilers quiet - -inline address set_address_bits(address x, int m) { return address(intptr_t(x) | m); } -inline address clear_address_bits(address x, int m) { return address(intptr_t(x) & ~m); } - -// Utility functions to "portably" make cast to/from function pointers. - -inline address_word mask_address_bits(address x, int m) { return address_word(x) & m; } -inline address_word castable_address(address x) { return address_word(x) ; } -inline address_word castable_address(void* x) { return address_word(x) ; } // Pointer subtraction. // The idea here is to avoid ptrdiff_t, which is signed and so doesn't have @@ -503,7 +486,7 @@ inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) { // many C++ compilers. // #define CAST_TO_FN_PTR(func_type, value) (reinterpret_cast(value)) -#define CAST_FROM_FN_PTR(new_type, func_ptr) ((new_type)((address_word)(func_ptr))) +#define CAST_FROM_FN_PTR(new_type, func_ptr) ((new_type)((uintptr_t)(func_ptr))) // In many places we've added C-style casts to silence compiler // warnings, for example when truncating a size_t to an int when we