This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH to optimize two Channels methods


Am Dienstag, 9. März 2004 12:41 schrieb Richard Earnshaw:
> > Am Dienstag, 9. März 2004 11:25 schrieb Richard Earnshaw:
> > > Is there any chance of this being fixed soon?  Or should I put in
> > > a request for the offending patch(es) to be backed out?
> >
> > I thought Per fixes his mess himself or says "no time, can someone
> > please do ?".
>
> Well I would normally hope for a reply rather than stony silence...
> :-(

I waited for an answer of him too.

> > Anyway, I have written a short patch. Can you try it ?

Another iteration of the patch as I forgot the include files.

Michael
Index: gnu/java/nio/channels/natFileChannelEcos.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/channels/natFileChannelEcos.cc,v
retrieving revision 1.1
diff -u -b -B -r1.1 natFileChannelEcos.cc
--- gnu/java/nio/channels/natFileChannelEcos.cc	29 Feb 2004 19:09:27 -0000	1.1
+++ gnu/java/nio/channels/natFileChannelEcos.cc	9 Mar 2004 11:49:48 -0000
@@ -26,6 +26,10 @@
 #include <java/lang/NullPointerException.h>
 #include <java/lang/String.h>
 #include <java/io/FileNotFoundException.h>
+#include <java/nio/MappedByteBufferImpl.h>
+#include <java/nio/channels/FileChannel.h>
+#include <java/nio/channels/FileLock.h>
+#include <gnu/java/nio/channels/FileChannelImpl.h>
 
 extern "C" void diag_write_char (char c);
 
@@ -41,22 +45,31 @@
 
 #define NO_FSYNC_MESSAGE "sync unsupported"
 
+using gnu::gcj::RawData;
+using java::io::IOException;
+using java::nio::MappedByteBufferImpl;
+using java::io::InterruptedIOException;
+using java::io::FileNotFoundException;
+using java::lang::ArrayIndexOutOfBoundsException;
+using gnu::java::nio::channels::FileChannelImpl;
+
 void
-java::io::FileDescriptor::init(void)
+FileChannel::init(void)
 {
-  in = new java::io::FileDescriptor(0);
-  out = new java::io::FileDescriptor(1);
-  err = new java::io::FileDescriptor(2);
+  in = new FileChannelImpl((jint) 0, FileChannelImpl::READ);
+  out = new FileChannelImpl((jint) 1, FileChannelImpl::WRITE);
+  err = new FileChannelImpl((jint) 2, FileChannelImpl::WRITE);
 }
 
+#if 0
 jboolean
-java::io::FileDescriptor::valid (void)
+FileChannelImpl::valid (void)
 {
   return true;
 }
 
 void
-java::io::FileDescriptor::sync (void)
+FileChannelImpl::sync (void)
 {
   // Some files don't support fsync.  We don't bother reporting these
   // as errors.
@@ -65,22 +78,23 @@
   throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
 #endif
 }
+#endif
 
 jint
-java::io::FileDescriptor::open (jstring path, jint jflags)
+FileChannelImpl::open (jstring path, jint jflags)
 {
   return fd;
 }
 
 void
-java::io::FileDescriptor::write (jint b)
+FileChannelImpl::write (jint b)
 {
   char d = (char) b;
   ::diag_write (&d, 1);
 }
 
 void
-java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
+FileChannelImpl::write (jbyteArray b, jint offset, jint len)
 {
   if (! b)
     throw new java::lang::NullPointerException;
@@ -91,69 +105,69 @@
 }
 
 void
-java::io::FileDescriptor::close (void)
+FileChannelImpl::close (void)
 {
 }
 
 void
-java::io::FileDescriptor::setLength (long)
+FileChannelImpl::setLength (long)
 {
 }
 
 jint
-java::io::FileDescriptor::seek (jlong pos, jint whence, jboolean)
+FileChannelImpl::seek (jlong pos, jint whence, jboolean)
 {
   JvAssert (whence == SET || whence == CUR);
   return 0;
 }
 
 jlong
-java::io::FileDescriptor::getLength (void)
+FileChannelImpl::getLength (void)
 {
   return 0;
 }
 
 jlong
-java::io::FileDescriptor::getFilePointer (void)
+FileChannelImpl::getFilePointer (void)
 {
   return 0;
 }
 
 jint
-java::io::FileDescriptor::read (void)
+FileChannelImpl::read (void)
 {
   return 0;
 }
 
 jint
-java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
+FileChannelImpl::read (jbyteArray buffer, jint offset, jint count)
 {
   return 0;
 }
 
 jint
-java::io::FileDescriptor::available (void)
+FileChannelImpl::available (void)
 {
   return 0;
 }
 
 void
-java::io::FileDescriptor::lock (jlong pos, jint len, jboolean shared)
+FileChannelImpl::lock (jlong pos, jint len, jboolean shared)
 {
   throw new IOException (JvNewStringLatin1
-    ("java.io.FileDescriptor.lock() not implemented"));
+    ("gnu.java.nio.FileChannelImpl.lock() not implemented"));
 }
 
 jboolean
-java::io::FileDescriptor::tryLock (jlong pos, jint len, jboolean shared)
+FileChannelImpl::tryLock (jlong pos, jint len, jboolean shared)
 {
   throw new IOException (JvNewStringLatin1
-    ("java.io.FileDescriptor.tryLock() not implemented"));
+    ("gnu.java.nio.FileChannelImpl.tryLock() not implemented"));
 }
 
 void
-java::io::FileDescriptor::unlock (jlong pos, jint len)
+FileChannelImpl::unlock (jlong pos, jint len)
 {
   throw new IOException (JvNewStringLatin1
-    ("java.io.FileDescriptor.unlock() not implemented"));
+    ("gnu.java.nio.channels.FileChannelImpl.unlock() not implemented"));
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]