On Tue, 20 Aug 2024 06:13:18 GMT, Stefan Karlsson <stef...@openjdk.org> wrote:

>> So in this test case:
>>     `-Xlog:gc,gc+init`
>> you have it so that `true` is returned.
>> 
>> With this line of code:
>>  ```
>>    const bool is_gc_exact_match = ts->contains(LogTag::_gc) && ts->ntags() 
>> == 1;
>> 
>> I would think that this part is `false`: `ts->ntags() == 1`
>> for the `-Xlog:gc,gc+init` test case so we'll be returning `false`.
>> 
>> What am I missing?
>
> The important part is that `ts` contains one single tag set and that 
> `gc,gc+init` is a string that specifies the two tag sets `gc` and `gc+init`. 
> Also, note that `-Xlog:gc,gc+init` and `-Xlog:gc -Xlog:gc+init` is 
> effectively the same.
> 
> It is also important to understand that the for loop iterates over all tag 
> sets that have been used in the HotSpot code. It is not iterating over the 
> tag sets specified by -Xlog lines.

OK, I get it now. The loop cycles thru the tag set and finds one that is
a singleton and an exact match, i.e., `-Xlog:gc`. With `-Xlog:gc+init`,
the `ts->ntags() == 1` would be `false` because that one is not an
exact match.

I misunderstood the algorithm a bit. Sorry for the noise.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20628#discussion_r1723555244

Reply via email to