Created
March 13, 2013 21:03
-
-
Save alexkasko/5156174 to your computer and use it in GitHub Desktop.
Patch to OpenJDK6 sun.misc.Unsafe class that restores additional copyMemory method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/jdk/src/share/classes/sun/misc/Unsafe.java b/jdk/src/share/classes/sun/misc/Unsafe.java | |
index 345f654..5b6b54a 100644 | |
--- a/jdk/src/share/classes/sun/misc/Unsafe.java | |
+++ b/jdk/src/share/classes/sun/misc/Unsafe.java | |
@@ -502,11 +502,41 @@ public final class Unsafe { | |
public native void setMemory(long address, long bytes, byte value); | |
/** | |
+ * alexkasko: reverting changes to match jdk7 signature | |
+ * http://hg.openjdk.java.net/jdk6/jdk6/jdk/diff/39e8fe7a0af1/src/share/classes/sun/misc/Unsafe.java | |
+ * | |
* 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'. | |
+ * | |
+ * @since 1.7 | |
*/ | |
- public native void copyMemory(long srcAddress, long destAddress, | |
+ public native void copyMemory(Object srcBase, long srcOffset, | |
+ Object destBase, long destOffset, | |
long bytes); | |
+ /** | |
+ * alexkasko: reverting changes to match jdk7 signature | |
+ * http://hg.openjdk.java.net/jdk6/jdk6/jdk/diff/39e8fe7a0af1/src/share/classes/sun/misc/Unsafe.java | |
+ * | |
+ * 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment