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.

Attachment: nio.patch
Description: Binary data

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to