Index: java/nio/DirectByteBufferImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/DirectByteBufferImpl.java,v retrieving revision 1.9 diff -u -r1.9 DirectByteBufferImpl.java --- java/nio/DirectByteBufferImpl.java 12 Apr 2004 12:55:11 -0000 1.9 +++ java/nio/DirectByteBufferImpl.java 22 Apr 2004 07:27:17 -0000 @@ -136,15 +136,20 @@ return this; } - static native void shiftDown (RawData address, 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()); } Index: java/nio/MappedByteBufferImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/MappedByteBufferImpl.java,v retrieving revision 1.8 diff -u -r1.8 MappedByteBufferImpl.java --- java/nio/MappedByteBufferImpl.java 8 Apr 2004 21:25:59 -0000 1.8 +++ java/nio/MappedByteBufferImpl.java 22 Apr 2004 07:27:17 -0000 @@ -121,7 +121,8 @@ 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()); }