This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: java.nio.DirectBufferImpl.shiftDown()


Michael Koch wrote:

Hi list,


On request of some people using java.nio with JNI I made java.nio.DirectBufferImpl.shiftDown() static and removed an unecessary usage of array_offset which is always 0 for direct buffers and is intended only for buffers with backend arrays.


Per: whats your opinion about this ?

But what about a ShortViewBufferImpl that is created by calling asShortBuffer on a DirectBufferImpl? You're now using the slow shiftDown implementation in ByteBuffer instead of the much faster native method.

Why do some implementations need DirectBufferImpl.shiftDown to
be static?

A possible solution: To your patch add to DirectBufferImpl:

void shiftDown (int dst_offset, int src_offset, int count)
{
  shiftDown(address, dst_offset, srd_offset, count);
}

Same thing in MappedByteBuffer:

void shiftDown (int dst_offset, int src_offset, int count)
{
  DirectByteBufferImpl.shiftDown(address, dst_offset, srd_offset, count);
}
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]