Integrated: 8360515: PROPERFMTARGS should always use size_t template specialization for unit

Joel Sikström jsikstro at openjdk.org
Tue Aug 5 07:47:15 UTC 2025


On Wed, 25 Jun 2025 11:10:41 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:

> Hello,
> 
> PROPERFMT is defined as the format string "%zu%s", which expects a size_t as input argument. When used in combination with PROPERFMTARGS, which uses the templated byte_size_in_proper_units, the byte size may not be size_t if the input is some other type.
> 
> To minimize confusion, PROPERFMTARGS should always use the size_t template specilization of byte_size_in_proper_units, to match PROPERFMT. Places that use byte_size_in_proper_units with other types can still use it, but should use their own format strings instead of PROPERFMT.
> 
> ProcSmapsSummary::print_on in memMapPrinter_macosx and PSAdaptiveSizePolicy::print_stats in psAdaptiveSizePolicy.cpp are the only places that use PROPERFMTARGS with a type that is not size_t. I have changed those places to use the expanded version of the macro, which uses the templated version of byte_size_in_proper_unit instead.
> 
> Testing:
> * Oracle's tier1-2

This pull request has now been integrated.

Changeset: febd4b26
Author:    Joel Sikström <jsikstro at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/febd4b26b2c87030affd9f93524e0d951cbe74e7
Stats:     8 lines in 3 files changed: 1 ins; 0 del; 7 mod

8360515: PROPERFMTARGS should always use size_t template specialization for unit

Reviewed-by: dholmes, stuefe

-------------

PR: https://git.openjdk.org/jdk/pull/25975


More information about the hotspot-dev mailing list