aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2004-09-24 06:41:57 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2004-09-24 06:41:57 +0000
commit9e54846fac74773abd332da983f911334baa2c41 (patch)
treede044ead0279b2f067cae39ad2fe643a03b72d02 /libjava
parent5d865dace2bb4f577bbd3a9b640cf5a55788c153 (diff)
downloadgcc-9e54846fac74773abd332da983f911334baa2c41.zip
gcc-9e54846fac74773abd332da983f911334baa2c41.tar.gz
gcc-9e54846fac74773abd332da983f911334baa2c41.tar.bz2
PipeImpl.java: Use VMPipe for native stuff.
2004-09-24 Michael Koch <konqueror@gmx.de> * gnu/java/nio/PipeImpl.java: Use VMPipe for native stuff. * gnu/java/nio/SelectorImpl.java: Use VMSelector for native stuff. * gnu/java/nio/VMPipe.java, gnu/java/nio/VMSelector.java: New files. * gnu/java/nio/natPipeImplEcos.cc, gnu/java/nio/natPipeImplPosix.cc, gnu/java/nio/natPipeImplWin32.cc: Ported to VMPipe. * gnu/java/nio/natSelectorImplEcos.cc, gnu/java/nio/natSelectorImplPosix.cc, gnu/java/nio/natSelectorImplWin32.cc: Ported to VMSelector. * Makefile.am: Added new files gnu/java/nio/VMPipe.java and gnu/java/nio/VMSelector.java. * Makefile.in: Regenerated. From-SVN: r88014
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog19
-rw-r--r--libjava/Makefile.am2
-rw-r--r--libjava/Makefile.in14
-rw-r--r--libjava/gnu/java/nio/PipeImpl.java5
-rw-r--r--libjava/gnu/java/nio/SelectorImpl.java15
-rw-r--r--libjava/gnu/java/nio/VMPipe.java64
-rw-r--r--libjava/gnu/java/nio/VMSelector.java59
-rw-r--r--libjava/gnu/java/nio/natPipeImplEcos.cc6
-rw-r--r--libjava/gnu/java/nio/natPipeImplPosix.cc6
-rw-r--r--libjava/gnu/java/nio/natPipeImplWin32.cc6
-rw-r--r--libjava/gnu/java/nio/natSelectorImplEcos.cc8
-rw-r--r--libjava/gnu/java/nio/natSelectorImplPosix.cc8
-rw-r--r--libjava/gnu/java/nio/natSelectorImplWin32.cc8
13 files changed, 184 insertions, 36 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index c48fea1..1a43194 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,22 @@
+2004-09-24 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/PipeImpl.java: Use VMPipe for native stuff.
+ * gnu/java/nio/SelectorImpl.java: Use VMSelector for native stuff.
+ * gnu/java/nio/VMPipe.java,
+ gnu/java/nio/VMSelector.java:
+ New files.
+ * gnu/java/nio/natPipeImplEcos.cc,
+ gnu/java/nio/natPipeImplPosix.cc,
+ gnu/java/nio/natPipeImplWin32.cc:
+ Ported to VMPipe.
+ * gnu/java/nio/natSelectorImplEcos.cc,
+ gnu/java/nio/natSelectorImplPosix.cc,
+ gnu/java/nio/natSelectorImplWin32.cc:
+ Ported to VMSelector.
+ * Makefile.am: Added new files gnu/java/nio/VMPipe.java and
+ gnu/java/nio/VMSelector.java.
+ * Makefile.in: Regenerated.
+
2004-09-24 Jeroen Frijters <jeroen@frijters.net>
* java/lang/StackTraceElement.java
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 42a2b8d..4b12704 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -2663,6 +2663,8 @@ gnu/java/nio/ServerSocketChannelImpl.java \
gnu/java/nio/ServerSocketChannelSelectionKey.java \
gnu/java/nio/SocketChannelImpl.java \
gnu/java/nio/SocketChannelSelectionKey.java \
+gnu/java/nio/VMPipe.java \
+gnu/java/nio/VMSelector.java \
gnu/java/nio/channels/FileChannelImpl.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index acce913..a65ca25 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -781,6 +781,7 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc resolve.cc \
gnu/java/nio/ServerSocketChannelSelectionKey.java \
gnu/java/nio/SocketChannelImpl.java \
gnu/java/nio/SocketChannelSelectionKey.java \
+ gnu/java/nio/VMPipe.java gnu/java/nio/VMSelector.java \
gnu/java/nio/channels/FileChannelImpl.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
@@ -3679,6 +3680,7 @@ am__objects_14 = $(am__objects_9) gnu/classpath/ServiceFactory.lo \
gnu/java/nio/ServerSocketChannelSelectionKey.lo \
gnu/java/nio/SocketChannelImpl.lo \
gnu/java/nio/SocketChannelSelectionKey.lo \
+ gnu/java/nio/VMPipe.lo gnu/java/nio/VMSelector.lo \
gnu/java/nio/channels/FileChannelImpl.lo \
gnu/java/nio/charset/ISO_8859_1.lo \
gnu/java/nio/charset/Provider.lo \
@@ -6466,6 +6468,8 @@ gnu/java/nio/ServerSocketChannelImpl.java \
gnu/java/nio/ServerSocketChannelSelectionKey.java \
gnu/java/nio/SocketChannelImpl.java \
gnu/java/nio/SocketChannelSelectionKey.java \
+gnu/java/nio/VMPipe.java \
+gnu/java/nio/VMSelector.java \
gnu/java/nio/channels/FileChannelImpl.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
@@ -9228,6 +9232,10 @@ gnu/java/nio/SocketChannelImpl.lo: gnu/java/nio/$(am__dirstamp) \
gnu/java/nio/SocketChannelSelectionKey.lo: \
gnu/java/nio/$(am__dirstamp) \
gnu/java/nio/$(DEPDIR)/$(am__dirstamp)
+gnu/java/nio/VMPipe.lo: gnu/java/nio/$(am__dirstamp) \
+ gnu/java/nio/$(DEPDIR)/$(am__dirstamp)
+gnu/java/nio/VMSelector.lo: gnu/java/nio/$(am__dirstamp) \
+ gnu/java/nio/$(DEPDIR)/$(am__dirstamp)
gnu/java/nio/channels/FileChannelImpl.lo: \
gnu/java/nio/channels/$(am__dirstamp) \
gnu/java/nio/channels/$(DEPDIR)/$(am__dirstamp)
@@ -14776,6 +14784,10 @@ mostlyclean-compile:
-rm -f gnu/java/nio/SocketChannelImpl.lo
-rm -f gnu/java/nio/SocketChannelSelectionKey.$(OBJEXT)
-rm -f gnu/java/nio/SocketChannelSelectionKey.lo
+ -rm -f gnu/java/nio/VMPipe.$(OBJEXT)
+ -rm -f gnu/java/nio/VMPipe.lo
+ -rm -f gnu/java/nio/VMSelector.$(OBJEXT)
+ -rm -f gnu/java/nio/VMSelector.lo
-rm -f gnu/java/nio/channels/FileChannelImpl.$(OBJEXT)
-rm -f gnu/java/nio/channels/FileChannelImpl.lo
-rm -f gnu/java/nio/channels/natFileChannelImpl.$(OBJEXT)
@@ -19345,6 +19357,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/ServerSocketChannelSelectionKey.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/SocketChannelImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/SocketChannelSelectionKey.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/VMPipe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/VMSelector.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/natNIOServerSocket.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/natPipeImpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/natSelectorImpl.Plo@am__quote@
diff --git a/libjava/gnu/java/nio/PipeImpl.java b/libjava/gnu/java/nio/PipeImpl.java
index b9a343c..df79e17 100644
--- a/libjava/gnu/java/nio/PipeImpl.java
+++ b/libjava/gnu/java/nio/PipeImpl.java
@@ -168,12 +168,9 @@ class PipeImpl extends Pipe
throws IOException
{
super();
- nativeInit (provider);
+ VMPipe.init (this, provider);
}
- private native void nativeInit (SelectorProvider provider)
- throws IOException;
-
public Pipe.SinkChannel sink()
{
return sink;
diff --git a/libjava/gnu/java/nio/SelectorImpl.java b/libjava/gnu/java/nio/SelectorImpl.java
index 239a5f8..62d0662 100644
--- a/libjava/gnu/java/nio/SelectorImpl.java
+++ b/libjava/gnu/java/nio/SelectorImpl.java
@@ -53,14 +53,6 @@ import gnu.classpath.Configuration;
public class SelectorImpl extends AbstractSelector
{
- static
- {
- // load the shared library needed for native methods.
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary ("javanio");
- }
- }
private Set keys;
private Set selected;
@@ -140,11 +132,6 @@ public class SelectorImpl extends AbstractSelector
return select (0);
}
- // A timeout value of 0 means block forever.
- private static native int implSelect (int[] read, int[] write,
- int[] except, long timeout)
- throws IOException;
-
private final int[] getFDsAsArray (int ops)
{
int[] result;
@@ -237,7 +224,7 @@ public class SelectorImpl extends AbstractSelector
try
{
begin();
- result = implSelect (read, write, except, timeout);
+ result = VMSelector.select (read, write, except, timeout);
}
finally
{
diff --git a/libjava/gnu/java/nio/VMPipe.java b/libjava/gnu/java/nio/VMPipe.java
new file mode 100644
index 0000000..15693e5
--- /dev/null
+++ b/libjava/gnu/java/nio/VMPipe.java
@@ -0,0 +1,64 @@
+/* VMPipe.java -- Reference implementation for VM hooks used by PipeImpl
+ Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.nio;
+
+import java.io.IOException;
+import java.nio.channels.spi.SelectorProvider;
+import gnu.classpath.Configuration;
+
+/**
+ * This class contains the native methods for gnu.java.nio.PipeImpl
+ * As such, it needs help from the VM.
+ *
+ * @author Patrik Reali
+ */
+final class VMPipe
+{
+
+ static
+ {
+ // load the shared library needed for native methods.
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary ("javanio");
+ }
+ }
+
+ static native void init(PipeImpl self, SelectorProvider provider)
+ throws IOException;
+}
diff --git a/libjava/gnu/java/nio/VMSelector.java b/libjava/gnu/java/nio/VMSelector.java
new file mode 100644
index 0000000..7d0606a
--- /dev/null
+++ b/libjava/gnu/java/nio/VMSelector.java
@@ -0,0 +1,59 @@
+/* VMSelector.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.nio;
+
+import gnu.classpath.Configuration;
+import java.io.IOException;
+
+public final class VMSelector
+{
+ static
+ {
+ // load the shared library needed for native methods.
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary ("javanio");
+ }
+ }
+
+ // A timeout value of 0 means block forever.
+ static native int select (int[] read, int[] write,
+ int[] except, long timeout)
+ throws IOException;
+
+}
diff --git a/libjava/gnu/java/nio/natPipeImplEcos.cc b/libjava/gnu/java/nio/natPipeImplEcos.cc
index 7c6b4b5..75af4eb 100644
--- a/libjava/gnu/java/nio/natPipeImplEcos.cc
+++ b/libjava/gnu/java/nio/natPipeImplEcos.cc
@@ -1,6 +1,6 @@
// natPipeImplEcos.cc
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -16,10 +16,12 @@ details. */
#include <unistd.h>
#include <gnu/java/nio/PipeImpl.h>
+#include <gnu/java/nio/VMPipe.h>
#include <java/io/IOException.h>
void
-gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider*)
+gnu::java::nio::VMPipe::init (gnu::java::nio::PipeImpl *self,
+ ::java::nio::channels::spi::SelectorProvider*)
{
throw new ::java::io::IOException (JvNewStringUTF ("nativeInit() not implemented"));
}
diff --git a/libjava/gnu/java/nio/natPipeImplPosix.cc b/libjava/gnu/java/nio/natPipeImplPosix.cc
index b847faa..7285dba 100644
--- a/libjava/gnu/java/nio/natPipeImplPosix.cc
+++ b/libjava/gnu/java/nio/natPipeImplPosix.cc
@@ -1,6 +1,6 @@
// natPipeImplPosix.cc
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -16,13 +16,15 @@ details. */
#include <unistd.h>
#include <gnu/java/nio/PipeImpl.h>
+#include <gnu/java/nio/VMPipe.h>
//#include <gnu/java/nio/PipeImpl$SinkChannelImpl.h>
//#include <gnu/java/nio/PipeImpl$SourceChannelImpl.h>
#include <java/io/IOException.h>
#include <java/nio/channels/spi/SelectorProvider.h>
void
-gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider* /*provider*/)
+gnu::java::nio::VMPipe::init (gnu::java::nio::PipeImpl *self,
+ ::java::nio::channels::spi::SelectorProvider* /*provider*/)
{
int filedes [2];
diff --git a/libjava/gnu/java/nio/natPipeImplWin32.cc b/libjava/gnu/java/nio/natPipeImplWin32.cc
index 4f48972..2f14b50 100644
--- a/libjava/gnu/java/nio/natPipeImplWin32.cc
+++ b/libjava/gnu/java/nio/natPipeImplWin32.cc
@@ -1,6 +1,6 @@
// natPipeImplWin32.cc
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -16,13 +16,15 @@ details. */
#include <unistd.h>
#include <gnu/java/nio/PipeImpl.h>
+#include <gnu/java/nio/VMPipe.h>
//#include <gnu/java/nio/PipeImpl$SinkChannelImpl.h>
//#include <gnu/java/nio/PipeImpl$SourceChannelImpl.h>
#include <java/io/IOException.h>
#include <java/nio/channels/spi/SelectorProvider.h>
void
-gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider* /*provider*/)
+gnu::java::nio::VMPipe::init (gnu::java::nio::PipeImpl *self,
+ ::java::nio::channels::spi::SelectorProvider* /*provider*/)
{
int filedes [2];
diff --git a/libjava/gnu/java/nio/natSelectorImplEcos.cc b/libjava/gnu/java/nio/natSelectorImplEcos.cc
index a733686..15fbafd 100644
--- a/libjava/gnu/java/nio/natSelectorImplEcos.cc
+++ b/libjava/gnu/java/nio/natSelectorImplEcos.cc
@@ -1,6 +1,6 @@
// natSelectorImplEcos.cc
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -14,12 +14,12 @@ details. */
#include <errno.h>
#include <string.h>
-#include <gnu/java/nio/SelectorImpl.h>
+#include <gnu/java/nio/VMSelector.h>
#include <java/io/IOException.h>
jint
-gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write,
- jintArray except, jlong timeout)
+gnu::java::nio::VMSelector::select (jintArray read, jintArray write,
+ jintArray except, jlong timeout)
{
throw new ::java::io::IOException (JvNewStringUTF ("implSelect() not implemented"));
}
diff --git a/libjava/gnu/java/nio/natSelectorImplPosix.cc b/libjava/gnu/java/nio/natSelectorImplPosix.cc
index ac16dac..b433900 100644
--- a/libjava/gnu/java/nio/natSelectorImplPosix.cc
+++ b/libjava/gnu/java/nio/natSelectorImplPosix.cc
@@ -1,6 +1,6 @@
// natSelectorImplPosix.cc
-/* Copyright (C) 2002, 2003 Free Software Foundation
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -14,7 +14,7 @@ details. */
#include <errno.h>
#include <string.h>
-#include <gnu/java/nio/SelectorImpl.h>
+#include <gnu/java/nio/VMSelector.h>
#include <java/io/InterruptedIOException.h>
#include <java/io/IOException.h>
#include <java/lang/Thread.h>
@@ -60,8 +60,8 @@ helper_reset (jintArray& fdArray)
}
jint
-gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write,
- jintArray except, jlong timeout)
+gnu::java::nio::VMSelector::select (jintArray read, jintArray write,
+ jintArray except, jlong timeout)
{
jint result;
int max_fd = 0;
diff --git a/libjava/gnu/java/nio/natSelectorImplWin32.cc b/libjava/gnu/java/nio/natSelectorImplWin32.cc
index 34c4deb..860f654 100644
--- a/libjava/gnu/java/nio/natSelectorImplWin32.cc
+++ b/libjava/gnu/java/nio/natSelectorImplWin32.cc
@@ -1,6 +1,6 @@
// natSelectorImplWin32.cc
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -11,12 +11,12 @@ details. */
#include <config.h>
#include <platform.h>
-#include <gnu/java/nio/SelectorImpl.h>
+#include <gnu/java/nio/VMSelector.h>
#include <java/lang/Thread.h>
jint
-gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write,
- jintArray except, jlong timeout)
+gnu::java::nio::VMSelector::select (jintArray read, jintArray write,
+ jintArray except, jlong timeout)
{
// FIXME: The API for implSelect is biased towards POSIX implementations.
jint* pReadFD = elements (read);