RFR: 8253397: Ensure LogTag types are sorted

Kim Barrett kim.barrett at oracle.com
Mon Sep 21 10:35:58 UTC 2020


> On Sep 21, 2020, at 1:30 AM, Claes Redestad <redestad at openjdk.java.net> wrote:
> 
> - Sort LogTag type enum alphabetically
> - Assert that the tags are sorted instead of sorting
> 
> -------------
> 
> Commit messages:
> - Ensure LogTag types are sorted
> 
> Changes: https://git.openjdk.java.net/jdk/pull/274/files
> Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=274&range=00
>  Issue: https://bugs.openjdk.java.net/browse/JDK-8253397
>  Stats: 58 lines in 2 files changed: 24 ins; 22 del; 12 mod
>  Patch: https://git.openjdk.java.net/jdk/pull/274.diff
>  Fetch: git fetch https://git.openjdk.java.net/jdk pull/274/head:pull/274
> 
> PR: https://git.openjdk.java.net/jdk/pull/274

I think having the LOG_TAG_LIST in sorted order is good.

But I think the checking can be improved. I think it can be done at
compile-time using constexpr, completely eliminating the runtime execution
and data. I'm currently prototyping; I'll let you know what I come up with.

Make LogTag::_name constexpr (it should at least be const, and it's a
bug that it isn't).  This will require moving the definition into the
header, but that's okay, it's small.

(I think the sorting could be done at compile-time too, unless that requires
constexpr features from C++17/20; I don't recall off-hand. But having the
list start sorted removes the need for that complexity, and may be better
for usability anyway.  Grouping tags by usage doesn't entirely work, since
tags may be used in multiple ways.)



More information about the hotspot-runtime-dev mailing list