[code-reflection] Integrated: Make downcall method handles for ORT API functions static

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Feb 18 19:28:30 UTC 2025


On Tue, 18 Feb 2025 15:15:26 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This PR tweaks the method handles in `OnnxRuntime` to be static and final.
> The trick is to use a so called "virtual" downcall handle -- a downcall handle that takes its input address as an extra parameter.
> Then, we can just adapt such a method handle to fetch the target function address from the incoming `runtimeAddress` parameter.
> This way, all the method handles modelling functions in the ORT API can be made static, which unlocks better C2 optimizations.
> 
> Clients of such method handles have to be tweaked to pass in the additional leading `runtimeAddress` parameter.

This pull request has now been integrated.

Changeset: 90be8529
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/90be85293126f550c8672adc706ff58d0c6309d3
Stats:     72 lines in 1 file changed: 28 ins; 15 del; 29 mod

Make downcall method handles for ORT API functions static

Reviewed-by: asotona

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

PR: https://git.openjdk.org/babylon/pull/322


More information about the babylon-dev mailing list