RFR: 8356308: Assert with -Xlog:class+path when classpath has an empty element [v2]

David Holmes dholmes at openjdk.org
Thu May 29 06:12:53 UTC 2025


On Wed, 28 May 2025 23:29:10 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> When the classpath has an element that's the empty string (e.g., `java  -Xlog:class+path -cp :abc ...`, where the first element is `""` and the second element is `"abc"`), the VM asserts.
>> 
>> The fix is simple:
>> 
>> 
>> -     if (do_substitute) {
>> +     if (do_substitute && remove_prefix_len > 0) {
>> 
>> 
>> I also improved the logs to help debugging classpath mismatches when using the AOT cache.
>
> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - @dholmes-ora comments -- fixed bug where ClasspathStream does not remove leading blank paths; cleaned up ClasspathStream and added docs/asserts
>  - Merge branch 'master' into 8356308-assert-in-log-class-path
>  - 8356308: Assert with -Xlog:class+path when classpath has an empty element

src/hotspot/share/cds/aotClassLocation.cpp line 910:

> 908:     if (!cs->from_cpattr()) {
> 909:       ls.print("%s", sep);
> 910:       if (do_substitute && remove_prefix_len > 0) {

I had expected this would no longer be necessary once the cp parsing was fixed. ??

src/hotspot/share/utilities/classpathStream.cpp line 41:

> 39: void ClasspathStream::skip_blank_paths() {
> 40:   while (*_cp == separator()) {
> 41:     _cp ++;

Suggestion:

    _cp++;

src/hotspot/share/utilities/classpathStream.cpp line 51:

> 49:   const char* end = _cp + 1;
> 50:   while (*end != separator() && *end != '\0') {
> 51:     end ++;

Suggestion:

    end++;

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25372#discussion_r2113274902
PR Review Comment: https://git.openjdk.org/jdk/pull/25372#discussion_r2113277100
PR Review Comment: https://git.openjdk.org/jdk/pull/25372#discussion_r2113277443


More information about the hotspot-runtime-dev mailing list