[foreign-memaccess] [Rev 01] RFR: Add MemorySegment::mismatch

Chris Hegarty chegar at openjdk.java.net
Wed May 20 17:36:12 UTC 2020


> Hi,
> 
> As part of feedback on the Foreign Memory API (when experimenting with its usage internally in the JDK), a small number
> of potential usability enhancements could be made to the API. This is the fourth such, and last on my current todo
> list.  This change proposes to add a new method:
> MemorySegment::mismatch
> 
> The mismatch semantic is very useful for building equality and comparison logic on top of segments. I found that I
> needed such when modeling and comparing native socket address in the JDK implementation. It is possible to write your
> own, but requires a non-trivial amount of not-trivial code - to do it right! I also think that we can provide a more
> efficient implementation building on top of the JDK's internal mismatch support.  I still need to do some perf testing
> and add a micro-benchmake ( Maurizio suggested possibly amending TestBulkOps ). There is also the question about
> possibly improving the JDK's internal implementation to work on long sizes (which could be done separately). For now, I
> just want to share the idea, along with the proposed specification and initial implementation.  Comments welcome.

Chris Hegarty has updated the pull request incrementally with one additional commit since the last revision:

  Move implementation into vectorizedMismatchLarge, and address other review comments.

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/180/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/180/files/ba7c8329..c5414aaf

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

  Stats: 74 lines in 4 files changed: 40 ins; 16 del; 18 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/180.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/180/head:pull/180

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


More information about the panama-dev mailing list