RFR: 8293182: Improve testing of CDS archive heap [v5]

Ioi Lam iklam at openjdk.org
Tue Sep 6 22:26:00 UTC 2022


On Fri, 2 Sep 2022 19:20:31 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed minimal build
>
> src/hotspot/share/cds/heapShared.cpp line 1542:
> 
>> 1540:     }
>> 1541: 
>> 1542:     Klass* k = SystemDictionary::resolve_or_fail(klass_name, true, THREAD);
> 
> Is this all only needed for #ifndef PRODUCT ?? if so you can put a ResourceMark unconditionally here because it seems like one might be needed.

We actually do resource allocation even in product mode (in error reporting), so I added ResourceMark in all cases.

> src/hotspot/share/cds/heapShared.cpp line 1663:
> 
>> 1661:         // otherwise it must be in (B).
>> 1662:         for (int j = 0; j < name->utf8_length(); j++) {
>> 1663:           if (name->char_at(j) == '/') {
> 
> Can you use strchr instead?

`name->base()` is not guarantee to be zero-terminated so I can't use `strchr`. I could use `memchr`, but since this code is executed only in asserts, I decided to use a higher-level function, `Symbol::index_of_at`.

I fixed the comments for `Symbol::index_of_at` and renamed its parameters to be clear what this function actually does.

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

PR: https://git.openjdk.org/jdk/pull/10110


More information about the hotspot-runtime-dev mailing list