jdk6 missed method sun.misc.Unsafe#copyMemory(Object, long, Object, long, long)

Alex Kasko alex.kasko.lists at gmail.com
Tue Jan 15 02:21:40 PST 2013


Hello,

Method sun.misc.Unsafe#copyMemory(Object,long,Object,long,long) is used 
in popular Snappy codec implementation [1, 2].

It's present in openjdk-7 and in late updates of Oracle jdk6. But it's 
missed in openjdk-6. Its native implementation is available in jdk6 
hostspot [3], though. As far as I understood, it was removed from jdk6 
codebase during preparation to first jdk6 release [4]. I tried to 
restore it in jdk6 sources (left hotspot untouched) and it seems to work 
well.

Can someone clarify, whether it's safe to patch sun.misc.Unsafe and use 
this method in jdk6?


[1] https://github.com/dain/snappy#snappy-in-java
[2] 
https://github.com/dain/snappy/blob/01f0a37ca40196e08336532ea6d328eb3ed22b67/src/main/java/org/iq80/snappy/UnsafeMemory.java#L101
[3] 
http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/cd74fab0a5e3/src/share/vm/prims/unsafe.cpp
[4] 
http://hg.openjdk.java.net/jdk6/jdk6/jdk/diff/39e8fe7a0af1/src/share/classes/sun/misc/Unsafe.java

-- 
Regards,
Alex Kasko


More information about the jdk6-dev mailing list