RFR: 8253590: java/foreign tests are still failing on x86_32 after foreign-memaccess integration [v2]

Paul Sandoz psandoz at openjdk.java.net
Tue Sep 29 00:12:04 UTC 2020


On Mon, 28 Sep 2020 21:04:42 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.
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove redundant expected exceptions from array test

Marked as reviewed by psandoz (Reviewer).

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

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


More information about the core-libs-dev mailing list