RFR: 8354996: Reduce dynamic code generation for a single downcall
Chen Liang
liach at openjdk.org
Fri Apr 18 17:59:59 UTC 2025
On Fri, 18 Apr 2025 17:49:35 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Perf numbers for simple main:
>> Linking of `Class::forName0` down from ~152 to ~83
>>
>> For calling little color management system https://bugs.openjdk.org/browse/JDK-8313344:
>> JNI: ~45
>> baseline panama: ~164
>> patch: ~103
>>
>> Also see #24705.
>
> make/jdk/src/classes/build/tools/classlist/HelloClasslist.java line 190:
>
>> 188: JAVA_BOOLEAN, ADDRESS, ADDRESS);
>> 189: Optional<MemorySegment> symbol = lookup.find("Java_java_lang_Class_forName0");
>> 190: var _ = linker.downcallHandle(symbol.orElseThrow(), signature);
>
> FWIW, passing just the signature should result in mostly the same code being generated. The address is just attached using MethodHandles::insertArguments.
So just `Linker.nativeLinker().downcallHandle(MemorySegment.ofArray(new byte[0]), signature)` suffices?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24742#discussion_r2050937126
More information about the build-dev
mailing list