summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-21 15:33:53 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-21 15:33:53 +0000
commitabb13663a66a4e38613848766fe687c276ec41b6 (patch)
tree5fa0cc964f6d61e0eb5bd8fc06169c322bd63729
parent54ec2a40e023563fc136d7084f397706bf8141de (diff)
downloadgcc-abb13663a66a4e38613848766fe687c276ec41b6.tar.gz
2004-04-21 Michael Koch <konqueror@gmx.de>
* java/nio/DirectByteBufferImpl.java (shiftDown): Made static, give address as argument and provide a convenience method that overwrites shiftDown in ByteBufferImpl and calls the native shiftDown. * java/nio/MappedByteBufferImpl.java (): Use optimized method in DirectByteBufferImpl. * java/nio/natDirectByteBufferImpl.cc (shiftDown): Changed method signature. Removed usage of array_offset. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80967 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog11
-rw-r--r--libjava/java/nio/DirectByteBufferImpl.java9
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java3
-rw-r--r--libjava/java/nio/natDirectByteBufferImpl.cc6
4 files changed, 23 insertions, 6 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 04c0876b879..56bcc327864 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,16 @@
2004-04-21 Michael Koch <konqueror@gmx.de>
+ * java/nio/DirectByteBufferImpl.java
+ (shiftDown): Made static, give address as argument and
+ provide a convenience method that overwrites shiftDown in
+ ByteBufferImpl and calls the native shiftDown.
+ * java/nio/MappedByteBufferImpl.java
+ (): Use optimized method in DirectByteBufferImpl.
+ * java/nio/natDirectByteBufferImpl.cc
+ (shiftDown): Changed method signature. Removed usage of array_offset.
+
+2004-04-21 Michael Koch <konqueror@gmx.de>
+
* gnu/java/net/natPlainSocketImplPosix.cc
(SocketInputStream::read): Make sure returned data is a byte value.
diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java
index 7c2b783d7d8..be0fc52c07d 100644
--- a/libjava/java/nio/DirectByteBufferImpl.java
+++ b/libjava/java/nio/DirectByteBufferImpl.java
@@ -136,15 +136,20 @@ final class DirectByteBufferImpl extends ByteBuffer
return this;
}
- native void shiftDown (int dst_offset, int src_offset, int count);
+ static native void shiftDown(RawData address, int dst_offset, int src_offset, int count);
+ void shiftDown(int dst_offset, int src_offset, int count)
+ {
+ shiftDown(address, dst_offset, src_offset, count);
+ }
+
public ByteBuffer compact ()
{
int pos = position();
if (pos > 0)
{
int count = remaining();
- shiftDown(0, pos, count);
+ shiftDown(address, 0, pos, count);
position(count);
limit(capacity());
}
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index ccd987edfbd..5932c99f6d0 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -121,7 +121,8 @@ final class MappedByteBufferImpl extends MappedByteBuffer
if (pos > 0)
{
int count = remaining();
- shiftDown(0, pos, count);
+ // Call shiftDown method optimized for direct buffers.
+ DirectByteBufferImpl.shiftDown(address, 0, pos, count);
position(count);
limit(capacity());
}
diff --git a/libjava/java/nio/natDirectByteBufferImpl.cc b/libjava/java/nio/natDirectByteBufferImpl.cc
index 94225c39885..88f53fc2bea 100644
--- a/libjava/java/nio/natDirectByteBufferImpl.cc
+++ b/libjava/java/nio/natDirectByteBufferImpl.cc
@@ -65,9 +65,9 @@ java::nio::DirectByteBufferImpl::adjustAddress (RawData* address, jint offset)
void
java::nio::DirectByteBufferImpl::shiftDown
-(jint dst_offset, jint src_offset, jint count)
+(RawData* address, jint dst_offset, jint src_offset, jint count)
{
- jbyte* dst = reinterpret_cast<jbyte*> (address) + array_offset + dst_offset;
- jbyte* src = reinterpret_cast<jbyte*> (address) + array_offset + src_offset;
+ jbyte* dst = reinterpret_cast<jbyte*> (address) + dst_offset;
+ jbyte* src = reinterpret_cast<jbyte*> (address) + src_offset;
::memmove(dst, src, count);
}