RFR: 8253397: Ensure LogTag types are sorted

Kim Barrett kim.barrett at oracle.com
Wed Sep 23 04:51:21 UTC 2020


> On Sep 21, 2020, at 6:35 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
> 
>> 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.

It's not hard to make the is_sorted check constexpr, but doesn't provide a
real benefit compared to the proposed conditional compilation approach;
neither has any additional code or computation in a product build.

A pre-existing thing that should be fixed though:
src/hotspot/share/logging/logTag.hpp
231   static const char* _name[]; 

That should be
231   static const char* const _name[];

And similarly in the .cpp file.

Looks good with the above change.



More information about the hotspot-runtime-dev mailing list