Integrated: 8253590: java/foreign tests are still failing on x86_32 after foreign-memaccess integration

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Sep 29 09:43:00 UTC 2020


On Mon, 28 Sep 2020 20:14:28 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This patch addresses a problem in a couple of tests for the foreign memory access API; we have two methods in the API,
> namely `MemorySegment::asByteBuffer` and `MemorySegment::toByteArray` which should throw an exception if invoked on a
> segment whose size is bigger than Integer.MAX_VALUE. The problem is that on 32-bits platform is not really possible to
> allocate a segment bigger than that; for that reason, at some point during 14 we "fixed" this by tweaking the test to
> allocate so much memory that the allocation itself would fail.  When we integrated the latest API changes, this dubious
> fix was reverted, and now the tests have started misbehaving again. A much better solution is not to rely on
> allocation; the two tests should just create a synthetic segment using `MemorySegment::ofNativeRestricted`; this way we
> can test that the API throws when it should, w/o being impacted by what Unsafe does, or does not support on 32-bits
> platforms.

This pull request has now been integrated.

Changeset: ebf443a1
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/ebf443a1
Stats:     10 lines in 2 files changed: 2 ins; 2 del; 6 mod

8253590: java/foreign tests are still failing on x86_32 after foreign-memaccess integration

Reviewed-by: psandoz

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

PR: https://git.openjdk.java.net/jdk/pull/386


More information about the core-libs-dev mailing list