On Wed, 22 Apr 2026 13:42:49 GMT, Casper Norrbin <[email protected]> wrote:

> Hi everyone,
> 
> One of the `FlatFieldPayload` constructors uses `container->klass()` when 
> calling `inline_layout_info_adr`, even though the layout should be resolved 
> from `field_holder()`. When JNI `GetObjectField` or `SetObjectField` accesses 
> an inherited flat field on a derived class it ends up looking up inline 
> layout info from the that class instead of the class that actually declares 
> the field. In debug builds this triggers an assert, and in general it is the 
> wrong class to use for the lookup.
> 
> This path is only reached through JNI field access. The original fix is from 
> @stefank. I added a regression test that tests JNI reads and writes of 
> inherited flat fields and checks that the inherited base field is resolved 
> correctly. The new test hits the assert before the fix and passes with the 
> patch applied.
> 
> Testing:
> - Tier 1
> - New test testing modifying inherited flat fields through JNI 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: ff518b28
Author:    Casper Norrbin <[email protected]>
Committer: Paul Hübner <[email protected]>
URL:       
https://git.openjdk.org/valhalla/commit/ff518b28167d851af3710df25a7ead9db6229993
Stats:     196 lines in 4 files changed: 161 ins; 25 del; 10 mod

8382639: [lworld] FlatFieldPayload resolves super class field from sub class

Co-authored-by: Stefan Karlsson <[email protected]>
Reviewed-by: phubner, fparain

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

PR: https://git.openjdk.org/valhalla/pull/2355

Reply via email to