[foreign-memaccess] RFR 8224993: Add Unsafe support for MemoryAddress (again)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu May 30 14:59:03 UTC 2019


Hi,
small followup to yesterday's push.

As I was benchmarking bulk copy performances, I realized that there's a 
bug in the methods which I added yesterday on sun.misc.Unsafe - which 
delegate to the wrong Unsafe (itself), resulting in SO.

I also cleaned up uses of Unsafe internally - and added a @ForceInline 
on MemoryAddressImpl::copy which basically makes it as fast as a raw 
unsafe call to Unsafe::copyMemory. We're still investigating as to why 
exactly the annotation is needed to get good inlining.

I've also added a shortcircuit in AbstractMemoryScopeImpl::checkAlive, 
which avoids a call to 'isAlive' if the scope is pinned. This was 
causing some profile pollution (although performances were still good - 
probably because of the bi-morphic inline cache).

Webrev:
http://cr.openjdk.java.net/~mcimadamore/panama/8224993_followup/

Maurizio



More information about the panama-dev mailing list