Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/hotspot/share/runtime/os.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, 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
Expand Down Expand Up @@ -971,7 +971,7 @@ static void print_hex_location(outputStream* st, const_address p, int unitsize,
const uint64_t value =
LITTLE_ENDIAN_ONLY((((uint64_t)i2) << 32) | i1)
BIG_ENDIAN_ONLY((((uint64_t)i1) << 32) | i2);
st->print("%016" FORMAT64_MODIFIER "x", value);
st->print(UINT64_FORMAT_0, value);
print_ascii_form(ascii_form, value, unitsize);
} else {
st->print_raw("????????????????");
Expand All @@ -995,7 +995,7 @@ static void print_hex_location(outputStream* st, const_address p, int unitsize,
case 1: st->print("%02x", (u1)value); break;
case 2: st->print("%04x", (u2)value); break;
case 4: st->print("%08x", (u4)value); break;
case 8: st->print("%016" FORMAT64_MODIFIER "x", (u8)value); break;
case 8: st->print(UINT64_FORMAT_0, (u8)value); break;
}
print_ascii_form(ascii_form, value, unitsize);
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/utilities/globalDefinitions.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, 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
Expand Down Expand Up @@ -99,6 +99,7 @@ class oopDesc;
// _X_0 - print as hexadecimal, with leading 0s: 0x00012345
// _W(w) - prints w sized string with the given value right
// adjusted. Use -w to print left adjusted.
// _0 - print as hexadecimal, with leading 0s, without 0x prefix: 0012345
//
// Note that the PTR format specifiers print using 0x with leading zeros,
// just like the _X_0 version for integers.
Expand Down Expand Up @@ -131,6 +132,7 @@ class oopDesc;
#define UINT64_FORMAT_X "0x%" PRIx64
#define UINT64_FORMAT_X_0 "0x%016" PRIx64
#define UINT64_FORMAT_W(width) "%" #width PRIu64
#define UINT64_FORMAT_0 "%016" PRIx64

// Format integers which change size between 32- and 64-bit.
#define SSIZE_FORMAT "%" PRIdPTR
Expand Down
13 changes: 1 addition & 12 deletions src/hotspot/share/utilities/globalDefinitions_gcc.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
Expand Down Expand Up @@ -90,17 +90,6 @@ inline int g_isfinite(jfloat f) { return isfinite(f); }
inline int g_isfinite(jdouble f) { return isfinite(f); }


// Formatting.
#ifdef _LP64
# ifdef __APPLE__
# define FORMAT64_MODIFIER "ll"
# else
# define FORMAT64_MODIFIER "l"
# endif
#else // !_LP64
#define FORMAT64_MODIFIER "ll"
#endif // _LP64

// gcc warns about applying offsetof() to non-POD object or calculating
// offset directly when base address is null. The -Wno-invalid-offsetof
// option could be used to suppress this warning, but we instead just
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/share/utilities/globalDefinitions_visCPP.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, 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
Expand Down Expand Up @@ -103,9 +103,6 @@ inline int g_isnan(jdouble f) { return _isnan(f); }
inline int g_isfinite(jfloat f) { return _finite(f); }
inline int g_isfinite(jdouble f) { return _finite(f); }

// Formatting.
#define FORMAT64_MODIFIER "ll"

#define offset_of(klass,field) offsetof(klass,field)

#define THREAD_LOCAL __declspec(thread)
Expand Down
5 changes: 4 additions & 1 deletion test/hotspot/gtest/utilities/test_globalDefinitions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, 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
Expand Down Expand Up @@ -289,4 +289,7 @@ TEST(globalDefinitions, format_specifiers) {

check_format(INTPTR_FORMAT, (intptr_t)0x123, "0x" LP64_ONLY("00000000") "00000123");
check_format(PTR_FORMAT, (uintptr_t)0x123, "0x" LP64_ONLY("00000000") "00000123");

// Check all platforms print this compatibly without leading 0x.
check_format(UINT64_FORMAT_0, (u8)0x123, "0000000000000123");
}