RFR: JDK-8266503: [UL] Make Decorations safely copy-able and reduce their size

Thomas Stuefe stuefe at openjdk.java.net
Thu May 6 11:17:53 UTC 2021


On Thu, 6 May 2021 11:02:02 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/logging/logDecorations.hpp line 42:
>> 
>>> 40:   const jlong _nanos;             // for "timenanos"
>>> 41:   const double _elapsed_seconds;  // for "uptime", "uptimemillis", "uptimenanos"
>>> 42:   const int _pid;                 // for "pid"
>> 
>> You can use the same trick for `_pid` (i.e. make it static and resolve it a single time) like for `_host_name`. That will save you another 4 bytes for the size of `LogDecorations`.
>
> Good point. Might even be more because of padding.

... hah, wouldn't you know, its down to 48 bytes :-)

BTW I think if we look closer we can probably squeeze this even more.

E.g. _millis and _nanos are kind of the same thing; for _elapsedSeconds a float may be sufficient instead of a double; and tagset could be made a bitmaks (it really really should be one) and passed as 32bit value object instead of as a reference. But I wanted to keep the patch small and concise for now.

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

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


More information about the hotspot-runtime-dev mailing list