RFR: 8378615: FFM Bound up call stub keeps JNI Global Ref to bound parameter

Phil Race prr at openjdk.org
Wed Feb 25 18:57:37 UTC 2026


On Wed, 25 Feb 2026 18:36:06 GMT, Phil Race <prr at openjdk.org> wrote:

> This fixes a problem whereby because a bound up call stub method handle holds on to the bound argument using a JNI Global Ref, GC of that object is prevented until the method handle is freed.
> In the font layout code this causes us to be unable to collect fonts which are used as the bound argument.
> So this fix changes from using the bound arg to using the existing scoped value font.

src/java.desktop/share/classes/sun/font/HBShaper.java line 214:

> 212:         Arena garena = Arena.global(); // creating stubs that exist until VM exit.
> 213: 
> 214:         get_table_data_fn_stub = getUpcallStub(garena,

In a future PR I'm thinking of migrating the lookups below to use this same fn since it should simplify those calls. Before this change the fn was specific to the bound arg case, but it no longer does that

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29924#discussion_r2854786625


More information about the client-libs-dev mailing list