harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulex Yang <paulex.y...@gmail.com>
Subject [classlib][NIO|VMI]JNI 1.4 enhancement on ByteBuffer
Date Tue, 13 Jun 2006 11:23:55 GMT
There is some enhancement on JNI spec in JDK 1.4[1], and three methods are related to java.nio.ByteBuffer.

    * |NewDirectByteBuffer|

    * |GetDirectBufferAddress|

    * |GetDirectBufferCapacity|

Because these methods are actually classlib dependent and JNI implementation must know some
details of ByteBuffer implementation, current IBM VME hasn't them implemented, and seems DRLVM
doesn't implemented thoroughly(please correct me if I made mistake here, seems DRLVM tries
to get some non-api method/field of ByteBuffer, and if fails, it return NULL or -1 as JNI
spec says). And I have no idea how Sable/JCHEVM/BootJVM deals with this issue yet.(anyone
kindly let me know?)

I propose to provide the implementation in NIO component, and I raise Harmony-578 for it.
The idea is: export these three methods in NIO module as hynio.dll(.so), which is loaded by
Harmony launcher, and add these methods to VMI in some way, so that the VM vendor(i.e., JNI
implementation vendor) can add these methods to JNI function table. 

Other choices I can imagine now include:
1. Add related direct buffers class to kernel class, so that the VM vendor can implement it
as well as the JNI methods. IMO this is not good choice because buffers are actually VM independent,
it's not reasonable to let VM vendor to implement these classes.

2. Provides some utility methods in o.a.h.nio, add these methods to VMI, so that VM vendor
can get inside knowledge on the direct buffers by these utilities. This option is acceptable,
but it also needs to modify VMI, and the modification is based on some Harmony specific contract,
while my proposal above is based on public JNI spec, so this one is not preferred.

Any ideas and comments are highly welcome. 


Paulex Yang
China Software Development Lab

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message