[foreign-preview] Integrated: 8286306: Upcall wrapper class sharing
Jorn Vernee
jvernee at openjdk.java.net
Fri May 6 16:50:33 UTC 2022
On Fri, 6 May 2022 14:50:53 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> This patch adds upcall wrapper class sharing.
>
> I recently realized that these classes can be shared if they have the same input FunctionDescriptor, but a different target method handle.
>
> This is implemented by generating a wrapper class that takes the target method handles as a leading argument. The target method handle is then inserted into the parameter list using `MethodHandles::insertArguments` to create the final method handle that is returned by the specializer. After MH customization kicks in, the target will be a constant again (so shouldn't affect peak performance).
>
> Doing this doesn't effect peak performance, as verified through the Upcalls benchmark, but does significantly improve linking performance.
>
> Before:
>
> Benchmark Mode Cnt Score Error Units
> LinkUpcall.link_blank avgt 30 69.323 � 2.522 us/op
>
> After:
>
> Benchmark Mode Cnt Score Error Units
> LinkUpcall.link_blank avgt 30 11.787 � 0.744 us/op
This pull request has now been integrated.
Changeset: 76ac3335
Author: Jorn Vernee <jvernee at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/76ac33356be4a6dfda05df9cf07413920116d4f2
Stats: 102 lines in 3 files changed: 94 ins; 0 del; 8 mod
8286306: Upcall wrapper class sharing
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/679
More information about the panama-dev
mailing list