Import GNU Classpath (libgcj-import-20081021).
2008-10-22 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (libgcj-import-20081021). * Regenerate class and header files. * Regenerate auto* files. From-SVN: r141302
This commit is contained in:
parent
51c869cac9
commit
58ddc179d4
20 changed files with 242 additions and 550 deletions
|
@ -546,20 +546,28 @@ public final class System
|
|||
SecurityManager sm = SecurityManager.current; // Be thread-safe.
|
||||
if (sm != null)
|
||||
sm.checkPermission(new RuntimePermission("getenv.*"));
|
||||
|
||||
if (environmentMap == null)
|
||||
{
|
||||
List<String> environ = (List<String>)VMSystem.environ();
|
||||
Map<String,String> variables = new EnvironmentMap();
|
||||
for (String pair : environ)
|
||||
{
|
||||
String[] parts = pair.split("=");
|
||||
if (parts.length == 2)
|
||||
variables.put(parts[0], parts[1]);
|
||||
else
|
||||
variables.put(parts[0], "");
|
||||
}
|
||||
environmentMap = Collections.unmodifiableMap(variables);
|
||||
List<String> environ = (List<String>)VMSystem.environ();
|
||||
for (String envEntry : environ)
|
||||
{
|
||||
// avoid broken and null entries
|
||||
if (envEntry != null && !envEntry.endsWith("="))
|
||||
{
|
||||
// it's perfectly legal that some entries may be in the form
|
||||
// key=value=value=value
|
||||
int equalSignIndex = envEntry.indexOf('=');
|
||||
String key = envEntry.substring(0, equalSignIndex);
|
||||
String value = envEntry.substring(equalSignIndex + 1);
|
||||
variables.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
environmentMap = Collections.unmodifiableMap(variables);
|
||||
}
|
||||
|
||||
return environmentMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ThreadLocal<T>
|
|||
* user. Do not expose this to the public. Package visible for use by
|
||||
* InheritableThreadLocal
|
||||
*/
|
||||
static final Object notFound = new Object();
|
||||
static final Object sentinel = new Object();
|
||||
|
||||
/**
|
||||
* The base for the computation of the next hash for a thread local.
|
||||
|
@ -100,7 +100,8 @@ public class ThreadLocal<T>
|
|||
/**
|
||||
* Allocate a new hash.
|
||||
*/
|
||||
private synchronized int computeNextHash() {
|
||||
private synchronized int computeNextHash()
|
||||
{
|
||||
return nextHashBase++ * 6709;
|
||||
}
|
||||
|
||||
|
@ -144,7 +145,7 @@ public class ThreadLocal<T>
|
|||
// Note that we don't have to synchronize, as only this thread will
|
||||
// ever modify the map.
|
||||
T value = (T) map.get(this);
|
||||
if (value == notFound)
|
||||
if (value == sentinel)
|
||||
{
|
||||
value = initialValue();
|
||||
map.set(this, value);
|
||||
|
|
|
@ -56,7 +56,8 @@ public abstract class Buffer
|
|||
*
|
||||
* Should be package private.
|
||||
*/
|
||||
Buffer (int capacity, int limit, int position, int mark, Pointer address)
|
||||
Buffer (int capacity, int limit, int position, int mark,
|
||||
Pointer address)
|
||||
{
|
||||
this.address = address;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* DirectByteBufferImpl.java --
|
||||
/* DirectByteBufferImpl.java --
|
||||
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
@ -60,8 +60,8 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
static final class ReadOnly extends DirectByteBufferImpl
|
||||
{
|
||||
ReadOnly(Object owner, Pointer address,
|
||||
int capacity, int limit,
|
||||
int position)
|
||||
int capacity, int limit,
|
||||
int position)
|
||||
{
|
||||
super(owner, address, capacity, limit, position);
|
||||
}
|
||||
|
@ -89,9 +89,14 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
super(capacity);
|
||||
}
|
||||
|
||||
ReadWrite(Pointer address, int capacity)
|
||||
{
|
||||
super(address, capacity);
|
||||
}
|
||||
|
||||
ReadWrite(Object owner, Pointer address,
|
||||
int capacity, int limit,
|
||||
int position)
|
||||
int capacity, int limit,
|
||||
int position)
|
||||
{
|
||||
super(owner, address, capacity, limit, position);
|
||||
}
|
||||
|
@ -104,13 +109,20 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
|
||||
DirectByteBufferImpl(int capacity)
|
||||
{
|
||||
super(capacity, capacity, 0, -1, VMDirectByteBuffer.allocate(capacity), null, 0);
|
||||
super(capacity, capacity, 0, -1,
|
||||
VMDirectByteBuffer.allocate(capacity), null, 0);
|
||||
this.owner = this;
|
||||
}
|
||||
|
||||
DirectByteBufferImpl(Pointer address, int capacity)
|
||||
{
|
||||
super(capacity, capacity, 0, -1, address, null, 0);
|
||||
this.owner = null;
|
||||
}
|
||||
|
||||
DirectByteBufferImpl(Object owner, Pointer address,
|
||||
int capacity, int limit,
|
||||
int position)
|
||||
int capacity, int limit,
|
||||
int position)
|
||||
{
|
||||
super(capacity, limit, position, -1, address, null, 0);
|
||||
this.owner = owner;
|
||||
|
@ -118,7 +130,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
|
||||
/**
|
||||
* Allocates a new direct byte buffer.
|
||||
*/
|
||||
*/
|
||||
public static ByteBuffer allocate(int capacity)
|
||||
{
|
||||
return new DirectByteBufferImpl.ReadWrite(capacity);
|
||||
|
@ -129,7 +141,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
if (owner == this)
|
||||
VMDirectByteBuffer.free(address);
|
||||
}
|
||||
|
||||
|
||||
public byte get()
|
||||
{
|
||||
checkForUnderflow();
|
||||
|
@ -168,7 +180,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
position(pos + 1);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer put(int index, byte value)
|
||||
{
|
||||
checkIndex(index);
|
||||
|
@ -176,24 +188,23 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
VMDirectByteBuffer.put(address, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer put (byte[] src, int offset, int length)
|
||||
{
|
||||
checkArraySize (src.length, offset, length);
|
||||
checkForUnderflow (length);
|
||||
|
||||
int index = position ();
|
||||
VMDirectByteBuffer.put (address, index, src, offset, length);
|
||||
position (index + length);
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
void shiftDown(int dst_offset, int src_offset, int count)
|
||||
{
|
||||
VMDirectByteBuffer.shiftDown(address, dst_offset, src_offset, count);
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer compact()
|
||||
{
|
||||
checkIfReadOnly();
|
||||
|
@ -201,15 +212,15 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
int pos = position();
|
||||
if (pos > 0)
|
||||
{
|
||||
int count = remaining();
|
||||
VMDirectByteBuffer.shiftDown(address, 0, pos, count);
|
||||
position(count);
|
||||
limit(capacity());
|
||||
int count = remaining();
|
||||
VMDirectByteBuffer.shiftDown(address, 0, pos, count);
|
||||
position(count);
|
||||
limit(capacity());
|
||||
}
|
||||
else
|
||||
{
|
||||
position(limit());
|
||||
limit(capacity());
|
||||
position(limit());
|
||||
limit(capacity());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -244,9 +255,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
|
||||
if (mark != pos)
|
||||
{
|
||||
result.position(mark);
|
||||
result.mark();
|
||||
result.position(pos);
|
||||
result.position(mark);
|
||||
result.mark();
|
||||
result.position(pos);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -300,18 +311,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
{
|
||||
return ByteBufferHelper.getChar(this, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putChar(char value)
|
||||
{
|
||||
ByteBufferHelper.putChar(this, value, order());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public char getChar(int index)
|
||||
{
|
||||
return ByteBufferHelper.getChar(this, index, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putChar(int index, char value)
|
||||
{
|
||||
ByteBufferHelper.putChar(this, index, value, order());
|
||||
|
@ -322,18 +333,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
{
|
||||
return ByteBufferHelper.getShort(this, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putShort(short value)
|
||||
{
|
||||
ByteBufferHelper.putShort(this, value, order());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public short getShort(int index)
|
||||
{
|
||||
return ByteBufferHelper.getShort(this, index, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putShort(int index, short value)
|
||||
{
|
||||
ByteBufferHelper.putShort(this, index, value, order());
|
||||
|
@ -344,18 +355,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
{
|
||||
return ByteBufferHelper.getInt(this, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putInt(int value)
|
||||
{
|
||||
ByteBufferHelper.putInt(this, value, order());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public int getInt(int index)
|
||||
{
|
||||
return ByteBufferHelper.getInt(this, index, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putInt(int index, int value)
|
||||
{
|
||||
ByteBufferHelper.putInt(this, index, value, order());
|
||||
|
@ -366,18 +377,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
{
|
||||
return ByteBufferHelper.getLong(this, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putLong(long value)
|
||||
{
|
||||
ByteBufferHelper.putLong(this, value, order());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public long getLong(int index)
|
||||
{
|
||||
return ByteBufferHelper.getLong(this, index, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putLong(int index, long value)
|
||||
{
|
||||
ByteBufferHelper.putLong(this, index, value, order());
|
||||
|
@ -388,13 +399,13 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
{
|
||||
return ByteBufferHelper.getFloat(this, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putFloat(float value)
|
||||
{
|
||||
ByteBufferHelper.putFloat(this, value, order());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public float getFloat(int index)
|
||||
{
|
||||
return ByteBufferHelper.getFloat(this, index, order());
|
||||
|
@ -416,12 +427,12 @@ abstract class DirectByteBufferImpl extends ByteBuffer
|
|||
ByteBufferHelper.putDouble(this, value, order());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public double getDouble(int index)
|
||||
{
|
||||
return ByteBufferHelper.getDouble(this, index, order());
|
||||
}
|
||||
|
||||
|
||||
public ByteBuffer putDouble(int index, double value)
|
||||
{
|
||||
ByteBufferHelper.putDouble(this, index, value, order());
|
||||
|
|
|
@ -50,8 +50,8 @@ public abstract class IntBuffer extends Buffer
|
|||
final int array_offset;
|
||||
final int[] backing_buffer;
|
||||
|
||||
IntBuffer (int capacity, int limit, int position, int mark, RawData address,
|
||||
int[] backing_buffer, int array_offset)
|
||||
IntBuffer (int capacity, int limit, int position, int mark,
|
||||
RawData address, int[] backing_buffer, int array_offset)
|
||||
{
|
||||
super (capacity, limit, position, mark, address);
|
||||
this.backing_buffer = backing_buffer;
|
||||
|
|
|
@ -49,7 +49,8 @@ final class ShortViewBufferImpl extends ShortBuffer
|
|||
ShortViewBufferImpl (ByteBuffer bb, int capacity)
|
||||
{
|
||||
super (capacity, capacity, 0, -1, bb.isDirect() ?
|
||||
VMDirectByteBuffer.adjustAddress(bb.address, bb.position()):null, null, 0);
|
||||
VMDirectByteBuffer.adjustAddress(bb.address, bb.position()):null,
|
||||
null, 0);
|
||||
this.bb = bb;
|
||||
this.offset = bb.position();
|
||||
this.readOnly = bb.isReadOnly();
|
||||
|
@ -61,7 +62,8 @@ final class ShortViewBufferImpl extends ShortBuffer
|
|||
boolean readOnly, ByteOrder endian)
|
||||
{
|
||||
super (capacity, limit, position, mark, bb.isDirect() ?
|
||||
VMDirectByteBuffer.adjustAddress(bb.address, offset):null, null, 0);
|
||||
VMDirectByteBuffer.adjustAddress(bb.address, offset):null,
|
||||
null, 0);
|
||||
this.bb = bb;
|
||||
this.offset = offset;
|
||||
this.readOnly = readOnly;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue