RFR: 8318609: Upcall stubs should be smaller [v2]
Jorn Vernee
jvernee at openjdk.org
Mon Oct 23 10:35:36 UTC 2023
On Sat, 21 Oct 2023 12:02:52 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
>> We can use `resolve_global_jobject` (introduced by [JDK-8299089](https://bugs.openjdk.org/browse/JDK-8299089)) because we know that the handle is created by `JNIHandles::make_global` in `UL_MakeUpcallStub`. That creates much shorter code.
>>
>> Size reduced from 1360 bytes to 648 bytes on x64 for a trivial upcall using G1.
>> 1584 bytes to 936 bytes using ShenandoahGC.
>> 1064 bytes to 848 bytes using Generational ZGC.
>>
>> We can get even smaller size by moving `JNIHandles::resolve(receiver)` into `UpcallLinker::on_entry` (2nd commit):
>> 616 bytes regardless of GC.
>> This was originally proposed here: https://github.com/openjdk/jdk/pull/12708#discussion_r1180394508
>
> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>
> Move JNIHandles::resolve(receiver) into C code.
Hey Martin, the changes look good.
Another thing we could do to reduce the size of the upcall stubs is move the exception handler to stub routines. The exception handler is the same for every upcall stub, but we generate one for each.
I have a POC for x64/aarch64 that I've rebased that moves the exception handler out of line: https://github.com/openjdk/jdk/compare/master...JornVernee:jdk:Shared_E_Handler feel free to use that if you want. Or, I can address that separately.
-------------
Marked as reviewed by jvernee (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/16290#pullrequestreview-1692216282
More information about the hotspot-compiler-dev
mailing list