mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8139891: Prepare Unsafe for true encapsulation
Reviewed-by: alanb, dholmes, jrose, psandoz, twisti
This commit is contained in:
parent
4aad17f807
commit
ca4787d77b
13 changed files with 218 additions and 140 deletions
|
@ -168,7 +168,7 @@ class Ticks;
|
||||||
\
|
\
|
||||||
do_klass(StringBuffer_klass, java_lang_StringBuffer, Pre ) \
|
do_klass(StringBuffer_klass, java_lang_StringBuffer, Pre ) \
|
||||||
do_klass(StringBuilder_klass, java_lang_StringBuilder, Pre ) \
|
do_klass(StringBuilder_klass, java_lang_StringBuilder, Pre ) \
|
||||||
do_klass(misc_Unsafe_klass, sun_misc_Unsafe, Pre ) \
|
do_klass(internal_Unsafe_klass, jdk_internal_misc_Unsafe, Pre ) \
|
||||||
\
|
\
|
||||||
/* support for CDS */ \
|
/* support for CDS */ \
|
||||||
do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream, Pre ) \
|
do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream, Pre ) \
|
||||||
|
|
|
@ -938,24 +938,25 @@
|
||||||
do_intrinsic(_updateByteBufferAdler32, java_util_zip_Adler32, updateByteBuffer_A_name, updateByteBuffer_signature, F_SN) \
|
do_intrinsic(_updateByteBufferAdler32, java_util_zip_Adler32, updateByteBuffer_A_name, updateByteBuffer_signature, F_SN) \
|
||||||
do_name( updateByteBuffer_A_name, "updateByteBuffer") \
|
do_name( updateByteBuffer_A_name, "updateByteBuffer") \
|
||||||
\
|
\
|
||||||
/* support for sun.misc.Unsafe */ \
|
/* support for Unsafe */ \
|
||||||
do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \
|
do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \
|
||||||
|
do_class(jdk_internal_misc_Unsafe, "jdk/internal/misc/Unsafe") \
|
||||||
\
|
\
|
||||||
do_intrinsic(_allocateInstance, sun_misc_Unsafe, allocateInstance_name, allocateInstance_signature, F_RN) \
|
do_intrinsic(_allocateInstance, jdk_internal_misc_Unsafe, allocateInstance_name, allocateInstance_signature, F_RN) \
|
||||||
do_name( allocateInstance_name, "allocateInstance") \
|
do_name( allocateInstance_name, "allocateInstance") \
|
||||||
do_signature(allocateInstance_signature, "(Ljava/lang/Class;)Ljava/lang/Object;") \
|
do_signature(allocateInstance_signature, "(Ljava/lang/Class;)Ljava/lang/Object;") \
|
||||||
do_intrinsic(_copyMemory, sun_misc_Unsafe, copyMemory_name, copyMemory_signature, F_RN) \
|
do_intrinsic(_copyMemory, jdk_internal_misc_Unsafe, copyMemory_name, copyMemory_signature, F_RN) \
|
||||||
do_name( copyMemory_name, "copyMemory") \
|
do_name( copyMemory_name, "copyMemory") \
|
||||||
do_signature(copyMemory_signature, "(Ljava/lang/Object;JLjava/lang/Object;JJ)V") \
|
do_signature(copyMemory_signature, "(Ljava/lang/Object;JLjava/lang/Object;JJ)V") \
|
||||||
do_intrinsic(_loadFence, sun_misc_Unsafe, loadFence_name, loadFence_signature, F_RN) \
|
do_intrinsic(_loadFence, jdk_internal_misc_Unsafe, loadFence_name, loadFence_signature, F_RN) \
|
||||||
do_name( loadFence_name, "loadFence") \
|
do_name( loadFence_name, "loadFence") \
|
||||||
do_alias( loadFence_signature, void_method_signature) \
|
do_alias( loadFence_signature, void_method_signature) \
|
||||||
do_intrinsic(_storeFence, sun_misc_Unsafe, storeFence_name, storeFence_signature, F_RN) \
|
do_intrinsic(_storeFence, jdk_internal_misc_Unsafe, storeFence_name, storeFence_signature, F_RN) \
|
||||||
do_name( storeFence_name, "storeFence") \
|
do_name( storeFence_name, "storeFence") \
|
||||||
do_alias( storeFence_signature, void_method_signature) \
|
do_alias( storeFence_signature, void_method_signature) \
|
||||||
do_intrinsic(_fullFence, sun_misc_Unsafe, fullFence_name, fullFence_signature, F_RN) \
|
do_intrinsic(_fullFence, jdk_internal_misc_Unsafe, fullFence_name, fullFence_signature, F_RN) \
|
||||||
do_name( fullFence_name, "fullFence") \
|
do_name( fullFence_name, "fullFence") \
|
||||||
do_alias( fullFence_signature, void_method_signature) \
|
do_alias( fullFence_signature, void_method_signature) \
|
||||||
\
|
\
|
||||||
/* Custom branch frequencies profiling support for JSR292 */ \
|
/* Custom branch frequencies profiling support for JSR292 */ \
|
||||||
do_class(java_lang_invoke_MethodHandleImpl, "java/lang/invoke/MethodHandleImpl") \
|
do_class(java_lang_invoke_MethodHandleImpl, "java/lang/invoke/MethodHandleImpl") \
|
||||||
|
@ -996,24 +997,24 @@
|
||||||
do_name(getFloat_name,"getFloat") do_name(putFloat_name,"putFloat") \
|
do_name(getFloat_name,"getFloat") do_name(putFloat_name,"putFloat") \
|
||||||
do_name(getDouble_name,"getDouble") do_name(putDouble_name,"putDouble") \
|
do_name(getDouble_name,"getDouble") do_name(putDouble_name,"putDouble") \
|
||||||
\
|
\
|
||||||
do_intrinsic(_getObject, sun_misc_Unsafe, getObject_name, getObject_signature, F_RN) \
|
do_intrinsic(_getObject, jdk_internal_misc_Unsafe, getObject_name, getObject_signature, F_RN) \
|
||||||
do_intrinsic(_getBoolean, sun_misc_Unsafe, getBoolean_name, getBoolean_signature, F_RN) \
|
do_intrinsic(_getBoolean, jdk_internal_misc_Unsafe, getBoolean_name, getBoolean_signature, F_RN) \
|
||||||
do_intrinsic(_getByte, sun_misc_Unsafe, getByte_name, getByte_signature, F_RN) \
|
do_intrinsic(_getByte, jdk_internal_misc_Unsafe, getByte_name, getByte_signature, F_RN) \
|
||||||
do_intrinsic(_getShort, sun_misc_Unsafe, getShort_name, getShort_signature, F_RN) \
|
do_intrinsic(_getShort, jdk_internal_misc_Unsafe, getShort_name, getShort_signature, F_RN) \
|
||||||
do_intrinsic(_getChar, sun_misc_Unsafe, getChar_name, getChar_signature, F_RN) \
|
do_intrinsic(_getChar, jdk_internal_misc_Unsafe, getChar_name, getChar_signature, F_RN) \
|
||||||
do_intrinsic(_getInt, sun_misc_Unsafe, getInt_name, getInt_signature, F_RN) \
|
do_intrinsic(_getInt, jdk_internal_misc_Unsafe, getInt_name, getInt_signature, F_RN) \
|
||||||
do_intrinsic(_getLong, sun_misc_Unsafe, getLong_name, getLong_signature, F_RN) \
|
do_intrinsic(_getLong, jdk_internal_misc_Unsafe, getLong_name, getLong_signature, F_RN) \
|
||||||
do_intrinsic(_getFloat, sun_misc_Unsafe, getFloat_name, getFloat_signature, F_RN) \
|
do_intrinsic(_getFloat, jdk_internal_misc_Unsafe, getFloat_name, getFloat_signature, F_RN) \
|
||||||
do_intrinsic(_getDouble, sun_misc_Unsafe, getDouble_name, getDouble_signature, F_RN) \
|
do_intrinsic(_getDouble, jdk_internal_misc_Unsafe, getDouble_name, getDouble_signature, F_RN) \
|
||||||
do_intrinsic(_putObject, sun_misc_Unsafe, putObject_name, putObject_signature, F_RN) \
|
do_intrinsic(_putObject, jdk_internal_misc_Unsafe, putObject_name, putObject_signature, F_RN) \
|
||||||
do_intrinsic(_putBoolean, sun_misc_Unsafe, putBoolean_name, putBoolean_signature, F_RN) \
|
do_intrinsic(_putBoolean, jdk_internal_misc_Unsafe, putBoolean_name, putBoolean_signature, F_RN) \
|
||||||
do_intrinsic(_putByte, sun_misc_Unsafe, putByte_name, putByte_signature, F_RN) \
|
do_intrinsic(_putByte, jdk_internal_misc_Unsafe, putByte_name, putByte_signature, F_RN) \
|
||||||
do_intrinsic(_putShort, sun_misc_Unsafe, putShort_name, putShort_signature, F_RN) \
|
do_intrinsic(_putShort, jdk_internal_misc_Unsafe, putShort_name, putShort_signature, F_RN) \
|
||||||
do_intrinsic(_putChar, sun_misc_Unsafe, putChar_name, putChar_signature, F_RN) \
|
do_intrinsic(_putChar, jdk_internal_misc_Unsafe, putChar_name, putChar_signature, F_RN) \
|
||||||
do_intrinsic(_putInt, sun_misc_Unsafe, putInt_name, putInt_signature, F_RN) \
|
do_intrinsic(_putInt, jdk_internal_misc_Unsafe, putInt_name, putInt_signature, F_RN) \
|
||||||
do_intrinsic(_putLong, sun_misc_Unsafe, putLong_name, putLong_signature, F_RN) \
|
do_intrinsic(_putLong, jdk_internal_misc_Unsafe, putLong_name, putLong_signature, F_RN) \
|
||||||
do_intrinsic(_putFloat, sun_misc_Unsafe, putFloat_name, putFloat_signature, F_RN) \
|
do_intrinsic(_putFloat, jdk_internal_misc_Unsafe, putFloat_name, putFloat_signature, F_RN) \
|
||||||
do_intrinsic(_putDouble, sun_misc_Unsafe, putDouble_name, putDouble_signature, F_RN) \
|
do_intrinsic(_putDouble, jdk_internal_misc_Unsafe, putDouble_name, putDouble_signature, F_RN) \
|
||||||
\
|
\
|
||||||
do_name(getObjectVolatile_name,"getObjectVolatile") do_name(putObjectVolatile_name,"putObjectVolatile") \
|
do_name(getObjectVolatile_name,"getObjectVolatile") do_name(putObjectVolatile_name,"putObjectVolatile") \
|
||||||
do_name(getBooleanVolatile_name,"getBooleanVolatile") do_name(putBooleanVolatile_name,"putBooleanVolatile") \
|
do_name(getBooleanVolatile_name,"getBooleanVolatile") do_name(putBooleanVolatile_name,"putBooleanVolatile") \
|
||||||
|
@ -1025,38 +1026,38 @@
|
||||||
do_name(getFloatVolatile_name,"getFloatVolatile") do_name(putFloatVolatile_name,"putFloatVolatile") \
|
do_name(getFloatVolatile_name,"getFloatVolatile") do_name(putFloatVolatile_name,"putFloatVolatile") \
|
||||||
do_name(getDoubleVolatile_name,"getDoubleVolatile") do_name(putDoubleVolatile_name,"putDoubleVolatile") \
|
do_name(getDoubleVolatile_name,"getDoubleVolatile") do_name(putDoubleVolatile_name,"putDoubleVolatile") \
|
||||||
\
|
\
|
||||||
do_intrinsic(_getObjectVolatile, sun_misc_Unsafe, getObjectVolatile_name, getObject_signature, F_RN) \
|
do_intrinsic(_getObjectVolatile, jdk_internal_misc_Unsafe, getObjectVolatile_name, getObject_signature, F_RN) \
|
||||||
do_intrinsic(_getBooleanVolatile, sun_misc_Unsafe, getBooleanVolatile_name, getBoolean_signature, F_RN) \
|
do_intrinsic(_getBooleanVolatile, jdk_internal_misc_Unsafe, getBooleanVolatile_name, getBoolean_signature, F_RN) \
|
||||||
do_intrinsic(_getByteVolatile, sun_misc_Unsafe, getByteVolatile_name, getByte_signature, F_RN) \
|
do_intrinsic(_getByteVolatile, jdk_internal_misc_Unsafe, getByteVolatile_name, getByte_signature, F_RN) \
|
||||||
do_intrinsic(_getShortVolatile, sun_misc_Unsafe, getShortVolatile_name, getShort_signature, F_RN) \
|
do_intrinsic(_getShortVolatile, jdk_internal_misc_Unsafe, getShortVolatile_name, getShort_signature, F_RN) \
|
||||||
do_intrinsic(_getCharVolatile, sun_misc_Unsafe, getCharVolatile_name, getChar_signature, F_RN) \
|
do_intrinsic(_getCharVolatile, jdk_internal_misc_Unsafe, getCharVolatile_name, getChar_signature, F_RN) \
|
||||||
do_intrinsic(_getIntVolatile, sun_misc_Unsafe, getIntVolatile_name, getInt_signature, F_RN) \
|
do_intrinsic(_getIntVolatile, jdk_internal_misc_Unsafe, getIntVolatile_name, getInt_signature, F_RN) \
|
||||||
do_intrinsic(_getLongVolatile, sun_misc_Unsafe, getLongVolatile_name, getLong_signature, F_RN) \
|
do_intrinsic(_getLongVolatile, jdk_internal_misc_Unsafe, getLongVolatile_name, getLong_signature, F_RN) \
|
||||||
do_intrinsic(_getFloatVolatile, sun_misc_Unsafe, getFloatVolatile_name, getFloat_signature, F_RN) \
|
do_intrinsic(_getFloatVolatile, jdk_internal_misc_Unsafe, getFloatVolatile_name, getFloat_signature, F_RN) \
|
||||||
do_intrinsic(_getDoubleVolatile, sun_misc_Unsafe, getDoubleVolatile_name, getDouble_signature, F_RN) \
|
do_intrinsic(_getDoubleVolatile, jdk_internal_misc_Unsafe, getDoubleVolatile_name, getDouble_signature, F_RN) \
|
||||||
do_intrinsic(_putObjectVolatile, sun_misc_Unsafe, putObjectVolatile_name, putObject_signature, F_RN) \
|
do_intrinsic(_putObjectVolatile, jdk_internal_misc_Unsafe, putObjectVolatile_name, putObject_signature, F_RN) \
|
||||||
do_intrinsic(_putBooleanVolatile, sun_misc_Unsafe, putBooleanVolatile_name, putBoolean_signature, F_RN) \
|
do_intrinsic(_putBooleanVolatile, jdk_internal_misc_Unsafe, putBooleanVolatile_name, putBoolean_signature, F_RN) \
|
||||||
do_intrinsic(_putByteVolatile, sun_misc_Unsafe, putByteVolatile_name, putByte_signature, F_RN) \
|
do_intrinsic(_putByteVolatile, jdk_internal_misc_Unsafe, putByteVolatile_name, putByte_signature, F_RN) \
|
||||||
do_intrinsic(_putShortVolatile, sun_misc_Unsafe, putShortVolatile_name, putShort_signature, F_RN) \
|
do_intrinsic(_putShortVolatile, jdk_internal_misc_Unsafe, putShortVolatile_name, putShort_signature, F_RN) \
|
||||||
do_intrinsic(_putCharVolatile, sun_misc_Unsafe, putCharVolatile_name, putChar_signature, F_RN) \
|
do_intrinsic(_putCharVolatile, jdk_internal_misc_Unsafe, putCharVolatile_name, putChar_signature, F_RN) \
|
||||||
do_intrinsic(_putIntVolatile, sun_misc_Unsafe, putIntVolatile_name, putInt_signature, F_RN) \
|
do_intrinsic(_putIntVolatile, jdk_internal_misc_Unsafe, putIntVolatile_name, putInt_signature, F_RN) \
|
||||||
do_intrinsic(_putLongVolatile, sun_misc_Unsafe, putLongVolatile_name, putLong_signature, F_RN) \
|
do_intrinsic(_putLongVolatile, jdk_internal_misc_Unsafe, putLongVolatile_name, putLong_signature, F_RN) \
|
||||||
do_intrinsic(_putFloatVolatile, sun_misc_Unsafe, putFloatVolatile_name, putFloat_signature, F_RN) \
|
do_intrinsic(_putFloatVolatile, jdk_internal_misc_Unsafe, putFloatVolatile_name, putFloat_signature, F_RN) \
|
||||||
do_intrinsic(_putDoubleVolatile, sun_misc_Unsafe, putDoubleVolatile_name, putDouble_signature, F_RN) \
|
do_intrinsic(_putDoubleVolatile, jdk_internal_misc_Unsafe, putDoubleVolatile_name, putDouble_signature, F_RN) \
|
||||||
\
|
\
|
||||||
do_name(getShortUnaligned_name,"getShortUnaligned") do_name(putShortUnaligned_name,"putShortUnaligned") \
|
do_name(getShortUnaligned_name,"getShortUnaligned") do_name(putShortUnaligned_name,"putShortUnaligned") \
|
||||||
do_name(getCharUnaligned_name,"getCharUnaligned") do_name(putCharUnaligned_name,"putCharUnaligned") \
|
do_name(getCharUnaligned_name,"getCharUnaligned") do_name(putCharUnaligned_name,"putCharUnaligned") \
|
||||||
do_name(getIntUnaligned_name,"getIntUnaligned") do_name(putIntUnaligned_name,"putIntUnaligned") \
|
do_name(getIntUnaligned_name,"getIntUnaligned") do_name(putIntUnaligned_name,"putIntUnaligned") \
|
||||||
do_name(getLongUnaligned_name,"getLongUnaligned") do_name(putLongUnaligned_name,"putLongUnaligned") \
|
do_name(getLongUnaligned_name,"getLongUnaligned") do_name(putLongUnaligned_name,"putLongUnaligned") \
|
||||||
\
|
\
|
||||||
do_intrinsic(_getShortUnaligned, sun_misc_Unsafe, getShortUnaligned_name, getShort_signature, F_R) \
|
do_intrinsic(_getShortUnaligned, jdk_internal_misc_Unsafe, getShortUnaligned_name, getShort_signature, F_R) \
|
||||||
do_intrinsic(_getCharUnaligned, sun_misc_Unsafe, getCharUnaligned_name, getChar_signature, F_R) \
|
do_intrinsic(_getCharUnaligned, jdk_internal_misc_Unsafe, getCharUnaligned_name, getChar_signature, F_R) \
|
||||||
do_intrinsic(_getIntUnaligned, sun_misc_Unsafe, getIntUnaligned_name, getInt_signature, F_R) \
|
do_intrinsic(_getIntUnaligned, jdk_internal_misc_Unsafe, getIntUnaligned_name, getInt_signature, F_R) \
|
||||||
do_intrinsic(_getLongUnaligned, sun_misc_Unsafe, getLongUnaligned_name, getLong_signature, F_R) \
|
do_intrinsic(_getLongUnaligned, jdk_internal_misc_Unsafe, getLongUnaligned_name, getLong_signature, F_R) \
|
||||||
do_intrinsic(_putShortUnaligned, sun_misc_Unsafe, putShortUnaligned_name, putShort_signature, F_R) \
|
do_intrinsic(_putShortUnaligned, jdk_internal_misc_Unsafe, putShortUnaligned_name, putShort_signature, F_R) \
|
||||||
do_intrinsic(_putCharUnaligned, sun_misc_Unsafe, putCharUnaligned_name, putChar_signature, F_R) \
|
do_intrinsic(_putCharUnaligned, jdk_internal_misc_Unsafe, putCharUnaligned_name, putChar_signature, F_R) \
|
||||||
do_intrinsic(_putIntUnaligned, sun_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \
|
do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \
|
||||||
do_intrinsic(_putLongUnaligned, sun_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \
|
do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \
|
||||||
\
|
\
|
||||||
/* %%% these are redundant except perhaps for getAddress, but Unsafe has native methods for them */ \
|
/* %%% these are redundant except perhaps for getAddress, but Unsafe has native methods for them */ \
|
||||||
do_signature(getByte_raw_signature, "(J)B") \
|
do_signature(getByte_raw_signature, "(J)B") \
|
||||||
|
@ -1078,66 +1079,67 @@
|
||||||
do_name( getAddress_name, "getAddress") \
|
do_name( getAddress_name, "getAddress") \
|
||||||
do_name( putAddress_name, "putAddress") \
|
do_name( putAddress_name, "putAddress") \
|
||||||
\
|
\
|
||||||
do_intrinsic(_getByte_raw, sun_misc_Unsafe, getByte_name, getByte_raw_signature, F_RN) \
|
do_intrinsic(_getByte_raw, jdk_internal_misc_Unsafe, getByte_name, getByte_raw_signature, F_R) \
|
||||||
do_intrinsic(_getShort_raw, sun_misc_Unsafe, getShort_name, getShort_raw_signature, F_RN) \
|
do_intrinsic(_getShort_raw, jdk_internal_misc_Unsafe, getShort_name, getShort_raw_signature, F_R) \
|
||||||
do_intrinsic(_getChar_raw, sun_misc_Unsafe, getChar_name, getChar_raw_signature, F_RN) \
|
do_intrinsic(_getChar_raw, jdk_internal_misc_Unsafe, getChar_name, getChar_raw_signature, F_R) \
|
||||||
do_intrinsic(_getInt_raw, sun_misc_Unsafe, getInt_name, long_int_signature, F_RN) \
|
do_intrinsic(_getInt_raw, jdk_internal_misc_Unsafe, getInt_name, long_int_signature, F_R) \
|
||||||
do_intrinsic(_getLong_raw, sun_misc_Unsafe, getLong_name, getLong_raw_signature, F_RN) \
|
do_intrinsic(_getLong_raw, jdk_internal_misc_Unsafe, getLong_name, getLong_raw_signature, F_R) \
|
||||||
do_intrinsic(_getFloat_raw, sun_misc_Unsafe, getFloat_name, getFloat_raw_signature, F_RN) \
|
do_intrinsic(_getFloat_raw, jdk_internal_misc_Unsafe, getFloat_name, getFloat_raw_signature, F_R) \
|
||||||
do_intrinsic(_getDouble_raw, sun_misc_Unsafe, getDouble_name, getDouble_raw_signature, F_RN) \
|
do_intrinsic(_getDouble_raw, jdk_internal_misc_Unsafe, getDouble_name, getDouble_raw_signature, F_R) \
|
||||||
do_intrinsic(_getAddress_raw, sun_misc_Unsafe, getAddress_name, getAddress_raw_signature, F_RN) \
|
do_intrinsic(_getAddress_raw, jdk_internal_misc_Unsafe, getAddress_name, getAddress_raw_signature, F_R) \
|
||||||
do_intrinsic(_putByte_raw, sun_misc_Unsafe, putByte_name, putByte_raw_signature, F_RN) \
|
do_intrinsic(_putByte_raw, jdk_internal_misc_Unsafe, putByte_name, putByte_raw_signature, F_R) \
|
||||||
do_intrinsic(_putShort_raw, sun_misc_Unsafe, putShort_name, putShort_raw_signature, F_RN) \
|
do_intrinsic(_putShort_raw, jdk_internal_misc_Unsafe, putShort_name, putShort_raw_signature, F_R) \
|
||||||
do_intrinsic(_putChar_raw, sun_misc_Unsafe, putChar_name, putChar_raw_signature, F_RN) \
|
do_intrinsic(_putChar_raw, jdk_internal_misc_Unsafe, putChar_name, putChar_raw_signature, F_R) \
|
||||||
do_intrinsic(_putInt_raw, sun_misc_Unsafe, putInt_name, putInt_raw_signature, F_RN) \
|
do_intrinsic(_putInt_raw, jdk_internal_misc_Unsafe, putInt_name, putInt_raw_signature, F_R) \
|
||||||
do_intrinsic(_putLong_raw, sun_misc_Unsafe, putLong_name, putLong_raw_signature, F_RN) \
|
do_intrinsic(_putLong_raw, jdk_internal_misc_Unsafe, putLong_name, putLong_raw_signature, F_R) \
|
||||||
do_intrinsic(_putFloat_raw, sun_misc_Unsafe, putFloat_name, putFloat_raw_signature, F_RN) \
|
do_intrinsic(_putFloat_raw, jdk_internal_misc_Unsafe, putFloat_name, putFloat_raw_signature, F_R) \
|
||||||
do_intrinsic(_putDouble_raw, sun_misc_Unsafe, putDouble_name, putDouble_raw_signature, F_RN) \
|
do_intrinsic(_putDouble_raw, jdk_internal_misc_Unsafe, putDouble_name, putDouble_raw_signature, F_R) \
|
||||||
do_intrinsic(_putAddress_raw, sun_misc_Unsafe, putAddress_name, putAddress_raw_signature, F_RN) \
|
do_intrinsic(_putAddress_raw, jdk_internal_misc_Unsafe, putAddress_name, putAddress_raw_signature, F_R) \
|
||||||
\
|
\
|
||||||
do_intrinsic(_compareAndSwapObject, sun_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \
|
do_intrinsic(_compareAndSwapObject, jdk_internal_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_R) \
|
||||||
do_name( compareAndSwapObject_name, "compareAndSwapObject") \
|
do_name( compareAndSwapObject_name, "compareAndSwapObject") \
|
||||||
do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
|
do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
|
||||||
do_intrinsic(_compareAndSwapLong, sun_misc_Unsafe, compareAndSwapLong_name, compareAndSwapLong_signature, F_RN) \
|
do_intrinsic(_compareAndSwapLong, jdk_internal_misc_Unsafe, compareAndSwapLong_name, compareAndSwapLong_signature, F_R) \
|
||||||
do_name( compareAndSwapLong_name, "compareAndSwapLong") \
|
do_name( compareAndSwapLong_name, "compareAndSwapLong") \
|
||||||
do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \
|
do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \
|
||||||
do_intrinsic(_compareAndSwapInt, sun_misc_Unsafe, compareAndSwapInt_name, compareAndSwapInt_signature, F_RN) \
|
do_intrinsic(_compareAndSwapInt, jdk_internal_misc_Unsafe, compareAndSwapInt_name, compareAndSwapInt_signature, F_R) \
|
||||||
do_name( compareAndSwapInt_name, "compareAndSwapInt") \
|
do_name( compareAndSwapInt_name, "compareAndSwapInt") \
|
||||||
do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \
|
do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \
|
||||||
do_intrinsic(_putOrderedObject, sun_misc_Unsafe, putOrderedObject_name, putOrderedObject_signature, F_RN) \
|
do_intrinsic(_putOrderedObject, jdk_internal_misc_Unsafe, putOrderedObject_name, putOrderedObject_signature, F_R) \
|
||||||
do_name( putOrderedObject_name, "putOrderedObject") \
|
do_name( putOrderedObject_name, "putOrderedObject") \
|
||||||
do_alias( putOrderedObject_signature, /*(LObject;JLObject;)V*/ putObject_signature) \
|
do_alias( putOrderedObject_signature, /*(LObject;JLObject;)V*/ putObject_signature) \
|
||||||
do_intrinsic(_putOrderedLong, sun_misc_Unsafe, putOrderedLong_name, putOrderedLong_signature, F_RN) \
|
do_intrinsic(_putOrderedLong, jdk_internal_misc_Unsafe, putOrderedLong_name, putOrderedLong_signature, F_R) \
|
||||||
do_name( putOrderedLong_name, "putOrderedLong") \
|
do_name( putOrderedLong_name, "putOrderedLong") \
|
||||||
do_alias( putOrderedLong_signature, /*(Ljava/lang/Object;JJ)V*/ putLong_signature) \
|
do_alias( putOrderedLong_signature, /*(Ljava/lang/Object;JJ)V*/ putLong_signature) \
|
||||||
do_intrinsic(_putOrderedInt, sun_misc_Unsafe, putOrderedInt_name, putOrderedInt_signature, F_RN) \
|
do_intrinsic(_putOrderedInt, jdk_internal_misc_Unsafe, putOrderedInt_name, putOrderedInt_signature, F_R) \
|
||||||
do_name( putOrderedInt_name, "putOrderedInt") \
|
do_name( putOrderedInt_name, "putOrderedInt") \
|
||||||
do_alias( putOrderedInt_signature, /*(Ljava/lang/Object;JI)V*/ putInt_signature) \
|
do_alias( putOrderedInt_signature, /*(Ljava/lang/Object;JI)V*/ putInt_signature) \
|
||||||
\
|
\
|
||||||
do_intrinsic(_getAndAddInt, sun_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \
|
do_intrinsic(_getAndAddInt, jdk_internal_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \
|
||||||
do_name( getAndAddInt_name, "getAndAddInt") \
|
do_name( getAndAddInt_name, "getAndAddInt") \
|
||||||
do_signature(getAndAddInt_signature, "(Ljava/lang/Object;JI)I" ) \
|
do_signature(getAndAddInt_signature, "(Ljava/lang/Object;JI)I" ) \
|
||||||
do_intrinsic(_getAndAddLong, sun_misc_Unsafe, getAndAddLong_name, getAndAddLong_signature, F_R) \
|
do_intrinsic(_getAndAddLong, jdk_internal_misc_Unsafe, getAndAddLong_name, getAndAddLong_signature, F_R) \
|
||||||
do_name( getAndAddLong_name, "getAndAddLong") \
|
do_name( getAndAddLong_name, "getAndAddLong") \
|
||||||
do_signature(getAndAddLong_signature, "(Ljava/lang/Object;JJ)J" ) \
|
do_signature(getAndAddLong_signature, "(Ljava/lang/Object;JJ)J" ) \
|
||||||
do_intrinsic(_getAndSetInt, sun_misc_Unsafe, getAndSetInt_name, getAndSetInt_signature, F_R) \
|
do_intrinsic(_getAndSetInt, jdk_internal_misc_Unsafe, getAndSetInt_name, getAndSetInt_signature, F_R) \
|
||||||
do_name( getAndSetInt_name, "getAndSetInt") \
|
do_name( getAndSetInt_name, "getAndSetInt") \
|
||||||
do_alias( getAndSetInt_signature, /*"(Ljava/lang/Object;JI)I"*/ getAndAddInt_signature) \
|
do_alias( getAndSetInt_signature, /*"(Ljava/lang/Object;JI)I"*/ getAndAddInt_signature) \
|
||||||
do_intrinsic(_getAndSetLong, sun_misc_Unsafe, getAndSetLong_name, getAndSetLong_signature, F_R) \
|
do_intrinsic(_getAndSetLong, jdk_internal_misc_Unsafe, getAndSetLong_name, getAndSetLong_signature, F_R) \
|
||||||
do_name( getAndSetLong_name, "getAndSetLong") \
|
do_name( getAndSetLong_name, "getAndSetLong") \
|
||||||
do_alias( getAndSetLong_signature, /*"(Ljava/lang/Object;JJ)J"*/ getAndAddLong_signature) \
|
do_alias( getAndSetLong_signature, /*"(Ljava/lang/Object;JJ)J"*/ getAndAddLong_signature) \
|
||||||
do_intrinsic(_getAndSetObject, sun_misc_Unsafe, getAndSetObject_name, getAndSetObject_signature, F_R)\
|
do_intrinsic(_getAndSetObject, jdk_internal_misc_Unsafe, getAndSetObject_name, getAndSetObject_signature, F_R)\
|
||||||
do_name( getAndSetObject_name, "getAndSetObject") \
|
do_name( getAndSetObject_name, "getAndSetObject") \
|
||||||
do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
|
do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
|
||||||
\
|
\
|
||||||
/* (2) Bytecode intrinsics */ \
|
/* (2) Bytecode intrinsics */ \
|
||||||
\
|
\
|
||||||
do_intrinsic(_park, sun_misc_Unsafe, park_name, park_signature, F_RN) \
|
do_intrinsic(_park, jdk_internal_misc_Unsafe, park_name, park_signature, F_R) \
|
||||||
do_name( park_name, "park") \
|
do_name( park_name, "park") \
|
||||||
do_signature(park_signature, "(ZJ)V") \
|
do_signature(park_signature, "(ZJ)V") \
|
||||||
do_intrinsic(_unpark, sun_misc_Unsafe, unpark_name, unpark_signature, F_RN) \
|
do_intrinsic(_unpark, jdk_internal_misc_Unsafe, unpark_name, unpark_signature, F_R) \
|
||||||
do_name( unpark_name, "unpark") \
|
do_name( unpark_name, "unpark") \
|
||||||
do_alias( unpark_signature, /*(LObject;)V*/ object_void_signature) \
|
do_alias( unpark_signature, /*(LObject;)V*/ object_void_signature) \
|
||||||
|
\
|
||||||
do_intrinsic(_StringBuilder_void, java_lang_StringBuilder, object_initializer_name, void_method_signature, F_R) \
|
do_intrinsic(_StringBuilder_void, java_lang_StringBuilder, object_initializer_name, void_method_signature, F_R) \
|
||||||
do_intrinsic(_StringBuilder_int, java_lang_StringBuilder, object_initializer_name, int_void_signature, F_R) \
|
do_intrinsic(_StringBuilder_int, java_lang_StringBuilder, object_initializer_name, int_void_signature, F_R) \
|
||||||
do_intrinsic(_StringBuilder_String, java_lang_StringBuilder, object_initializer_name, string_void_signature, F_R) \
|
do_intrinsic(_StringBuilder_String, java_lang_StringBuilder, object_initializer_name, string_void_signature, F_R) \
|
||||||
|
|
|
@ -1008,8 +1008,8 @@ bool universe_post_init() {
|
||||||
Universe::_finalizer_register_cache->init(
|
Universe::_finalizer_register_cache->init(
|
||||||
SystemDictionary::Finalizer_klass(), m);
|
SystemDictionary::Finalizer_klass(), m);
|
||||||
|
|
||||||
SystemDictionary::misc_Unsafe_klass()->link_class(CHECK_false);
|
SystemDictionary::internal_Unsafe_klass()->link_class(CHECK_false);
|
||||||
m = SystemDictionary::misc_Unsafe_klass()->find_method(
|
m = SystemDictionary::internal_Unsafe_klass()->find_method(
|
||||||
vmSymbols::throwIllegalAccessError_name(),
|
vmSymbols::throwIllegalAccessError_name(),
|
||||||
vmSymbols::void_method_signature());
|
vmSymbols::void_method_signature());
|
||||||
if (m != NULL && !m->is_static()) {
|
if (m != NULL && !m->is_static()) {
|
||||||
|
@ -1019,7 +1019,7 @@ bool universe_post_init() {
|
||||||
return false; // initialization failed (cannot throw exception yet)
|
return false; // initialization failed (cannot throw exception yet)
|
||||||
}
|
}
|
||||||
Universe::_throw_illegal_access_error_cache->init(
|
Universe::_throw_illegal_access_error_cache->init(
|
||||||
SystemDictionary::misc_Unsafe_klass(), m);
|
SystemDictionary::internal_Unsafe_klass(), m);
|
||||||
|
|
||||||
// Setup method for registering loaded classes in class loader vector
|
// Setup method for registering loaded classes in class loader vector
|
||||||
SystemDictionary::ClassLoader_klass()->link_class(CHECK_false);
|
SystemDictionary::ClassLoader_klass()->link_class(CHECK_false);
|
||||||
|
|
|
@ -1302,6 +1302,73 @@ vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) {
|
||||||
return vmSymbols::find_sid(klass_name);
|
return vmSymbols::find_sid(klass_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_unsafe_alias(vmSymbols::SID name_id) {
|
||||||
|
// All 70 intrinsic candidate methods from sun.misc.Unsafe in 1.8.
|
||||||
|
// Some have the same method name but different signature, e.g.
|
||||||
|
// getByte(long), getByte(Object,long)
|
||||||
|
switch (name_id) {
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(allocateInstance_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(copyMemory_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(loadFence_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(storeFence_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(fullFence_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getObject_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getBoolean_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getByte_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getShort_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getChar_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getInt_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getLong_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getFloat_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getDouble_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putObject_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putBoolean_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putByte_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putShort_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putChar_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putInt_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putLong_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putFloat_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putDouble_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getObjectVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getBooleanVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getByteVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getShortVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getCharVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getIntVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getLongVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getFloatVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getDoubleVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putObjectVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putBooleanVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putByteVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putShortVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putCharVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putIntVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putLongVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putFloatVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putDoubleVolatile_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getAddress_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putAddress_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(compareAndSwapObject_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(compareAndSwapLong_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(compareAndSwapInt_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putOrderedObject_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putOrderedLong_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(putOrderedInt_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getAndAddInt_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getAndAddLong_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getAndSetInt_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getAndSetLong_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(getAndSetObject_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(park_name):
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(unpark_name):
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Method::init_intrinsic_id() {
|
void Method::init_intrinsic_id() {
|
||||||
assert(_intrinsic_id == vmIntrinsics::_none, "do this just once");
|
assert(_intrinsic_id == vmIntrinsics::_none, "do this just once");
|
||||||
const uintptr_t max_id_uint = right_n_bits((int)(sizeof(_intrinsic_id) * BitsPerByte));
|
const uintptr_t max_id_uint = right_n_bits((int)(sizeof(_intrinsic_id) * BitsPerByte));
|
||||||
|
@ -1354,6 +1421,14 @@ void Method::init_intrinsic_id() {
|
||||||
if (is_static() != MethodHandles::is_signature_polymorphic_static(id))
|
if (is_static() != MethodHandles::is_signature_polymorphic_static(id))
|
||||||
id = vmIntrinsics::_none;
|
id = vmIntrinsics::_none;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Unsafe):
|
||||||
|
// Map sun.misc.Unsafe to jdk.internal.misc.Unsafe
|
||||||
|
if (!is_unsafe_alias(name_id)) break;
|
||||||
|
// pretend it is the corresponding method in the internal Unsafe class:
|
||||||
|
klass_id = vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_misc_Unsafe);
|
||||||
|
id = vmIntrinsics::find_id(klass_id, name_id, sig_id, flags);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != vmIntrinsics::_none) {
|
if (id != vmIntrinsics::_none) {
|
||||||
|
|
|
@ -2779,9 +2779,9 @@ bool LibraryCallKit::inline_unsafe_load_store(BasicType type, LoadStoreKind kind
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------inline_unsafe_ordered_store----------------------
|
//----------------------------inline_unsafe_ordered_store----------------------
|
||||||
// public native void sun.misc.Unsafe.putOrderedObject(Object o, long offset, Object x);
|
// public native void Unsafe.putOrderedObject(Object o, long offset, Object x);
|
||||||
// public native void sun.misc.Unsafe.putOrderedInt(Object o, long offset, int x);
|
// public native void Unsafe.putOrderedInt(Object o, long offset, int x);
|
||||||
// public native void sun.misc.Unsafe.putOrderedLong(Object o, long offset, long x);
|
// public native void Unsafe.putOrderedLong(Object o, long offset, long x);
|
||||||
bool LibraryCallKit::inline_unsafe_ordered_store(BasicType type) {
|
bool LibraryCallKit::inline_unsafe_ordered_store(BasicType type) {
|
||||||
// This is another variant of inline_unsafe_access, differing in
|
// This is another variant of inline_unsafe_access, differing in
|
||||||
// that it always issues store-store ("release") barrier and ensures
|
// that it always issues store-store ("release") barrier and ensures
|
||||||
|
@ -2875,7 +2875,7 @@ bool LibraryCallKit::klass_needs_init_guard(Node* kls) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------inline_unsafe_allocate---------------------------
|
//----------------------------inline_unsafe_allocate---------------------------
|
||||||
// public native Object sun.misc.Unsafe.allocateInstance(Class<?> cls);
|
// public native Object Unsafe.allocateInstance(Class<?> cls);
|
||||||
bool LibraryCallKit::inline_unsafe_allocate() {
|
bool LibraryCallKit::inline_unsafe_allocate() {
|
||||||
if (callee()->is_static()) return false; // caller must have the capability!
|
if (callee()->is_static()) return false; // caller must have the capability!
|
||||||
|
|
||||||
|
@ -4194,7 +4194,7 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
|
||||||
#endif //_LP64
|
#endif //_LP64
|
||||||
|
|
||||||
//----------------------inline_unsafe_copyMemory-------------------------
|
//----------------------inline_unsafe_copyMemory-------------------------
|
||||||
// public native void sun.misc.Unsafe.copyMemory(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes);
|
// public native void Unsafe.copyMemory(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes);
|
||||||
bool LibraryCallKit::inline_unsafe_copyMemory() {
|
bool LibraryCallKit::inline_unsafe_copyMemory() {
|
||||||
if (callee()->is_static()) return false; // caller must have the capability!
|
if (callee()->is_static()) return false; // caller must have the capability!
|
||||||
null_check_receiver(); // null-check receiver
|
null_check_receiver(); // null-check receiver
|
||||||
|
|
|
@ -997,7 +997,7 @@ public:
|
||||||
// "Acquire" - no following ref can move before (but earlier refs can
|
// "Acquire" - no following ref can move before (but earlier refs can
|
||||||
// follow, like an early Load stalled in cache). Requires multi-cpu
|
// follow, like an early Load stalled in cache). Requires multi-cpu
|
||||||
// visibility. Inserted independ of any load, as required
|
// visibility. Inserted independ of any load, as required
|
||||||
// for intrinsic sun.misc.Unsafe.loadFence().
|
// for intrinsic Unsafe.loadFence().
|
||||||
class LoadFenceNode: public MemBarNode {
|
class LoadFenceNode: public MemBarNode {
|
||||||
public:
|
public:
|
||||||
LoadFenceNode(Compile* C, int alias_idx, Node* precedent)
|
LoadFenceNode(Compile* C, int alias_idx, Node* precedent)
|
||||||
|
@ -1018,7 +1018,7 @@ public:
|
||||||
// "Release" - no earlier ref can move after (but later refs can move
|
// "Release" - no earlier ref can move after (but later refs can move
|
||||||
// up, like a speculative pipelined cache-hitting Load). Requires
|
// up, like a speculative pipelined cache-hitting Load). Requires
|
||||||
// multi-cpu visibility. Inserted independent of any store, as required
|
// multi-cpu visibility. Inserted independent of any store, as required
|
||||||
// for intrinsic sun.misc.Unsafe.storeFence().
|
// for intrinsic Unsafe.storeFence().
|
||||||
class StoreFenceNode: public MemBarNode {
|
class StoreFenceNode: public MemBarNode {
|
||||||
public:
|
public:
|
||||||
StoreFenceNode(Compile* C, int alias_idx, Node* precedent)
|
StoreFenceNode(Compile* C, int alias_idx, Node* precedent)
|
||||||
|
|
|
@ -3376,7 +3376,7 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
|
||||||
// default_vtable_indices for methods already in the vtable.
|
// default_vtable_indices for methods already in the vtable.
|
||||||
// If redefining Unsafe, walk all the vtables looking for entries.
|
// If redefining Unsafe, walk all the vtables looking for entries.
|
||||||
if (ik->vtable_length() > 0 && (_the_class_oop->is_interface()
|
if (ik->vtable_length() > 0 && (_the_class_oop->is_interface()
|
||||||
|| _the_class_oop == SystemDictionary::misc_Unsafe_klass()
|
|| _the_class_oop == SystemDictionary::internal_Unsafe_klass()
|
||||||
|| ik->is_subtype_of(_the_class_oop))) {
|
|| ik->is_subtype_of(_the_class_oop))) {
|
||||||
// ik->vtable() creates a wrapper object; rm cleans it up
|
// ik->vtable() creates a wrapper object; rm cleans it up
|
||||||
ResourceMark rm(_thread);
|
ResourceMark rm(_thread);
|
||||||
|
@ -3393,7 +3393,7 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
|
||||||
// subclass relationship between an interface and an InstanceKlass.
|
// subclass relationship between an interface and an InstanceKlass.
|
||||||
// If redefining Unsafe, walk all the itables looking for entries.
|
// If redefining Unsafe, walk all the itables looking for entries.
|
||||||
if (ik->itable_length() > 0 && (_the_class_oop->is_interface()
|
if (ik->itable_length() > 0 && (_the_class_oop->is_interface()
|
||||||
|| _the_class_oop == SystemDictionary::misc_Unsafe_klass()
|
|| _the_class_oop == SystemDictionary::internal_Unsafe_klass()
|
||||||
|| ik->is_subclass_of(_the_class_oop))) {
|
|| ik->is_subclass_of(_the_class_oop))) {
|
||||||
// ik->itable() creates a wrapper object; rm cleans it up
|
// ik->itable() creates a wrapper object; rm cleans it up
|
||||||
ResourceMark rm(_thread);
|
ResourceMark rm(_thread);
|
||||||
|
|
|
@ -121,6 +121,7 @@ extern "C" {
|
||||||
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
|
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
|
||||||
|
|
||||||
static JNINativeMethod lookup_special_native_methods[] = {
|
static JNINativeMethod lookup_special_native_methods[] = {
|
||||||
|
{ CC"Java_jdk_internal_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
|
||||||
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
|
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
|
||||||
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
|
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
|
||||||
{ CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
|
{ CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#endif // INCLUDE_ALL_GCS
|
#endif // INCLUDE_ALL_GCS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implementation of class sun.misc.Unsafe
|
* Implementation of class Unsafe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -812,7 +812,7 @@ public:
|
||||||
"Inline Thread.currentThread, etc") \
|
"Inline Thread.currentThread, etc") \
|
||||||
\
|
\
|
||||||
develop(bool, InlineUnsafeOps, true, \
|
develop(bool, InlineUnsafeOps, true, \
|
||||||
"Inline memory ops (native methods) from sun.misc.Unsafe") \
|
"Inline memory ops (native methods) from Unsafe") \
|
||||||
\
|
\
|
||||||
product(bool, CriticalJNINatives, true, \
|
product(bool, CriticalJNINatives, true, \
|
||||||
"Check for critical JNI entry points") \
|
"Check for critical JNI entry points") \
|
||||||
|
@ -4241,7 +4241,7 @@ public:
|
||||||
"Use locked-tracing when doing event-based tracing") \
|
"Use locked-tracing when doing event-based tracing") \
|
||||||
\
|
\
|
||||||
diagnostic(bool, UseUnalignedAccesses, false, \
|
diagnostic(bool, UseUnalignedAccesses, false, \
|
||||||
"Use unaligned memory accesses in sun.misc.Unsafe") \
|
"Use unaligned memory accesses in Unsafe") \
|
||||||
\
|
\
|
||||||
product_pd(bool, PreserveFramePointer, \
|
product_pd(bool, PreserveFramePointer, \
|
||||||
"Use the FP register for holding the frame pointer " \
|
"Use the FP register for holding the frame pointer " \
|
||||||
|
|
|
@ -722,7 +722,7 @@ void DumperSupport::dump_field_value(DumpWriter* writer, char type, address addr
|
||||||
o = oopDesc::load_decode_heap_oop((oop*)addr);
|
o = oopDesc::load_decode_heap_oop((oop*)addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reflection and sun.misc.Unsafe classes may have a reference to a
|
// reflection and Unsafe classes may have a reference to a
|
||||||
// Klass* so filter it out.
|
// Klass* so filter it out.
|
||||||
assert(o->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(o));
|
assert(o->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(o));
|
||||||
writer->write_objectID(o);
|
writer->write_objectID(o);
|
||||||
|
|
|
@ -65,7 +65,7 @@ bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
|
||||||
case vmIntrinsics::_currentThread:
|
case vmIntrinsics::_currentThread:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// sun.misc.Unsafe
|
// Unsafe
|
||||||
case vmIntrinsics::_compareAndSwapInt:
|
case vmIntrinsics::_compareAndSwapInt:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void SharkIntrinsics::do_intrinsic() {
|
||||||
do_Thread_currentThread();
|
do_Thread_currentThread();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// sun.misc.Unsafe
|
// Unsafe
|
||||||
case vmIntrinsics::_compareAndSwapInt:
|
case vmIntrinsics::_compareAndSwapInt:
|
||||||
do_Unsafe_compareAndSwapInt();
|
do_Unsafe_compareAndSwapInt();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,13 +43,13 @@ package java.lang.invoke;
|
||||||
import jdk.internal.org.objectweb.asm.*;
|
import jdk.internal.org.objectweb.asm.*;
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import sun.misc.Unsafe;
|
import jdk.internal.misc.Unsafe;
|
||||||
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||||
|
|
||||||
public class UnsafeGetConstantField {
|
public class UnsafeGetConstantField {
|
||||||
static final Class<?> THIS_CLASS = UnsafeGetConstantField.class;
|
static final Class<?> THIS_CLASS = UnsafeGetConstantField.class;
|
||||||
|
|
||||||
static final Unsafe U = Utils.getUnsafe();
|
static final Unsafe U = Unsafe.getUnsafe();
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
testUnsafeGetAddress();
|
testUnsafeGetAddress();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue