RFR: 8268425: Show decimal nid of OSThread instead of hex format one [v5]

Yi Yang yyang at openjdk.java.net
Tue Jul 6 03:25:57 UTC 2021


On Tue, 6 Jul 2021 03:08:42 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   use \p{XDigit}
>
> src/hotspot/share/runtime/osThread.cpp line 41:
> 
>> 39: // Printing
>> 40: void OSThread::print_on(outputStream *st) const {
>> 41:   st->print("nid=" UINT64_FORMAT " ", (uint64_t)thread_id());
> 
> Why are you forcing this to be a 64-bit type?

IMHO, I prefer using `%d` since a large portion of existing code using `%d`. Thomas suggests using UINT64_FORMAT rather than `%d`:
> You'd do:

> print("nid: " UINT64_FORMAT, (uint64_t) id):;

> thread_t is, among other things, pthread_t, which is opaque. Any current code treating that as signed int is incorrect too.

There is no uniform format for the formatted output of thread_id in hotspot. As far as I can see, `%ld` `%d` and `UINTX_FORMAT` are used, so I want to left the decision to reviewers.

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

PR: https://git.openjdk.java.net/jdk/pull/4449


More information about the hotspot-dev mailing list