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

Alex Kasko alex.kasko.lists at gmail.com
Thu Jan 17 06:58:11 PST 2013


On 01/17/2013 05:30 PM, Andrew Hughes wrote:
>
>
> ----- Original Message -----
>> 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
>>
>
> It will be in HotSpot because the same HotSpot releases are shared between
> 6&  7 (well, they were until 6 stopped at hs20).  Support for features in 8
> will likewise appear in 7's HotSpot.
>
> I can't see any reason why it couldn't be backported, but presumably there
> was some reason it was removed.
Thanks for the clarification!

I'm afraid it's too late to propose any changes to jdk6, so I'll 
continue using patched version.

-- 
Regards,
Alex Kasko


More information about the jdk6-dev mailing list