diff options
author | Michael Koch <konqueror@gmx.de> | 2004-04-21 15:33:53 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2004-04-21 15:33:53 +0000 |
commit | 86a80fc3522cb14dd0b5a8f4913e8653111bbcc0 (patch) | |
tree | 5fa0cc964f6d61e0eb5bd8fc06169c322bd63729 /libjava/java | |
parent | f9da97f03ce8200d7ad3893ea0a5a181b92fd185 (diff) | |
download | gcc-86a80fc3522cb14dd0b5a8f4913e8653111bbcc0.zip gcc-86a80fc3522cb14dd0b5a8f4913e8653111bbcc0.tar.gz gcc-86a80fc3522cb14dd0b5a8f4913e8653111bbcc0.tar.bz2 |
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.
From-SVN: r80967
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/nio/DirectByteBufferImpl.java | 9 | ||||
-rw-r--r-- | libjava/java/nio/MappedByteBufferImpl.java | 3 | ||||
-rw-r--r-- | libjava/java/nio/natDirectByteBufferImpl.cc | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java index 7c2b783..be0fc52 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 ccd987e..5932c99 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 94225c3..88f53fc 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); } |