RFR: 8293304: Replace some usages of INTPTR_FORMAT with PTR_FORMAT [v2]
Stefan Karlsson
stefank at openjdk.org
Thu Sep 8 08:42:30 UTC 2022
> During the discussion of [JDK-8292981](https://bugs.openjdk.org/browse/JDK-8292981) an opinion was voiced that we should stop using INTPTR_FORMAT when printing pointers.
>
> Some background that could explain why some tend to use INTPTR_FORMAT instead of PTR_FORMAT:
>
> Both those format specifiers require an integer and the compiler barfs if you send in a pointer. We therefore have a utility function named p2i, which converts the pointer to an integer. So, everywhere we have to write print line like this: `print("my pointer: " PTR_FORMAT, p2i(my_pointer));`. Now, p2i returns an intptr_t, and it becomes natural for some to consider the type of the converted value (that we need because of the mentioned workaround), instead of the original type of the value.
>
> With this enhancement I'd like to clean up the code that I often work in, so that it uses PTR_FORMAT when printing pointers. I'm leaving the rest of the code base for others to consider cleaning up.
>
> Cleanups have been done in directories gc/, utilities/, memory/, and oops/.
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:
- Remove redundant casts
- More conversions
- Merge remote-tracking branch 'upstream/master' into 8293304_replace_intptr_format
- Fix oops/
- Fix memory/
- Fix utilities/
- Fix gc/
- Add SIZE_FORMAT_X_0
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10141/files
- new: https://git.openjdk.org/jdk/pull/10141/files/e3d8f643..153b0f24
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10141&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10141&range=00-01
Stats: 45757 lines in 300 files changed: 22272 ins; 19201 del; 4284 mod
Patch: https://git.openjdk.org/jdk/pull/10141.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10141/head:pull/10141
PR: https://git.openjdk.org/jdk/pull/10141
More information about the hotspot-dev
mailing list