diff options
Diffstat (limited to 'libjava/java/nio')
-rw-r--r-- | libjava/java/nio/Buffer.h | 4 | ||||
-rw-r--r-- | libjava/java/nio/Buffer.java | 18 | ||||
-rw-r--r-- | libjava/java/nio/ByteBuffer.h | 11 | ||||
-rw-r--r-- | libjava/java/nio/CharBuffer.h | 9 | ||||
-rw-r--r-- | libjava/java/nio/DirectByteBufferImpl.java | 10 | ||||
-rw-r--r-- | libjava/java/nio/DoubleBuffer.h | 9 | ||||
-rw-r--r-- | libjava/java/nio/FloatBuffer.h | 9 | ||||
-rw-r--r-- | libjava/java/nio/IntBuffer.h | 9 | ||||
-rw-r--r-- | libjava/java/nio/LongBuffer.h | 9 | ||||
-rw-r--r-- | libjava/java/nio/MappedByteBuffer.h | 9 | ||||
-rw-r--r-- | libjava/java/nio/MappedByteBufferImpl.h | 1 | ||||
-rw-r--r-- | libjava/java/nio/MappedByteBufferImpl.java | 5 | ||||
-rw-r--r-- | libjava/java/nio/ShortBuffer.h | 9 |
13 files changed, 87 insertions, 25 deletions
diff --git a/libjava/java/nio/Buffer.h b/libjava/java/nio/Buffer.h index fd985db9421..3b958b4964e 100644 --- a/libjava/java/nio/Buffer.h +++ b/libjava/java/nio/Buffer.h @@ -29,7 +29,7 @@ class java::nio::Buffer : public ::java::lang::Object { public: // actually package-private - Buffer(jint, jint, jint, jint); + Buffer(jint, jint, jint, jint, ::gnu::gcj::RawData *); public: virtual jint capacity(); virtual ::java::nio::Buffer * clear(); @@ -52,7 +52,9 @@ public: // actually package-private virtual void checkIndex(jint); virtual void checkIfReadOnly(); static void checkArraySize(jint, jint, jint); +private: jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) cap; +public: // actually package-private jint limit__; jint pos; jint mark__; diff --git a/libjava/java/nio/Buffer.java b/libjava/java/nio/Buffer.java index f369b962218..222b84fd5dd 100644 --- a/libjava/java/nio/Buffer.java +++ b/libjava/java/nio/Buffer.java @@ -45,22 +45,24 @@ import gnu.gcj.RawData; */ public abstract class Buffer { - int cap = 0; - int limit = 0; - int pos = 0; - int mark = -1; - RawData address; + private final int cap; + int limit; + int pos; + int mark; + final RawData address; /** * Creates a new Buffer. * * Should be package private. */ - Buffer (int capacity, int limit, int position, int mark) + Buffer (int capacity, int limit, int position, int mark, + RawData address) { if (capacity < 0) throw new IllegalArgumentException (); + this.address = address; cap = capacity; limit (limit); position (position); @@ -72,6 +74,10 @@ public abstract class Buffer this.mark = mark; } + else + { + this.mark = -1; + } } /** diff --git a/libjava/java/nio/ByteBuffer.h b/libjava/java/nio/ByteBuffer.h index 7836894bde7..cf1f5be6680 100644 --- a/libjava/java/nio/ByteBuffer.h +++ b/libjava/java/nio/ByteBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -31,7 +38,7 @@ class java::nio::ByteBuffer : public ::java::nio::Buffer { public: // actually package-private - ByteBuffer(jint, jint, jint, jint); + ByteBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jbyte > *, jint); public: static ::java::nio::ByteBuffer * allocateDirect(jint); static ::java::nio::ByteBuffer * allocate(jint); @@ -96,8 +103,8 @@ public: virtual jint compareTo(::java::lang::Object *); public: // actually package-private ::java::nio::ByteOrder * __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) endian; - jint array_offset; JArray< jbyte > * backing_buffer; + jint array_offset; public: static ::java::lang::Class class$; }; diff --git a/libjava/java/nio/CharBuffer.h b/libjava/java/nio/CharBuffer.h index 3d3356041ea..73b4ba91770 100644 --- a/libjava/java/nio/CharBuffer.h +++ b/libjava/java/nio/CharBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -25,7 +32,7 @@ class java::nio::CharBuffer : public ::java::nio::Buffer { public: // actually package-private - CharBuffer(jint, jint, jint, jint); + CharBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jchar > *, jint); public: static ::java::nio::CharBuffer * allocate(jint); static ::java::nio::CharBuffer * wrap(JArray< jchar > *, jint, jint); diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java index e448ea97cf1..dd40d5a4126 100644 --- a/libjava/java/nio/DirectByteBufferImpl.java +++ b/libjava/java/nio/DirectByteBufferImpl.java @@ -109,25 +109,23 @@ abstract class DirectByteBufferImpl extends ByteBuffer DirectByteBufferImpl(int capacity) { - super(capacity, capacity, 0, -1); + super(capacity, capacity, 0, -1, + VMDirectByteBuffer.allocate(capacity), null, 0); this.owner = this; - this.address = VMDirectByteBuffer.allocate(capacity); } DirectByteBufferImpl(RawData address, int capacity) { - super(capacity, capacity, 0, -1); + super(capacity, capacity, 0, -1, address, null, 0); this.owner = null; - this.address = address; } DirectByteBufferImpl(Object owner, RawData address, int capacity, int limit, int position) { - super(capacity, limit, position, -1); + super(capacity, limit, position, -1, address, null, 0); this.owner = owner; - this.address = address; } /** diff --git a/libjava/java/nio/DoubleBuffer.h b/libjava/java/nio/DoubleBuffer.h index e201a4f2761..cb7da18f2b3 100644 --- a/libjava/java/nio/DoubleBuffer.h +++ b/libjava/java/nio/DoubleBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -25,7 +32,7 @@ class java::nio::DoubleBuffer : public ::java::nio::Buffer { public: // actually package-private - DoubleBuffer(jint, jint, jint, jint); + DoubleBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jdouble > *, jint); public: static ::java::nio::DoubleBuffer * allocate(jint); static ::java::nio::DoubleBuffer * wrap(JArray< jdouble > *, jint, jint); diff --git a/libjava/java/nio/FloatBuffer.h b/libjava/java/nio/FloatBuffer.h index 18348f2ea4b..334bdc482f7 100644 --- a/libjava/java/nio/FloatBuffer.h +++ b/libjava/java/nio/FloatBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -25,7 +32,7 @@ class java::nio::FloatBuffer : public ::java::nio::Buffer { public: // actually package-private - FloatBuffer(jint, jint, jint, jint); + FloatBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jfloat > *, jint); public: static ::java::nio::FloatBuffer * allocate(jint); static ::java::nio::FloatBuffer * wrap(JArray< jfloat > *, jint, jint); diff --git a/libjava/java/nio/IntBuffer.h b/libjava/java/nio/IntBuffer.h index e099d4a0b23..fa225071272 100644 --- a/libjava/java/nio/IntBuffer.h +++ b/libjava/java/nio/IntBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -25,7 +32,7 @@ class java::nio::IntBuffer : public ::java::nio::Buffer { public: // actually package-private - IntBuffer(jint, jint, jint, jint); + IntBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jint > *, jint); public: static ::java::nio::IntBuffer * allocate(jint); static ::java::nio::IntBuffer * wrap(JArray< jint > *, jint, jint); diff --git a/libjava/java/nio/LongBuffer.h b/libjava/java/nio/LongBuffer.h index 0e6ad30ef07..622f2419c2f 100644 --- a/libjava/java/nio/LongBuffer.h +++ b/libjava/java/nio/LongBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -25,7 +32,7 @@ class java::nio::LongBuffer : public ::java::nio::Buffer { public: // actually package-private - LongBuffer(jint, jint, jint, jint); + LongBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jlong > *, jint); public: static ::java::nio::LongBuffer * allocate(jint); static ::java::nio::LongBuffer * wrap(JArray< jlong > *, jint, jint); diff --git a/libjava/java/nio/MappedByteBuffer.h b/libjava/java/nio/MappedByteBuffer.h index d8b3f49a652..05fe81b3c27 100644 --- a/libjava/java/nio/MappedByteBuffer.h +++ b/libjava/java/nio/MappedByteBuffer.h @@ -9,6 +9,13 @@ #include <java/nio/ByteBuffer.h> extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -22,7 +29,7 @@ class java::nio::MappedByteBuffer : public ::java::nio::ByteBuffer { public: // actually package-private - MappedByteBuffer(jint, jint, jint, jint); + MappedByteBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *); virtual void forceImpl(); public: virtual ::java::nio::MappedByteBuffer * force(); diff --git a/libjava/java/nio/MappedByteBufferImpl.h b/libjava/java/nio/MappedByteBufferImpl.h index e678d49fb73..71725bf1ba3 100644 --- a/libjava/java/nio/MappedByteBufferImpl.h +++ b/libjava/java/nio/MappedByteBufferImpl.h @@ -88,6 +88,7 @@ public: // actually package-private jboolean isLoadedImpl(); void loadImpl(); void forceImpl(); +private: jboolean __attribute__((aligned(__alignof__( ::java::nio::MappedByteBuffer)))) readOnly; public: ::gnu::gcj::RawData * implPtr; diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java index 444eeea9104..c8d458a38a5 100644 --- a/libjava/java/nio/MappedByteBufferImpl.java +++ b/libjava/java/nio/MappedByteBufferImpl.java @@ -44,7 +44,7 @@ import java.io.IOException; final class MappedByteBufferImpl extends MappedByteBuffer { - boolean readOnly; + private final boolean readOnly; /** Posix uses this for the pointer returned by mmap; * Win32 uses it for the pointer returned by MapViewOfFile. */ @@ -56,8 +56,7 @@ final class MappedByteBufferImpl extends MappedByteBuffer public MappedByteBufferImpl(RawData address, int size, boolean readOnly) throws IOException { - super(size, size, 0, -1); - this.address = address; + super(size, size, 0, -1, address); this.readOnly = readOnly; } diff --git a/libjava/java/nio/ShortBuffer.h b/libjava/java/nio/ShortBuffer.h index ddcfc093ee2..1cb82a085db 100644 --- a/libjava/java/nio/ShortBuffer.h +++ b/libjava/java/nio/ShortBuffer.h @@ -11,6 +11,13 @@ extern "Java" { + namespace gnu + { + namespace gcj + { + class RawData; + } + } namespace java { namespace nio @@ -25,7 +32,7 @@ class java::nio::ShortBuffer : public ::java::nio::Buffer { public: // actually package-private - ShortBuffer(jint, jint, jint, jint); + ShortBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jshort > *, jint); public: static ::java::nio::ShortBuffer * allocate(jint); static ::java::nio::ShortBuffer * wrap(JArray< jshort > *, jint, jint); |