This PR proposes to handle smaller FFM copy operations with Java code rather 
than transitioning to native code. This will improve performance. In this PR, 
copy operations involving zero to 63 bytes will be handled by Java code.

Here is what it looks like for Windows x64:

![image](https://github.com/user-attachments/assets/6b31206e-3b24-4b34-bf38-a1be393186d3)

Here is another chart for Linux a64:

![image](https://github.com/user-attachments/assets/87985561-3678-436c-b9e8-c7dd127347c3)

Other platforms exhibit similar behavior. It should be noted that the gain with 
this PR is pronounced for certain common sizes that are more likely to appear 
in code (e.g. 8, 16, 24, and 32)

It would be possible to use the same code path for the 7arg  
`MemorySegment::copy` method if it is similar to:


MemorySegment.copy(heapSrcSegment, JAVA_BYTE, 0, heapDstSegment, JAVA_BYTE, 0, 
ELEM_SIZE);


This could be added in a separate PR.

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

Commit messages:
 - Fix copyright years
 - Clean up
 - Increase threshhold to 64 bytes
 - Merge branch 'master' into copy-performance
 - Merge branch 'master' into mismatch-performance
 - Only handle disjunct mem copy
 - Add implementation
 - Improve benchmarks
 - Fix bugs
 - Add prototypes

Changes: https://git.openjdk.org/jdk/pull/20829/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20829&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8338591
  Stats: 299 lines in 4 files changed: 286 ins; 6 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/20829.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20829/head:pull/20829

PR: https://git.openjdk.org/jdk/pull/20829

Reply via email to