Committed. I changed a few minor things, such as using Mark's
suggestion to use 'madvise' to load the file into core.
I can't get this to work with Jamvm on Darwin; I get a bizarre
segfault when trying to create the new MappedByteBufferImpl, and
apparently 'mincore' does not work properly if the mapped region is
only one page in size. This appears to work fine on GNU/Linux,
however, so I'm putting it down to problems with Darwin.
On Jul 18, 2005, at 11:58 PM, Casey Marshall wrote:
Hi,
Attached is a patch I'd like to get some comments on, before I
check it in, especially if anyone can spot holes in my C. This patch
- Implements FileChannel.map, and the native methods needed for
MappedByteBufferImpl.
- Adds a bulk put implementation to DirectByteBufferImpl using
memcpy. This resulted in a 10x speedup of that method on jamvm (it
is almost as good as the Blackdown JVM 1.4.2).
- Fixes a memory leak in the native implementation of the bulk
'get' method in VMDirectByteBuffer (it never called
ReleaseByteArrayElements for the source array).
Ok? I might be too busy to get to this until next weekend.
(Apologies if the patch is 'application/octet-stream.' If anyone
knows how to convince Mail.app that '.patch' is text/plain or text/
x-patch, I'd like to hear how.)
2005-07-18 Casey Marshall <[EMAIL PROTECTED]>
* configure.ac (AC_CHECK_HEADERS): add "sys/mman.h".
(AC_CHECK_FUNCS): add mmap and related functions.
* include/java_nio_VMDirectByteBuffer.h: regenerated.
* java/nio/DirectByteBufferImpl.java (put): new method.
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(ALIGN_DOWN): new macro.
(ALIGN_UP): new macro.
(Java_gnu_java_nio_channels_FileChannelImpl_mapImpl): implemented.
* native/jni/java-nio/java_nio_MappedByteBufferImpl.c: updated
copyright years.
(ALIGN_DOWN): new macro.
(ALIGN_UP): new macro.
(get_pagesize): new function.
(get_raw_values): new function.
(Java_java_nio_MappedByteBufferImpl_unmapImpl): implemented.
(Java_java_nio_MappedByteBufferImpl_isLoadedImpl): implemented.
(Java_java_nio_MappedByteBufferImpl_loadImpl): implemented.
(Java_java_nio_MappedByteBufferImpl_forceImpl): implemented.
* native/jni/java-nio/java_nio_VMDirectByteBuffer.c
(Java_java_nio_VMDirectByteBuffer_put): renamed to
'Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_RawData_2IB.'
(Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_RawData_2I_3BII)
:
call 'ReleaseByteArrayElements' on the source byte array elements.
(Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_RawData_2I_3BII)
:
new method.
* vm/reference/java/nio/VMDirectByteBuffer.java
(put): new method.
<nio.patch>
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches