changeset 651:73742c080270

OPENJDK6-4: Backport the new version of copyMemory from OpenJDK 7 to allow Snappy to build Reviewed-by: aph
author andrew
date Fri, 31 May 2013 12:55:04 +0100
parents 0d99d61882b7
children daaf47db9e49
files src/share/classes/sun/misc/Unsafe.java
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/misc/Unsafe.java	Thu Mar 14 10:52:47 2013 -0400
+++ b/src/share/classes/sun/misc/Unsafe.java	Fri May 31 12:55:04 2013 +0100
@@ -504,9 +504,31 @@
     /**
      * Sets all bytes in a given block of memory to a copy of another
      * block.
+     *
+     * <p>This method determines each block's base address by means of two parameters,
+     * and so it provides (in effect) a <em>double-register</em> addressing mode,
+     * as discussed in {@link #getInt(Object,long)}.  When the object reference is null,
+     * the offset supplies an absolute base address.
+     *
+     * <p>The transfers are in coherent (atomic) units of a size determined
+     * by the address and length parameters.  If the effective addresses and
+     * length are all even modulo 8, the transfer takes place in 'long' units.
+     * If the effective addresses and length are (resp.) even modulo 4 or 2,
+     * the transfer takes place in units of 'int' or 'short'.
      */
-    public native void copyMemory(long srcAddress, long destAddress,
+    public native void copyMemory(Object srcBase, long srcOffset,
+                                  Object destBase, long destOffset,
                                   long bytes);
+    /**
+     * Sets all bytes in a given block of memory to a copy of another
+     * block.  This provides a <em>single-register</em> addressing mode,
+     * as discussed in {@link #getInt(Object,long)}.
+     *
+     * Equivalent to <code>copyMemory(null, srcAddress, null, destAddress, bytes)</code>.
+     */
+    public void copyMemory(long srcAddress, long destAddress, long bytes) {
+        copyMemory(null, srcAddress, null, destAddress, bytes);
+    }
 
     /**
      * Disposes of a block of native memory, as obtained from {@link