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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Sep 28 21:04:42 UTC 2020


> 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

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/386/files
  - new: https://git.openjdk.java.net/jdk/pull/386/files/24985028..085d0401

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=386&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=386&range=00-01

  Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/386.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/386/head:pull/386

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


More information about the core-libs-dev mailing list