7168505: (bf) MappedByteBuffer.load does not load buffer's content into memory

Mike Duigou mike.duigou at oracle.com
Mon May 14 08:32:47 PDT 2012


Looks good. It's kind of amazing that the server compiler can figure out that unsafe.getByte() is side effect free.

The comment on unsused could be javadoc.

You could initialize x to unused and eliminate the conditional before assignment of unused from x

Mike

On May 14 2012, at 07:31 , Alan Bateman wrote:

> 
> This one is somewhat assuming. MappedByteBuffer.load touches each page in the mapping into order to load the buffer into memory. Unfortunately it gets compiled into essentially a no-op server compiler (aside from the madvise). Someone ran into this on the Mac porting list [1]. The reason it isn't observed with JDK6 and older is because the load method is implemented in native code (we moved it into into Java as part of changes to sort out some alignment issues and also to address the issue of the file being truncated). The webrev with the proposed changes is here:
> 
> http://cr.openjdk.java.net/~alanb/7168505/webrev/
> 
> There are other ways of course.
> 
> -Alan
> 
> [1] http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-May/004143.html



More information about the nio-dev mailing list