RFR: 8329850: [AIX] Allow loading of different members of same shared library archive [v3]

Thomas Stuefe stuefe at openjdk.org
Thu Apr 25 13:24:35 UTC 2024


On Thu, 25 Apr 2024 10:38:02 GMT, Joachim Kern <jkern at openjdk.org> wrote:

>> With [JDK-8320890](https://bugs.openjdk.org/browse/JDK-8320890) we introduced the capability not to load shared libraries twice if the application wants to do that. Instead we just rise a ref counter. Unfortunately this also suppresses the loading of a second member of a shared library.
>> This fix introduces an additionally stored hash value for each loaded member and only suppresses duplicate loading if the same member is loaded twice.
>> If a shared library has no member a hash value of 0 is used to make the code orthogonal.
>
> Joachim Kern has updated the pull request incrementally with one additional commit since the last revision:
> 
>   cosmetic changes

Had a brief skim over this change.

This would be a lot simpler had we just used string comparison instead of using inodes for equality. Then, we could have just used file name plus member name as key in the table.

Remind me again, why do we compare inodes instead of just file names?

One simplification, maybe: Is there some limitation as to the length of the member name, and if yes, reasonably short? If yes, just make the member name inline ion the table entry and save the malloc/strdup and free.

src/hotspot/os/aix/porting_aix.cpp line 1069:

> 1067:           (p_handletable + i)->inode == libstat.st_ino &&
> 1068:           (p_handletable + i)->devid == libstat.st_dev &&
> 1069:           (((p_handletable + i)->member == member) ||

If this ever fires (wildly unlikely), its a bug. You are comparing a stack address with something that lives in C heap right now.

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

Changes requested by stuefe (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18676#pullrequestreview-2022466279
PR Comment: https://git.openjdk.org/jdk/pull/18676#issuecomment-2077169711
PR Review Comment: https://git.openjdk.org/jdk/pull/18676#discussion_r1579453242


More information about the hotspot-runtime-dev mailing list