RFR 8068975: Remove deprecated methods on sun.misc.Unsafe and clean up native implementation

Paul Sandoz paul.sandoz at oracle.com
Thu Jan 15 16:55:39 UTC 2015



This "forest" webrev cleans up sun.misc.Unsafe.java and hotspot/src/share/vm/prims/unsafe.cpp.

In sun.misc.Unsafe all deprecated methods are removed.

In unsafe.cpp one array of native method declarations is used and unused methods are removed. There is one remaining TODO:

 136 // Externally callable versions:
 137 // (Use these in compiler intrinsics which emulate unsafe primitives.)
 138 jlong Unsafe_field_offset_to_byte_offset(jlong field_offset) {
 139   return field_offset;
 140 }
 141 // TODO The following three methods are not used, can they be removed?
 142 jlong Unsafe_field_offset_from_byte_offset(jlong byte_offset) {
 143   return byte_offset;
 144 }
 145 jint Unsafe_invocation_key_from_method_slot(jint slot) {
 146   return invocation_key_from_method_slot(slot);
 147 }
 148 jint Unsafe_invocation_key_to_method_slot(jint key) {
 149   return invocation_key_to_method_slot(key);
 150 }

I don't quite know what the above methods are for, but only the first is used, and it's a no-op. Can anyone provider more context for these?

Testing wise, so far, i have only identified one failure for an internal JDK test that relies on one of the deprecated methods (looked up via reflection), which i will update independently to this review.


More information about the hotspot-runtime-dev mailing list