[foreign-memaccess+abi] RFR: Fix test failures following 8300201

Jorn Vernee jvernee at openjdk.org
Tue Feb 7 19:25:14 UTC 2023


On Tue, 7 Feb 2023 18:43:17 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The fix for JDK-8300201 has introduced an initialization issue involving `NativeMemorySegmentImpl`. The constructor of that class is accessing the `UNSAFE` static field (declared in same class), but that field seems to be set to `null` in some cases (probably because of a static initializer loop). This is something I also have observed when working on https://git.openjdk.org/panama-foreign/pull/781
> 
> The fix is to just use the Unsafe static field for getting the address size, and avoid the `UNSAFE` field in the constructor. More investigation might follow, to pinpoint exactly where the initialization problem is.

Thanks for fixing. 

I think the virtual call might be triggering to earlier class loading during verification, to see whether the receiver argument on the stack is actually compatible with the receiver type of the declared called method.

Unsafe depends on ByteBuffer, which then leads back to MemorySegment, and from there to NativeMemorySegmentImpl I'm guessing.

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

Marked as reviewed by jvernee (Committer).

PR: https://git.openjdk.org/panama-foreign/pull/782


More information about the panama-dev mailing list