Mark Wielaard wrote:

>>>>do you have any plan on adding nio support and asynchronous io to the 
>>>>classpath project? 
>>>>if yes what is your agenda on this subject. 
>>>>
>>>I have done a little bit of work for GCJ with this.
>>>
>
>I have read the online 1.4 specs for java.nio and thought about how to
>implement it but I have done no actual work. We will get it in time, but
>nobody is actively working on it at the moment.
>

I've started to implement some of the Buffer and mapped I/O stuff in my 
GCJ tree too.

Its relatively simple to implement for CNI, however I think we'll need 
to look at adding some special support for buffers in GCJ in order to 
get really good performance from zero-copy I/O. Thats because the idea 
is to write things like:

while (buf.hasRemaining())
  ... = buf.get();

in order to avoid copying data into an array during I/O, but unless they 
get inlined the call overhead is going to kill any performance gain 
obtained from not copying. Inlining the hasRemaining() and all its 
friends is easy because they are final, but the buf.get() is a bit 
harder because its a virtual method. However if we taught GCJ that the 
various methods in nio usually/always return a GCJMappedByteBuffer or 
whatever, it could inline the get() too and the whole things becomes no 
less efficient than a regular bounds-checked array acccess.

Its just a shame they didn't include Buffer methods like:

byte[] get(int length); // get bytes from the buffer as a shared byte 
array.

I guess allowing that sort of thing would raise aliasing issues for the 
JITs, and you couldn't do it for a read-only buffer without changing the 
semantics of arrays.

regards

Bryce.



_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to