[foreign-memaccess+abi] RFR: 8299730: Add trivial call linker option [v3]
Jorn Vernee
jvernee at openjdk.org
Fri Jan 27 15:38:16 UTC 2023
On Tue, 24 Jan 2023 19:20:50 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Add a trivial call linker option. This option acts as a hint to the runtime which indicates that a downcall is extremely short live (comparable to calling an empty function), and does not call back into Java.
>>
>> Some implementations (like ours) might use this information to apply additional optimizations that are only applicable to trivial functions (dropping thread state transitions).
>>
>> Note that the VM code diff looks kind of messy, but I essentially just put 3 `if` statements around the code that deals with the thread state transitions before and after the call. This also required moving the declarations of the `Label`s around though (so they are accessible from both ifs on the return path), which is probably messing up the diff view.
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>
> Javadoc nits
>
> Co-authored-by: Maurizio Cimadamore <54672762+mcimadamore at users.noreply.github.com>
Forgot to add the benchmarks before. Added them now.
Some numbers on my machine:
Benchmark Mode Cnt Score Error Units
CallOverheadConstant.jni_blank avgt 30 4.271 � 0.012 ns/op
CallOverheadConstant.panama_blank avgt 30 3.300 � 0.022 ns/op
CallOverheadConstant.panama_blank_trivial avgt 30 2.853 � 0.010 ns/op
CallOverheadVirtual.jni_blank avgt 30 4.278 � 0.017 ns/op
CallOverheadVirtual.panama_blank avgt 30 3.665 � 0.014 ns/op
CallOverheadVirtual.panama_blank_trivial avgt 30 3.254 � 0.011 ns/op
The difference seems to be very minimal on my machine, but others have reported more significant improvements. This could still be improved by intrinsifying in C2 maybe, but not sure by how much, and if that's worth the complexity.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/771
More information about the panama-dev
mailing list