mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8256018: Adler32/CRC32/CRC32C missing reachabilityFence
Reviewed-by: naoto, alanb
This commit is contained in:
parent
436019b8bb
commit
6247736fc9
3 changed files with 22 additions and 7 deletions
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package java.util.zip;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
|
@ -170,9 +171,13 @@ public final class CRC32C implements Checksum {
|
|||
return;
|
||||
}
|
||||
|
||||
if (buffer instanceof DirectBuffer) {
|
||||
crc = updateDirectByteBuffer(crc, ((DirectBuffer) buffer).address(),
|
||||
pos, limit);
|
||||
if (buffer.isDirect()) {
|
||||
try {
|
||||
crc = updateDirectByteBuffer(crc, ((DirectBuffer) buffer).address(),
|
||||
pos, limit);
|
||||
} finally {
|
||||
Reference.reachabilityFence(buffer);
|
||||
}
|
||||
} else if (buffer.hasArray()) {
|
||||
crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(),
|
||||
limit + buffer.arrayOffset());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue