[code-reflection] Integrated: Make downcall method handles for ORT API functions static
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Feb 18 19:28:19 UTC 2025
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.
-------------
Commit messages:
- Move back the `handle` helper method to minimize diffs
- Add missing leading parameters
- Add commments
- Make ORT downcall handles static
Changes: https://git.openjdk.org/babylon/pull/322/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=322&range=00
Stats: 72 lines in 1 file changed: 28 ins; 15 del; 29 mod
Patch: https://git.openjdk.org/babylon/pull/322.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/322/head:pull/322
PR: https://git.openjdk.org/babylon/pull/322
More information about the babylon-dev
mailing list