Am 20.12.2012 18:18, schrieb Aleksey Shipilev:
On 12/20/2012 09:11 PM, mark.reinh...@oracle.com wrote:
2012/12/19 12:37 -0800, david.hol...@oracle.com:
If multiple threads have to synchronize access to the buffer then the
reads/writes do not need to be atomic. Atomicity is only needed when
data races are allowed.
Correct.

Byte buffers, especially the direct variety, are all about performance.
Making operations upon them atomic is not a problem that needs to be
solved.
I would say that you can have the read/write atomicity for heap
ByteBuffers without the compromises in performance (i.e. like direct
ByteBuffer does with full-width reads/writes) -- basically prune out the
Java code which breaks ints into the series of bytes, and cram in
Unsafe.putInt() against backing array.

I believe, it would enhance performance too.
Also intrinsifying could be interesting.
Here is a similar request:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6914113

-Ulf

Reply via email to