mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8199424: consider removing ObjectInputStream and ObjectOutputStream native methods
Reviewed-by: bpb, rriggs, redestad
This commit is contained in:
parent
b770e9a6b4
commit
f3208bfcd0
4 changed files with 26 additions and 408 deletions
|
@ -1591,22 +1591,6 @@ public class ObjectOutputStream
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts specified span of float values into byte values.
|
||||
*/
|
||||
// REMIND: remove once hotspot inlines Float.floatToIntBits
|
||||
private static native void floatsToBytes(float[] src, int srcpos,
|
||||
byte[] dst, int dstpos,
|
||||
int nfloats);
|
||||
|
||||
/**
|
||||
* Converts specified span of double values into byte values.
|
||||
*/
|
||||
// REMIND: remove once hotspot inlines Double.doubleToLongBits
|
||||
private static native void doublesToBytes(double[] src, int srcpos,
|
||||
byte[] dst, int dstpos,
|
||||
int ndoubles);
|
||||
|
||||
/**
|
||||
* Default PutField implementation.
|
||||
*/
|
||||
|
@ -2096,10 +2080,11 @@ public class ObjectOutputStream
|
|||
while (off < endoff) {
|
||||
if (pos <= limit) {
|
||||
int avail = (MAX_BLOCK_SIZE - pos) >> 2;
|
||||
int chunklen = Math.min(endoff - off, avail);
|
||||
floatsToBytes(v, off, buf, pos, chunklen);
|
||||
off += chunklen;
|
||||
pos += chunklen << 2;
|
||||
int stop = Math.min(endoff, off + avail);
|
||||
while (off < stop) {
|
||||
Bits.putFloat(buf, pos, v[off++]);
|
||||
pos += 4;
|
||||
}
|
||||
} else {
|
||||
dout.writeFloat(v[off++]);
|
||||
}
|
||||
|
@ -2129,10 +2114,11 @@ public class ObjectOutputStream
|
|||
while (off < endoff) {
|
||||
if (pos <= limit) {
|
||||
int avail = (MAX_BLOCK_SIZE - pos) >> 3;
|
||||
int chunklen = Math.min(endoff - off, avail);
|
||||
doublesToBytes(v, off, buf, pos, chunklen);
|
||||
off += chunklen;
|
||||
pos += chunklen << 3;
|
||||
int stop = Math.min(endoff, off + avail);
|
||||
while (off < stop) {
|
||||
Bits.putDouble(buf, pos, v[off++]);
|
||||
pos += 8;
|
||||
}
|
||||
} else {
|
||||
dout.writeDouble(v[off++]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue