8329549: Remove FORMAT64_MODIFIER

Reviewed-by: dholmes, kbarrett
This commit is contained in:
Coleen Phillimore 2025-01-07 23:14:04 +00:00
parent 098afc8b7d
commit ddb5881964
5 changed files with 12 additions and 21 deletions

View File

@ -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
@ -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("????????????????");
@ -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 {

View File

@ -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
@ -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.
@ -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

View File

@ -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
@ -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

View File

@ -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
@ -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)

View File

@ -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
@ -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");
}