Integrated: 8318609: Upcall stubs should be smaller

Martin Doerr mdoerr at openjdk.org
Tue Oct 24 09:12:49 UTC 2023


On Fri, 20 Oct 2023 16:17:17 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
> 
> Moving exception handling into a shared stub saves a bit more. Got 576 bytes with 3rd commit.

This pull request has now been integrated.

Changeset: a644670c
Author:    Martin Doerr <mdoerr at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/a644670cc6afc3bd6cedaa7f0d7bb75c1de90417
Stats:     224 lines in 18 files changed: 112 ins; 95 del; 17 mod

8318609: Upcall stubs should be smaller

Co-authored-by: Jorn Vernee <jvernee at openjdk.org>
Reviewed-by: rrich, jvernee

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

PR: https://git.openjdk.org/jdk/pull/16290


More information about the hotspot-compiler-dev mailing list