[foreign-memaccess+abi] RFR: 8299730: Add trivial call linker option [v5]
Jorn Vernee
jvernee at openjdk.org
Tue Jan 31 13:13:31 UTC 2023
On Mon, 30 Jan 2023 21:43:01 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:
>
> disable TestTrivialUpcall on zero
Note that the current javadoc already hints that the implementation may (or may not) apply additional optimizations:
* Using this linker option is a hint which some implementations may use to apply
* optimizations that are only valid for trivial functions.
I don't think throwing a UOE is necessary in this case. (Though in general I think a particular linker implementation refusing a linker option is something that we want to allow, if only just in case)
-------------
PR: https://git.openjdk.org/panama-foreign/pull/771
More information about the panama-dev
mailing list