src/java.base/share/classes/java/nio/Bits.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
jdk Cdiff src/java.base/share/classes/java/nio/Bits.java
src/java.base/share/classes/java/nio/Bits.java
Print this page
rev 13675 : imported patch unsafecopyswap
rev 13676 : [mq]: unsafecopyswap2
*** 1,7 ****
/*
! * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 805,837 ****
srcAddr += size;
offset += size;
}
}
! static void copyFromCharArray(Object src, long srcPos, long dstAddr,
! long length)
! {
! copyFromShortArray(src, srcPos, dstAddr, length);
}
! static void copyToCharArray(long srcAddr, Object dst, long dstPos,
! long length)
! {
! copyToShortArray(srcAddr, dst, dstPos, length);
}
! static native void copyFromShortArray(Object src, long srcPos, long dstAddr,
! long length);
! static native void copyToShortArray(long srcAddr, Object dst, long dstPos,
! long length);
!
! static native void copyFromIntArray(Object src, long srcPos, long dstAddr,
! long length);
! static native void copyToIntArray(long srcAddr, Object dst, long dstPos,
! long length);
!
! static native void copyFromLongArray(Object src, long srcPos, long dstAddr,
! long length);
! static native void copyToLongArray(long srcAddr, Object dst, long dstPos,
! long length);
}
--- 805,937 ----
srcAddr += size;
offset += size;
}
}
! /**
! * Copy and unconditionally byte swap 16 bit elements from a heap array to off-heap memory
! *
! * @param src
! * the source array, must be a 16-bit primitive array type
! * @param srcPos
! * byte offset within source array of the first element to read
! * @param dstAddr
! * destination address
! * @param length
! * number of bytes to copy
! */
! static void copyFromCharArray(Object src, long srcPos, long dstAddr, long length) {
! unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 2);
}
! /**
! * Copy and unconditionally byte swap 16 bit elements from off-heap memory to a heap array
! *
! * @param srcAddr
! * source address
! * @param dst
! * destination array, must be a 16-bit primitive array type
! * @param dstPos
! * byte offset within the destination array of the first element to write
! * @param length
! * number of bytes to copy
! */
! static void copyToCharArray(long srcAddr, Object dst, long dstPos, long length) {
! unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 2);
! }
!
! /**
! * Copy and unconditionally byte swap 16 bit elements from a heap array to off-heap memory
! *
! * @param src
! * the source array, must be a 16-bit primitive array type
! * @param srcPos
! * byte offset within source array of the first element to read
! * @param dstAddr
! * destination address
! * @param length
! * number of bytes to copy
! */
! static void copyFromShortArray(Object src, long srcPos, long dstAddr, long length) {
! unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 2);
! }
!
! /**
! * Copy and unconditionally byte swap 16 bit elements from off-heap memory to a heap array
! *
! * @param srcAddr
! * source address
! * @param dst
! * destination array, must be a 16-bit primitive array type
! * @param dstPos
! * byte offset within the destination array of the first element to write
! * @param length
! * number of bytes to copy
! */
! static void copyToShortArray(long srcAddr, Object dst, long dstPos, long length) {
! unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 2);
! }
!
! /**
! * Copy and unconditionally byte swap 32 bit elements from a heap array to off-heap memory
! *
! * @param src
! * the source array, must be a 32-bit primitive array type
! * @param srcPos
! * byte offset within source array of the first element to read
! * @param dstAddr
! * destination address
! * @param length
! * number of bytes to copy
! */
! static void copyFromIntArray(Object src, long srcPos, long dstAddr, long length) {
! unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 4);
}
! /**
! * Copy and unconditionally byte swap 32 bit elements from off-heap memory to a heap array
! *
! * @param srcAddr
! * source address
! * @param dst
! * destination array, must be a 32-bit primitive array type
! * @param dstPos
! * byte offset within the destination array of the first element to write
! * @param length
! * number of bytes to copy
! */
! static void copyToIntArray(long srcAddr, Object dst, long dstPos, long length) {
! unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 4);
! }
+ /**
+ * Copy and unconditionally byte swap 64 bit elements from a heap array to off-heap memory
+ *
+ * @param src
+ * the source array, must be a 64-bit primitive array type
+ * @param srcPos
+ * byte offset within source array of the first element to read
+ * @param dstAddr
+ * destination address
+ * @param length
+ * number of bytes to copy
+ */
+ static void copyFromLongArray(Object src, long srcPos, long dstAddr, long length) {
+ unsafe.copySwapMemory(src, unsafe.arrayBaseOffset(src.getClass()) + srcPos, null, dstAddr, length, 8);
+ }
+
+ /**
+ * Copy and unconditionally byte swap 64 bit elements from off-heap memory to a heap array
+ *
+ * @param srcAddr
+ * source address
+ * @param dst
+ * destination array, must be a 64-bit primitive array type
+ * @param dstPos
+ * byte offset within the destination array of the first element to write
+ * @param length
+ * number of bytes to copy
+ */
+ static void copyToLongArray(long srcAddr, Object dst, long dstPos, long length) {
+ unsafe.copySwapMemory(null, srcAddr, dst, unsafe.arrayBaseOffset(dst.getClass()) + dstPos, length, 8);
+ }
}
src/java.base/share/classes/java/nio/Bits.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File