RFR: 8292981: Unify and restructure integer printing format specifiers [v8]
Stefan Karlsson
stefank at openjdk.org
Thu Sep 1 06:19:46 UTC 2022
> Today we have some inconsistencies in how we name our integer printing format specifiers. I'd like to change this to be consistent.
>
> This patch comes from a discussion in #10028, which snowballed into restructuring the format specifiers. The main issues was that my original patch used PTR<size>_FORMAT to print integers with the format 0x000<value>. The reviewers felt that it was wrong to use PTR format specifiers when printing integers. I agree with that.
>
> We do have format specifiers to print hex values out of integers, though they don't 0-pad like the PTR macros do, and only some of the prepend 0x.
>
> I'd like to suggest that we use a convention to specify what we want. This is the current proposal:
>
> // Guide to the suffixes used in the format specifiers for integers:
> // - print the decimal value: 745565
> // _X - print as hexadecimal, without leading 0s: 0x12345
> // _X_0 - print as hexadecimal, with leading 0s: 0x00012345
> // _H - print as hexadecimal, without 0x prefix
> // _W(w) - prints w sized string with the given value right
> // adjusted. Use -w to print left adjusted.
> //
> // Note that the PTR format specifiers print using 0x with leading zeros,
> // just like the _X_0 version for integers.
>
>
> The patch also removes PTR32_FORMAT and PTR64_FORMAT and replace them with the corresponding integer format specifiers.
Stefan Karlsson has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
- Merge remote-tracking branch 'upstream/master' into 8292981_unify_integer_format_specifiers
- Merge branch 'master' into 8292981_unify_integer_format_specifiers
- Remove _H variants
- Removed extraneous 0x
- Move INTPTR_FORMAT_H_W to Shenandoah
- Use PTR_FORMAT in AIX code
- Fix Shenandoah
- 8292981: Unify and restructure integer printing format specifiers
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10042/files
- new: https://git.openjdk.org/jdk/pull/10042/files/52220b7d..6c1cdc84
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10042&range=07
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10042&range=06-07
Stats: 4552 lines in 177 files changed: 2348 ins; 817 del; 1387 mod
Patch: https://git.openjdk.org/jdk/pull/10042.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10042/head:pull/10042
PR: https://git.openjdk.org/jdk/pull/10042
More information about the hotspot-dev
mailing list