On Tue, 14 Oct 2025 12:34:14 GMT, David Beaumont <[email protected]> wrote:

>> C++ changes for supporting preview mode when preview mode resources (with 
>> new location flags) are available.
>> 
>> At the moment, this code will operate on non-preview jimage files (1.0) and 
>> act as if no preview resources are available by virtue of the default value 
>> for missing attributes being zero (which matches location flags for "normal" 
>> entries).
>
> David Beaumont has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Reorganising to catch preview-only cases

src/hotspot/share/classfile/classLoader.cpp line 471:

> 469: 
> 470:   jlong size;
> 471:   JImageLocationRef location = jimage_find_resource("", name, 
> is_preview, &size);

Actually, now I look at callers, I see this. An empty module name.
So perhaps it should all work and maybe the double '//' isn't what will happen.
The original code also passes "" here, and the old string concatenation code 
does:

    index = 0;
    fullpath[index++] = '/';
    memcpy(&fullpath[index], module_name, moduleNameLen);
    index += moduleNameLen;
    fullpath[index++] = '/';
    memcpy(&fullpath[index], name, nameLen);
    index += nameLen;
    fullpath[index++] = '\0';


So it too looks like it generates '//' in the name, which really shouldn't 
result in anything being found (but we're not in Kansas anymore, so I'll save 
investigating this for the PR).

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1618#discussion_r2429719330

Reply via email to