RFR: 8343703: Symbol name cleanups after JEP 479

Alex Menkov amenkov at openjdk.org
Wed Nov 27 01:46:39 UTC 2024


On Tue, 26 Nov 2024 06:36:44 GMT, David Holmes <dholmes at openjdk.org> wrote:

> After JEP 479 ([JDK-8339783](https://bugs.openjdk.org/browse/JDK-8339783) was integrated, the handling of certain symbol lookup code can be simplified. The old code needed to support 32-bit Windows, where names had a trailing `@<number>`. When this special case now is removed, some streamlining is possible. Specifically these arrays:
> 
> #define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
> #define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
> #define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"}
> #define AGENT_ONLOAD_SYMBOLS {"Agent_OnLoad"}
> #define AGENT_ONUNLOAD_SYMBOLS {"Agent_OnUnload"}
> #define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"}
> 
> are all singletons and so the actual strings can just be inlined directly into the code that uses them.
> 
> Testing:
> - GHA
> - Tiers 1-4 sanity
> - 
> Thanks

Marked as reviewed by amenkov (Reviewer).

src/java.base/share/native/libjava/NativeLibraries.c line 76:

> 74: 
> 75:     // sym + '_' + cname + '\0'
> 76:     if ((len = (cname != NULL ? (strlen(cname) + 1) : 0) + strlen(sym) + 1) >

To match the updated comment:
Suggestion:

    if ((len = strlen(sym) + (cname != NULL ? (strlen(cname) + 1) : 0) + 1) >

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

PR Review: https://git.openjdk.org/jdk/pull/22380#pullrequestreview-2463375580
PR Review Comment: https://git.openjdk.org/jdk/pull/22380#discussion_r1859629230


More information about the serviceability-dev mailing list