[foreign-memaccess] [Rev 01] RFR: JDK-8242051: Clarify difference between checked and unchecked addresses

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Apr 2 21:10:02 UTC 2020


> While most memory addresses are associated with a segment, addresses coming from native code, or those created from
> scratch (e.g. MemoryAddress::ofLong) do not have an associated segment.
> This patch addresses this problem by having unchecked memory addresses returning`null` on MemoryAddress::segment().
> Similarly, the MemoryAddress::offset method has been renamed to `segmentOffset` and now throws UOE if called on an
> unchecked address.  This makes the API cleaner: it is only possible to dereference those addresses which have an
> associated segment. I've tweaked the javadoc to convey that message more clearly.

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Update src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java
  
  Co-Authored-By: Jorn Vernee <JornVernee at users.noreply.github.com>

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/90/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/90/files/bb98d9ce..e661ecf8

Webrevs:
 - full: https://webrevs.openjdk.java.net/panama-foreign/90/webrev.01
 - incr: https://webrevs.openjdk.java.net/panama-foreign/90/webrev.00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/90.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/90/head:pull/90

PR: https://git.openjdk.java.net/panama-foreign/pull/90


More information about the panama-dev mailing list