Skip to content

Commit 4ac2e47

Browse files
author
Kim Barrett
committed
8343800: Cleanup definition of NULL_WORD
Reviewed-by: dholmes, kvn
1 parent a3b58ee commit 4ac2e47

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

src/hotspot/share/utilities/globalDefinitions.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ const jfloat min_jfloat = jfloat_cast(min_jintFloat);
560560
const jint max_jintFloat = (jint)(0x7f7fffff);
561561
const jfloat max_jfloat = jfloat_cast(max_jintFloat);
562562

563+
// A named constant for the integral representation of a Java null.
564+
const intptr_t NULL_WORD = 0;
565+
563566
//----------------------------------------------------------------------------------------------------
564567
// JVM spec restrictions
565568

src/hotspot/share/utilities/globalDefinitions_gcc.hpp

-18
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,6 @@
7171
#include <sys/time.h>
7272
#endif // LINUX || _ALLBSD_SOURCE
7373

74-
// NULL vs NULL_WORD:
75-
// On Linux NULL is defined as a special type '__null'. Assigning __null to
76-
// integer variable will cause gcc warning. Use NULL_WORD in places where a
77-
// pointer is stored as integer value. On some platforms, sizeof(intptr_t) >
78-
// sizeof(void*), so here we want something which is integer type, but has the
79-
// same size as a pointer.
80-
#ifdef __GNUC__
81-
#ifdef _LP64
82-
#define NULL_WORD 0L
83-
#else
84-
// Cast 0 to intptr_t rather than int32_t since they are not the same type
85-
// on platforms such as Mac OS X.
86-
#define NULL_WORD ((intptr_t)0)
87-
#endif
88-
#else
89-
#define NULL_WORD NULL
90-
#endif
91-
9274
// checking for nanness
9375
#if defined(__APPLE__)
9476
inline int g_isnan(double f) { return isnan(f); }

src/hotspot/share/utilities/globalDefinitions_visCPP.hpp

-6
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@
7272
// 64-bit integer-suffix (LL) instead.
7373
#define NULL 0LL
7474

75-
// NULL vs NULL_WORD:
76-
// On Linux NULL is defined as a special type '__null'. Assigning __null to
77-
// integer variable will cause gcc warning. Use NULL_WORD in places where a
78-
// pointer is stored as integer value.
79-
#define NULL_WORD NULL
80-
8175
typedef int64_t ssize_t;
8276

8377
// Non-standard stdlib-like stuff:

0 commit comments

Comments
 (0)