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

Thomas Stuefe stuefe at openjdk.java.net
Tue May 4 15:45:10 UTC 2021


In Universal Logging, class LogDecorations keeps resolved decorations as well as a lookup table of pointers to the start of each resolved decoration, by decorator. This is dangerous, since it makes object copy non-trivial (the pointers would need to be relocated). It is also wasteful since we spend 8 bytes per pointer per index.

Better would be to use a numerical index array of offset values, which could be safely copied. 

And since the resolve buffer is 256 char, we can easily make this index an 8-bit value, which reduces the size of a LogDecorations object down to 280 bytes (from 368). Size matters especially in the context of JDK-8229517.

The patch also adds a gtest, which tests that decorations are safely copy-able and that decorator resolution works as expected.

Testing:
- manually jtreg runtime/logging
- manually gtests
- Will run more tests tonight

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

Commit messages:
 - start

Changes: https://git.openjdk.java.net/jdk/pull/3855/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3855&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8266503
  Stats: 52 lines in 3 files changed: 48 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3855.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3855/head:pull/3855

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


More information about the hotspot-runtime-dev mailing list