This commit is contained in:
Jayathirth D V 2018-10-23 15:29:10 +05:30
commit cfaf92f28b
239 changed files with 4949 additions and 2023 deletions

View file

@ -228,7 +228,7 @@ define create_overview_file
<blockquote><dl> \ <blockquote><dl> \
# #
$1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \ $1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
<dt style="margin-top: 8px;"><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \ <dt style="margin-top: 8px;">$$($$g_GROUP_NAME)</dt> \
<dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \ <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \
) )
$1_OVERVIEW_TEXT += \ $1_OVERVIEW_TEXT += \

View file

@ -53,8 +53,8 @@ define GenerateVarHandle
endif endif
$$($1_FILENAME): $(VARHANDLES_SRC_DIR)/X-VarHandle.java.template $(BUILD_TOOLS_JDK) $$($1_FILENAME): $(VARHANDLES_SRC_DIR)/X-VarHandle.java.template $(BUILD_TOOLS_JDK)
ifeq ($$($1_Type), Object) ifeq ($$($1_Type), Reference)
$$(eval $1_type := $$($1_Type)) $$(eval $1_type := Object)
else else
$$(eval $1_type := $$$$(shell $(TR) '[:upper:]' '[:lower:]' <<< $$$$($1_Type))) $$(eval $1_type := $$$$(shell $(TR) '[:upper:]' '[:lower:]' <<< $$$$($1_Type)))
endif endif
@ -158,7 +158,7 @@ endef
################################################################################ ################################################################################
# List the types to generate source for, with capitalized first letter # List the types to generate source for, with capitalized first letter
VARHANDLES_TYPES := Boolean Byte Short Char Int Long Float Double Object VARHANDLES_TYPES := Boolean Byte Short Char Int Long Float Double Reference
$(foreach t, $(VARHANDLES_TYPES), \ $(foreach t, $(VARHANDLES_TYPES), \
$(eval $(call GenerateVarHandle,VAR_HANDLE_$t,$t))) $(eval $(call GenerateVarHandle,VAR_HANDLE_$t,$t)))

View file

@ -126,7 +126,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_getAndSetLong: case vmIntrinsics::_getAndSetLong:
if (!VM_Version::supports_atomic_getset8()) return false; if (!VM_Version::supports_atomic_getset8()) return false;
break; break;
case vmIntrinsics::_getAndSetObject: case vmIntrinsics::_getAndSetReference:
#ifdef _LP64 #ifdef _LP64
if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) return false; if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) return false;
if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) return false; if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) return false;
@ -167,7 +167,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_dpow: case vmIntrinsics::_dpow:
case vmIntrinsics::_fmaD: case vmIntrinsics::_fmaD:
case vmIntrinsics::_fmaF: case vmIntrinsics::_fmaF:
case vmIntrinsics::_getObject: case vmIntrinsics::_getReference:
case vmIntrinsics::_getBoolean: case vmIntrinsics::_getBoolean:
case vmIntrinsics::_getByte: case vmIntrinsics::_getByte:
case vmIntrinsics::_getShort: case vmIntrinsics::_getShort:
@ -176,7 +176,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_getLong: case vmIntrinsics::_getLong:
case vmIntrinsics::_getFloat: case vmIntrinsics::_getFloat:
case vmIntrinsics::_getDouble: case vmIntrinsics::_getDouble:
case vmIntrinsics::_putObject: case vmIntrinsics::_putReference:
case vmIntrinsics::_putBoolean: case vmIntrinsics::_putBoolean:
case vmIntrinsics::_putByte: case vmIntrinsics::_putByte:
case vmIntrinsics::_putShort: case vmIntrinsics::_putShort:
@ -185,7 +185,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_putLong: case vmIntrinsics::_putLong:
case vmIntrinsics::_putFloat: case vmIntrinsics::_putFloat:
case vmIntrinsics::_putDouble: case vmIntrinsics::_putDouble:
case vmIntrinsics::_getObjectVolatile: case vmIntrinsics::_getReferenceVolatile:
case vmIntrinsics::_getBooleanVolatile: case vmIntrinsics::_getBooleanVolatile:
case vmIntrinsics::_getByteVolatile: case vmIntrinsics::_getByteVolatile:
case vmIntrinsics::_getShortVolatile: case vmIntrinsics::_getShortVolatile:
@ -194,7 +194,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_getLongVolatile: case vmIntrinsics::_getLongVolatile:
case vmIntrinsics::_getFloatVolatile: case vmIntrinsics::_getFloatVolatile:
case vmIntrinsics::_getDoubleVolatile: case vmIntrinsics::_getDoubleVolatile:
case vmIntrinsics::_putObjectVolatile: case vmIntrinsics::_putReferenceVolatile:
case vmIntrinsics::_putBooleanVolatile: case vmIntrinsics::_putBooleanVolatile:
case vmIntrinsics::_putByteVolatile: case vmIntrinsics::_putByteVolatile:
case vmIntrinsics::_putShortVolatile: case vmIntrinsics::_putShortVolatile:
@ -221,7 +221,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
#endif #endif
case vmIntrinsics::_vectorizedMismatch: case vmIntrinsics::_vectorizedMismatch:
case vmIntrinsics::_compareAndSetInt: case vmIntrinsics::_compareAndSetInt:
case vmIntrinsics::_compareAndSetObject: case vmIntrinsics::_compareAndSetReference:
case vmIntrinsics::_getCharStringU: case vmIntrinsics::_getCharStringU:
case vmIntrinsics::_putCharStringU: case vmIntrinsics::_putCharStringU:
#ifdef JFR_HAVE_INTRINSICS #ifdef JFR_HAVE_INTRINSICS

View file

@ -3471,7 +3471,7 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
// Some intrinsics need special IR nodes. // Some intrinsics need special IR nodes.
switch(id) { switch(id) {
case vmIntrinsics::_getObject : append_unsafe_get_obj(callee, T_OBJECT, false); return; case vmIntrinsics::_getReference : append_unsafe_get_obj(callee, T_OBJECT, false); return;
case vmIntrinsics::_getBoolean : append_unsafe_get_obj(callee, T_BOOLEAN, false); return; case vmIntrinsics::_getBoolean : append_unsafe_get_obj(callee, T_BOOLEAN, false); return;
case vmIntrinsics::_getByte : append_unsafe_get_obj(callee, T_BYTE, false); return; case vmIntrinsics::_getByte : append_unsafe_get_obj(callee, T_BYTE, false); return;
case vmIntrinsics::_getShort : append_unsafe_get_obj(callee, T_SHORT, false); return; case vmIntrinsics::_getShort : append_unsafe_get_obj(callee, T_SHORT, false); return;
@ -3480,7 +3480,7 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
case vmIntrinsics::_getLong : append_unsafe_get_obj(callee, T_LONG, false); return; case vmIntrinsics::_getLong : append_unsafe_get_obj(callee, T_LONG, false); return;
case vmIntrinsics::_getFloat : append_unsafe_get_obj(callee, T_FLOAT, false); return; case vmIntrinsics::_getFloat : append_unsafe_get_obj(callee, T_FLOAT, false); return;
case vmIntrinsics::_getDouble : append_unsafe_get_obj(callee, T_DOUBLE, false); return; case vmIntrinsics::_getDouble : append_unsafe_get_obj(callee, T_DOUBLE, false); return;
case vmIntrinsics::_putObject : append_unsafe_put_obj(callee, T_OBJECT, false); return; case vmIntrinsics::_putReference : append_unsafe_put_obj(callee, T_OBJECT, false); return;
case vmIntrinsics::_putBoolean : append_unsafe_put_obj(callee, T_BOOLEAN, false); return; case vmIntrinsics::_putBoolean : append_unsafe_put_obj(callee, T_BOOLEAN, false); return;
case vmIntrinsics::_putByte : append_unsafe_put_obj(callee, T_BYTE, false); return; case vmIntrinsics::_putByte : append_unsafe_put_obj(callee, T_BYTE, false); return;
case vmIntrinsics::_putShort : append_unsafe_put_obj(callee, T_SHORT, false); return; case vmIntrinsics::_putShort : append_unsafe_put_obj(callee, T_SHORT, false); return;
@ -3497,7 +3497,7 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
case vmIntrinsics::_putCharUnaligned : append_unsafe_put_obj(callee, T_CHAR, false); return; case vmIntrinsics::_putCharUnaligned : append_unsafe_put_obj(callee, T_CHAR, false); return;
case vmIntrinsics::_putIntUnaligned : append_unsafe_put_obj(callee, T_INT, false); return; case vmIntrinsics::_putIntUnaligned : append_unsafe_put_obj(callee, T_INT, false); return;
case vmIntrinsics::_putLongUnaligned : append_unsafe_put_obj(callee, T_LONG, false); return; case vmIntrinsics::_putLongUnaligned : append_unsafe_put_obj(callee, T_LONG, false); return;
case vmIntrinsics::_getObjectVolatile : append_unsafe_get_obj(callee, T_OBJECT, true); return; case vmIntrinsics::_getReferenceVolatile : append_unsafe_get_obj(callee, T_OBJECT, true); return;
case vmIntrinsics::_getBooleanVolatile : append_unsafe_get_obj(callee, T_BOOLEAN, true); return; case vmIntrinsics::_getBooleanVolatile : append_unsafe_get_obj(callee, T_BOOLEAN, true); return;
case vmIntrinsics::_getByteVolatile : append_unsafe_get_obj(callee, T_BYTE, true); return; case vmIntrinsics::_getByteVolatile : append_unsafe_get_obj(callee, T_BYTE, true); return;
case vmIntrinsics::_getShortVolatile : append_unsafe_get_obj(callee, T_SHORT, true); return; case vmIntrinsics::_getShortVolatile : append_unsafe_get_obj(callee, T_SHORT, true); return;
@ -3506,7 +3506,7 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
case vmIntrinsics::_getLongVolatile : append_unsafe_get_obj(callee, T_LONG, true); return; case vmIntrinsics::_getLongVolatile : append_unsafe_get_obj(callee, T_LONG, true); return;
case vmIntrinsics::_getFloatVolatile : append_unsafe_get_obj(callee, T_FLOAT, true); return; case vmIntrinsics::_getFloatVolatile : append_unsafe_get_obj(callee, T_FLOAT, true); return;
case vmIntrinsics::_getDoubleVolatile : append_unsafe_get_obj(callee, T_DOUBLE, true); return; case vmIntrinsics::_getDoubleVolatile : append_unsafe_get_obj(callee, T_DOUBLE, true); return;
case vmIntrinsics::_putObjectVolatile : append_unsafe_put_obj(callee, T_OBJECT, true); return; case vmIntrinsics::_putReferenceVolatile : append_unsafe_put_obj(callee, T_OBJECT, true); return;
case vmIntrinsics::_putBooleanVolatile : append_unsafe_put_obj(callee, T_BOOLEAN, true); return; case vmIntrinsics::_putBooleanVolatile : append_unsafe_put_obj(callee, T_BOOLEAN, true); return;
case vmIntrinsics::_putByteVolatile : append_unsafe_put_obj(callee, T_BYTE, true); return; case vmIntrinsics::_putByteVolatile : append_unsafe_put_obj(callee, T_BYTE, true); return;
case vmIntrinsics::_putShortVolatile : append_unsafe_put_obj(callee, T_SHORT, true); return; case vmIntrinsics::_putShortVolatile : append_unsafe_put_obj(callee, T_SHORT, true); return;
@ -3517,12 +3517,12 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return; case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return;
case vmIntrinsics::_compareAndSetLong: case vmIntrinsics::_compareAndSetLong:
case vmIntrinsics::_compareAndSetInt: case vmIntrinsics::_compareAndSetInt:
case vmIntrinsics::_compareAndSetObject: append_unsafe_CAS(callee); return; case vmIntrinsics::_compareAndSetReference : append_unsafe_CAS(callee); return;
case vmIntrinsics::_getAndAddInt: case vmIntrinsics::_getAndAddInt:
case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return; case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return;
case vmIntrinsics::_getAndSetInt : case vmIntrinsics::_getAndSetInt :
case vmIntrinsics::_getAndSetLong : case vmIntrinsics::_getAndSetLong :
case vmIntrinsics::_getAndSetObject : append_unsafe_get_and_set_obj(callee, false); return; case vmIntrinsics::_getAndSetReference : append_unsafe_get_and_set_obj(callee, false); return;
case vmIntrinsics::_getCharStringU : append_char_access(callee, false); return; case vmIntrinsics::_getCharStringU : append_char_access(callee, false); return;
case vmIntrinsics::_putCharStringU : append_char_access(callee, true); return; case vmIntrinsics::_putCharStringU : append_char_access(callee, true); return;
default: default:

View file

@ -3057,7 +3057,7 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
// java.nio.Buffer.checkIndex // java.nio.Buffer.checkIndex
case vmIntrinsics::_checkIndex: do_NIOCheckIndex(x); break; case vmIntrinsics::_checkIndex: do_NIOCheckIndex(x); break;
case vmIntrinsics::_compareAndSetObject: case vmIntrinsics::_compareAndSetReference:
do_CompareAndSwap(x, objectType); do_CompareAndSwap(x, objectType);
break; break;
case vmIntrinsics::_compareAndSetInt: case vmIntrinsics::_compareAndSetInt:

View file

@ -527,7 +527,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_getAndAddLong: case vmIntrinsics::_getAndAddLong:
case vmIntrinsics::_getAndSetInt: case vmIntrinsics::_getAndSetInt:
case vmIntrinsics::_getAndSetLong: case vmIntrinsics::_getAndSetLong:
case vmIntrinsics::_getAndSetObject: case vmIntrinsics::_getAndSetReference:
case vmIntrinsics::_loadFence: case vmIntrinsics::_loadFence:
case vmIntrinsics::_storeFence: case vmIntrinsics::_storeFence:
case vmIntrinsics::_fullFence: case vmIntrinsics::_fullFence:
@ -589,7 +589,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_updateByteBufferCRC32: case vmIntrinsics::_updateByteBufferCRC32:
if (!UseCRC32Intrinsics) return true; if (!UseCRC32Intrinsics) return true;
break; break;
case vmIntrinsics::_getObject: case vmIntrinsics::_getReference:
case vmIntrinsics::_getBoolean: case vmIntrinsics::_getBoolean:
case vmIntrinsics::_getByte: case vmIntrinsics::_getByte:
case vmIntrinsics::_getShort: case vmIntrinsics::_getShort:
@ -598,7 +598,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_getLong: case vmIntrinsics::_getLong:
case vmIntrinsics::_getFloat: case vmIntrinsics::_getFloat:
case vmIntrinsics::_getDouble: case vmIntrinsics::_getDouble:
case vmIntrinsics::_putObject: case vmIntrinsics::_putReference:
case vmIntrinsics::_putBoolean: case vmIntrinsics::_putBoolean:
case vmIntrinsics::_putByte: case vmIntrinsics::_putByte:
case vmIntrinsics::_putShort: case vmIntrinsics::_putShort:
@ -607,7 +607,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_putLong: case vmIntrinsics::_putLong:
case vmIntrinsics::_putFloat: case vmIntrinsics::_putFloat:
case vmIntrinsics::_putDouble: case vmIntrinsics::_putDouble:
case vmIntrinsics::_getObjectVolatile: case vmIntrinsics::_getReferenceVolatile:
case vmIntrinsics::_getBooleanVolatile: case vmIntrinsics::_getBooleanVolatile:
case vmIntrinsics::_getByteVolatile: case vmIntrinsics::_getByteVolatile:
case vmIntrinsics::_getShortVolatile: case vmIntrinsics::_getShortVolatile:
@ -616,7 +616,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_getLongVolatile: case vmIntrinsics::_getLongVolatile:
case vmIntrinsics::_getFloatVolatile: case vmIntrinsics::_getFloatVolatile:
case vmIntrinsics::_getDoubleVolatile: case vmIntrinsics::_getDoubleVolatile:
case vmIntrinsics::_putObjectVolatile: case vmIntrinsics::_putReferenceVolatile:
case vmIntrinsics::_putBooleanVolatile: case vmIntrinsics::_putBooleanVolatile:
case vmIntrinsics::_putByteVolatile: case vmIntrinsics::_putByteVolatile:
case vmIntrinsics::_putShortVolatile: case vmIntrinsics::_putShortVolatile:
@ -625,7 +625,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_putLongVolatile: case vmIntrinsics::_putLongVolatile:
case vmIntrinsics::_putFloatVolatile: case vmIntrinsics::_putFloatVolatile:
case vmIntrinsics::_putDoubleVolatile: case vmIntrinsics::_putDoubleVolatile:
case vmIntrinsics::_getObjectAcquire: case vmIntrinsics::_getReferenceAcquire:
case vmIntrinsics::_getBooleanAcquire: case vmIntrinsics::_getBooleanAcquire:
case vmIntrinsics::_getByteAcquire: case vmIntrinsics::_getByteAcquire:
case vmIntrinsics::_getShortAcquire: case vmIntrinsics::_getShortAcquire:
@ -634,7 +634,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_getLongAcquire: case vmIntrinsics::_getLongAcquire:
case vmIntrinsics::_getFloatAcquire: case vmIntrinsics::_getFloatAcquire:
case vmIntrinsics::_getDoubleAcquire: case vmIntrinsics::_getDoubleAcquire:
case vmIntrinsics::_putObjectRelease: case vmIntrinsics::_putReferenceRelease:
case vmIntrinsics::_putBooleanRelease: case vmIntrinsics::_putBooleanRelease:
case vmIntrinsics::_putByteRelease: case vmIntrinsics::_putByteRelease:
case vmIntrinsics::_putShortRelease: case vmIntrinsics::_putShortRelease:
@ -643,7 +643,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_putLongRelease: case vmIntrinsics::_putLongRelease:
case vmIntrinsics::_putFloatRelease: case vmIntrinsics::_putFloatRelease:
case vmIntrinsics::_putDoubleRelease: case vmIntrinsics::_putDoubleRelease:
case vmIntrinsics::_getObjectOpaque: case vmIntrinsics::_getReferenceOpaque:
case vmIntrinsics::_getBooleanOpaque: case vmIntrinsics::_getBooleanOpaque:
case vmIntrinsics::_getByteOpaque: case vmIntrinsics::_getByteOpaque:
case vmIntrinsics::_getShortOpaque: case vmIntrinsics::_getShortOpaque:
@ -652,7 +652,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_getLongOpaque: case vmIntrinsics::_getLongOpaque:
case vmIntrinsics::_getFloatOpaque: case vmIntrinsics::_getFloatOpaque:
case vmIntrinsics::_getDoubleOpaque: case vmIntrinsics::_getDoubleOpaque:
case vmIntrinsics::_putObjectOpaque: case vmIntrinsics::_putReferenceOpaque:
case vmIntrinsics::_putBooleanOpaque: case vmIntrinsics::_putBooleanOpaque:
case vmIntrinsics::_putByteOpaque: case vmIntrinsics::_putByteOpaque:
case vmIntrinsics::_putShortOpaque: case vmIntrinsics::_putShortOpaque:
@ -665,7 +665,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_getAndAddLong: case vmIntrinsics::_getAndAddLong:
case vmIntrinsics::_getAndSetInt: case vmIntrinsics::_getAndSetInt:
case vmIntrinsics::_getAndSetLong: case vmIntrinsics::_getAndSetLong:
case vmIntrinsics::_getAndSetObject: case vmIntrinsics::_getAndSetReference:
case vmIntrinsics::_loadFence: case vmIntrinsics::_loadFence:
case vmIntrinsics::_storeFence: case vmIntrinsics::_storeFence:
case vmIntrinsics::_fullFence: case vmIntrinsics::_fullFence:
@ -679,20 +679,20 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_weakCompareAndSetIntPlain: case vmIntrinsics::_weakCompareAndSetIntPlain:
case vmIntrinsics::_weakCompareAndSetIntAcquire: case vmIntrinsics::_weakCompareAndSetIntAcquire:
case vmIntrinsics::_weakCompareAndSetIntRelease: case vmIntrinsics::_weakCompareAndSetIntRelease:
case vmIntrinsics::_compareAndSetObject: case vmIntrinsics::_compareAndSetReference:
case vmIntrinsics::_weakCompareAndSetObject: case vmIntrinsics::_weakCompareAndSetReference:
case vmIntrinsics::_weakCompareAndSetObjectPlain: case vmIntrinsics::_weakCompareAndSetReferencePlain:
case vmIntrinsics::_weakCompareAndSetObjectAcquire: case vmIntrinsics::_weakCompareAndSetReferenceAcquire:
case vmIntrinsics::_weakCompareAndSetObjectRelease: case vmIntrinsics::_weakCompareAndSetReferenceRelease:
case vmIntrinsics::_compareAndExchangeInt: case vmIntrinsics::_compareAndExchangeInt:
case vmIntrinsics::_compareAndExchangeIntAcquire: case vmIntrinsics::_compareAndExchangeIntAcquire:
case vmIntrinsics::_compareAndExchangeIntRelease: case vmIntrinsics::_compareAndExchangeIntRelease:
case vmIntrinsics::_compareAndExchangeLong: case vmIntrinsics::_compareAndExchangeLong:
case vmIntrinsics::_compareAndExchangeLongAcquire: case vmIntrinsics::_compareAndExchangeLongAcquire:
case vmIntrinsics::_compareAndExchangeLongRelease: case vmIntrinsics::_compareAndExchangeLongRelease:
case vmIntrinsics::_compareAndExchangeObject: case vmIntrinsics::_compareAndExchangeReference:
case vmIntrinsics::_compareAndExchangeObjectAcquire: case vmIntrinsics::_compareAndExchangeReferenceAcquire:
case vmIntrinsics::_compareAndExchangeObjectRelease: case vmIntrinsics::_compareAndExchangeReferenceRelease:
if (!InlineUnsafeOps) return true; if (!InlineUnsafeOps) return true;
break; break;
case vmIntrinsics::_getShortUnaligned: case vmIntrinsics::_getShortUnaligned:

View file

@ -1084,8 +1084,8 @@
do_alias( isCompileConstant_signature, object_boolean_signature) \ do_alias( isCompileConstant_signature, object_boolean_signature) \
\ \
/* unsafe memory references (there are a lot of them...) */ \ /* unsafe memory references (there are a lot of them...) */ \
do_signature(getObject_signature, "(Ljava/lang/Object;J)Ljava/lang/Object;") \ do_signature(getReference_signature, "(Ljava/lang/Object;J)Ljava/lang/Object;") \
do_signature(putObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)V") \ do_signature(putReference_signature, "(Ljava/lang/Object;JLjava/lang/Object;)V") \
do_signature(getBoolean_signature, "(Ljava/lang/Object;J)Z") \ do_signature(getBoolean_signature, "(Ljava/lang/Object;J)Z") \
do_signature(putBoolean_signature, "(Ljava/lang/Object;JZ)V") \ do_signature(putBoolean_signature, "(Ljava/lang/Object;JZ)V") \
do_signature(getByte_signature, "(Ljava/lang/Object;J)B") \ do_signature(getByte_signature, "(Ljava/lang/Object;J)B") \
@ -1103,7 +1103,7 @@
do_signature(getDouble_signature, "(Ljava/lang/Object;J)D") \ do_signature(getDouble_signature, "(Ljava/lang/Object;J)D") \
do_signature(putDouble_signature, "(Ljava/lang/Object;JD)V") \ do_signature(putDouble_signature, "(Ljava/lang/Object;JD)V") \
\ \
do_name(getObject_name,"getObject") do_name(putObject_name,"putObject") \ do_name(getReference_name,"getReference") do_name(putReference_name,"putReference") \
do_name(getBoolean_name,"getBoolean") do_name(putBoolean_name,"putBoolean") \ do_name(getBoolean_name,"getBoolean") do_name(putBoolean_name,"putBoolean") \
do_name(getByte_name,"getByte") do_name(putByte_name,"putByte") \ do_name(getByte_name,"getByte") do_name(putByte_name,"putByte") \
do_name(getShort_name,"getShort") do_name(putShort_name,"putShort") \ do_name(getShort_name,"getShort") do_name(putShort_name,"putShort") \
@ -1113,7 +1113,7 @@
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, jdk_internal_misc_Unsafe, getObject_name, getObject_signature, F_RN) \ do_intrinsic(_getReference, jdk_internal_misc_Unsafe, getReference_name, getReference_signature, F_RN) \
do_intrinsic(_getBoolean, jdk_internal_misc_Unsafe, getBoolean_name, getBoolean_signature, F_RN) \ do_intrinsic(_getBoolean, jdk_internal_misc_Unsafe, getBoolean_name, getBoolean_signature, F_RN) \
do_intrinsic(_getByte, jdk_internal_misc_Unsafe, getByte_name, getByte_signature, F_RN) \ do_intrinsic(_getByte, jdk_internal_misc_Unsafe, getByte_name, getByte_signature, F_RN) \
do_intrinsic(_getShort, jdk_internal_misc_Unsafe, getShort_name, getShort_signature, F_RN) \ do_intrinsic(_getShort, jdk_internal_misc_Unsafe, getShort_name, getShort_signature, F_RN) \
@ -1122,7 +1122,7 @@
do_intrinsic(_getLong, jdk_internal_misc_Unsafe, getLong_name, getLong_signature, F_RN) \ do_intrinsic(_getLong, jdk_internal_misc_Unsafe, getLong_name, getLong_signature, F_RN) \
do_intrinsic(_getFloat, jdk_internal_misc_Unsafe, getFloat_name, getFloat_signature, F_RN) \ do_intrinsic(_getFloat, jdk_internal_misc_Unsafe, getFloat_name, getFloat_signature, F_RN) \
do_intrinsic(_getDouble, jdk_internal_misc_Unsafe, getDouble_name, getDouble_signature, F_RN) \ do_intrinsic(_getDouble, jdk_internal_misc_Unsafe, getDouble_name, getDouble_signature, F_RN) \
do_intrinsic(_putObject, jdk_internal_misc_Unsafe, putObject_name, putObject_signature, F_RN) \ do_intrinsic(_putReference, jdk_internal_misc_Unsafe, putReference_name, putReference_signature, F_RN) \
do_intrinsic(_putBoolean, jdk_internal_misc_Unsafe, putBoolean_name, putBoolean_signature, F_RN) \ do_intrinsic(_putBoolean, jdk_internal_misc_Unsafe, putBoolean_name, putBoolean_signature, F_RN) \
do_intrinsic(_putByte, jdk_internal_misc_Unsafe, putByte_name, putByte_signature, F_RN) \ do_intrinsic(_putByte, jdk_internal_misc_Unsafe, putByte_name, putByte_signature, F_RN) \
do_intrinsic(_putShort, jdk_internal_misc_Unsafe, putShort_name, putShort_signature, F_RN) \ do_intrinsic(_putShort, jdk_internal_misc_Unsafe, putShort_name, putShort_signature, F_RN) \
@ -1132,92 +1132,92 @@
do_intrinsic(_putFloat, jdk_internal_misc_Unsafe, putFloat_name, putFloat_signature, F_RN) \ do_intrinsic(_putFloat, jdk_internal_misc_Unsafe, putFloat_name, putFloat_signature, F_RN) \
do_intrinsic(_putDouble, jdk_internal_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(getReferenceVolatile_name,"getReferenceVolatile") do_name(putReferenceVolatile_name,"putReferenceVolatile") \
do_name(getBooleanVolatile_name,"getBooleanVolatile") do_name(putBooleanVolatile_name,"putBooleanVolatile") \ do_name(getBooleanVolatile_name,"getBooleanVolatile") do_name(putBooleanVolatile_name,"putBooleanVolatile") \
do_name(getByteVolatile_name,"getByteVolatile") do_name(putByteVolatile_name,"putByteVolatile") \ do_name(getByteVolatile_name,"getByteVolatile") do_name(putByteVolatile_name,"putByteVolatile") \
do_name(getShortVolatile_name,"getShortVolatile") do_name(putShortVolatile_name,"putShortVolatile") \ do_name(getShortVolatile_name,"getShortVolatile") do_name(putShortVolatile_name,"putShortVolatile") \
do_name(getCharVolatile_name,"getCharVolatile") do_name(putCharVolatile_name,"putCharVolatile") \ do_name(getCharVolatile_name,"getCharVolatile") do_name(putCharVolatile_name,"putCharVolatile") \
do_name(getIntVolatile_name,"getIntVolatile") do_name(putIntVolatile_name,"putIntVolatile") \ do_name(getIntVolatile_name,"getIntVolatile") do_name(putIntVolatile_name,"putIntVolatile") \
do_name(getLongVolatile_name,"getLongVolatile") do_name(putLongVolatile_name,"putLongVolatile") \ do_name(getLongVolatile_name,"getLongVolatile") do_name(putLongVolatile_name,"putLongVolatile") \
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, jdk_internal_misc_Unsafe, getObjectVolatile_name, getObject_signature, F_RN) \ do_intrinsic(_getReferenceVolatile, jdk_internal_misc_Unsafe, getReferenceVolatile_name, getReference_signature, F_RN) \
do_intrinsic(_getBooleanVolatile, jdk_internal_misc_Unsafe, getBooleanVolatile_name, getBoolean_signature, F_RN) \ do_intrinsic(_getBooleanVolatile, jdk_internal_misc_Unsafe, getBooleanVolatile_name, getBoolean_signature, F_RN) \
do_intrinsic(_getByteVolatile, jdk_internal_misc_Unsafe, getByteVolatile_name, getByte_signature, F_RN) \ do_intrinsic(_getByteVolatile, jdk_internal_misc_Unsafe, getByteVolatile_name, getByte_signature, F_RN) \
do_intrinsic(_getShortVolatile, jdk_internal_misc_Unsafe, getShortVolatile_name, getShort_signature, F_RN) \ do_intrinsic(_getShortVolatile, jdk_internal_misc_Unsafe, getShortVolatile_name, getShort_signature, F_RN) \
do_intrinsic(_getCharVolatile, jdk_internal_misc_Unsafe, getCharVolatile_name, getChar_signature, F_RN) \ do_intrinsic(_getCharVolatile, jdk_internal_misc_Unsafe, getCharVolatile_name, getChar_signature, F_RN) \
do_intrinsic(_getIntVolatile, jdk_internal_misc_Unsafe, getIntVolatile_name, getInt_signature, F_RN) \ do_intrinsic(_getIntVolatile, jdk_internal_misc_Unsafe, getIntVolatile_name, getInt_signature, F_RN) \
do_intrinsic(_getLongVolatile, jdk_internal_misc_Unsafe, getLongVolatile_name, getLong_signature, F_RN) \ do_intrinsic(_getLongVolatile, jdk_internal_misc_Unsafe, getLongVolatile_name, getLong_signature, F_RN) \
do_intrinsic(_getFloatVolatile, jdk_internal_misc_Unsafe, getFloatVolatile_name, getFloat_signature, F_RN) \ do_intrinsic(_getFloatVolatile, jdk_internal_misc_Unsafe, getFloatVolatile_name, getFloat_signature, F_RN) \
do_intrinsic(_getDoubleVolatile, jdk_internal_misc_Unsafe, getDoubleVolatile_name, getDouble_signature, F_RN) \ do_intrinsic(_getDoubleVolatile, jdk_internal_misc_Unsafe, getDoubleVolatile_name, getDouble_signature, F_RN) \
do_intrinsic(_putObjectVolatile, jdk_internal_misc_Unsafe, putObjectVolatile_name, putObject_signature, F_RN) \ do_intrinsic(_putReferenceVolatile, jdk_internal_misc_Unsafe, putReferenceVolatile_name, putReference_signature, F_RN) \
do_intrinsic(_putBooleanVolatile, jdk_internal_misc_Unsafe, putBooleanVolatile_name, putBoolean_signature, F_RN) \ do_intrinsic(_putBooleanVolatile, jdk_internal_misc_Unsafe, putBooleanVolatile_name, putBoolean_signature, F_RN) \
do_intrinsic(_putByteVolatile, jdk_internal_misc_Unsafe, putByteVolatile_name, putByte_signature, F_RN) \ do_intrinsic(_putByteVolatile, jdk_internal_misc_Unsafe, putByteVolatile_name, putByte_signature, F_RN) \
do_intrinsic(_putShortVolatile, jdk_internal_misc_Unsafe, putShortVolatile_name, putShort_signature, F_RN) \ do_intrinsic(_putShortVolatile, jdk_internal_misc_Unsafe, putShortVolatile_name, putShort_signature, F_RN) \
do_intrinsic(_putCharVolatile, jdk_internal_misc_Unsafe, putCharVolatile_name, putChar_signature, F_RN) \ do_intrinsic(_putCharVolatile, jdk_internal_misc_Unsafe, putCharVolatile_name, putChar_signature, F_RN) \
do_intrinsic(_putIntVolatile, jdk_internal_misc_Unsafe, putIntVolatile_name, putInt_signature, F_RN) \ do_intrinsic(_putIntVolatile, jdk_internal_misc_Unsafe, putIntVolatile_name, putInt_signature, F_RN) \
do_intrinsic(_putLongVolatile, jdk_internal_misc_Unsafe, putLongVolatile_name, putLong_signature, F_RN) \ do_intrinsic(_putLongVolatile, jdk_internal_misc_Unsafe, putLongVolatile_name, putLong_signature, F_RN) \
do_intrinsic(_putFloatVolatile, jdk_internal_misc_Unsafe, putFloatVolatile_name, putFloat_signature, F_RN) \ do_intrinsic(_putFloatVolatile, jdk_internal_misc_Unsafe, putFloatVolatile_name, putFloat_signature, F_RN) \
do_intrinsic(_putDoubleVolatile, jdk_internal_misc_Unsafe, putDoubleVolatile_name, putDouble_signature, F_RN) \ do_intrinsic(_putDoubleVolatile, jdk_internal_misc_Unsafe, putDoubleVolatile_name, putDouble_signature, F_RN) \
\ \
do_name(getObjectOpaque_name,"getObjectOpaque") do_name(putObjectOpaque_name,"putObjectOpaque") \ do_name(getReferenceOpaque_name,"getReferenceOpaque") do_name(putReferenceOpaque_name,"putReferenceOpaque") \
do_name(getBooleanOpaque_name,"getBooleanOpaque") do_name(putBooleanOpaque_name,"putBooleanOpaque") \ do_name(getBooleanOpaque_name,"getBooleanOpaque") do_name(putBooleanOpaque_name,"putBooleanOpaque") \
do_name(getByteOpaque_name,"getByteOpaque") do_name(putByteOpaque_name,"putByteOpaque") \ do_name(getByteOpaque_name,"getByteOpaque") do_name(putByteOpaque_name,"putByteOpaque") \
do_name(getShortOpaque_name,"getShortOpaque") do_name(putShortOpaque_name,"putShortOpaque") \ do_name(getShortOpaque_name,"getShortOpaque") do_name(putShortOpaque_name,"putShortOpaque") \
do_name(getCharOpaque_name,"getCharOpaque") do_name(putCharOpaque_name,"putCharOpaque") \ do_name(getCharOpaque_name,"getCharOpaque") do_name(putCharOpaque_name,"putCharOpaque") \
do_name(getIntOpaque_name,"getIntOpaque") do_name(putIntOpaque_name,"putIntOpaque") \ do_name(getIntOpaque_name,"getIntOpaque") do_name(putIntOpaque_name,"putIntOpaque") \
do_name(getLongOpaque_name,"getLongOpaque") do_name(putLongOpaque_name,"putLongOpaque") \ do_name(getLongOpaque_name,"getLongOpaque") do_name(putLongOpaque_name,"putLongOpaque") \
do_name(getFloatOpaque_name,"getFloatOpaque") do_name(putFloatOpaque_name,"putFloatOpaque") \ do_name(getFloatOpaque_name,"getFloatOpaque") do_name(putFloatOpaque_name,"putFloatOpaque") \
do_name(getDoubleOpaque_name,"getDoubleOpaque") do_name(putDoubleOpaque_name,"putDoubleOpaque") \ do_name(getDoubleOpaque_name,"getDoubleOpaque") do_name(putDoubleOpaque_name,"putDoubleOpaque") \
\ \
do_intrinsic(_getObjectOpaque, jdk_internal_misc_Unsafe, getObjectOpaque_name, getObject_signature, F_R) \ do_intrinsic(_getReferenceOpaque, jdk_internal_misc_Unsafe, getReferenceOpaque_name, getReference_signature, F_R) \
do_intrinsic(_getBooleanOpaque, jdk_internal_misc_Unsafe, getBooleanOpaque_name, getBoolean_signature, F_R) \ do_intrinsic(_getBooleanOpaque, jdk_internal_misc_Unsafe, getBooleanOpaque_name, getBoolean_signature, F_R) \
do_intrinsic(_getByteOpaque, jdk_internal_misc_Unsafe, getByteOpaque_name, getByte_signature, F_R) \ do_intrinsic(_getByteOpaque, jdk_internal_misc_Unsafe, getByteOpaque_name, getByte_signature, F_R) \
do_intrinsic(_getShortOpaque, jdk_internal_misc_Unsafe, getShortOpaque_name, getShort_signature, F_R) \ do_intrinsic(_getShortOpaque, jdk_internal_misc_Unsafe, getShortOpaque_name, getShort_signature, F_R) \
do_intrinsic(_getCharOpaque, jdk_internal_misc_Unsafe, getCharOpaque_name, getChar_signature, F_R) \ do_intrinsic(_getCharOpaque, jdk_internal_misc_Unsafe, getCharOpaque_name, getChar_signature, F_R) \
do_intrinsic(_getIntOpaque, jdk_internal_misc_Unsafe, getIntOpaque_name, getInt_signature, F_R) \ do_intrinsic(_getIntOpaque, jdk_internal_misc_Unsafe, getIntOpaque_name, getInt_signature, F_R) \
do_intrinsic(_getLongOpaque, jdk_internal_misc_Unsafe, getLongOpaque_name, getLong_signature, F_R) \ do_intrinsic(_getLongOpaque, jdk_internal_misc_Unsafe, getLongOpaque_name, getLong_signature, F_R) \
do_intrinsic(_getFloatOpaque, jdk_internal_misc_Unsafe, getFloatOpaque_name, getFloat_signature, F_R) \ do_intrinsic(_getFloatOpaque, jdk_internal_misc_Unsafe, getFloatOpaque_name, getFloat_signature, F_R) \
do_intrinsic(_getDoubleOpaque, jdk_internal_misc_Unsafe, getDoubleOpaque_name, getDouble_signature, F_R) \ do_intrinsic(_getDoubleOpaque, jdk_internal_misc_Unsafe, getDoubleOpaque_name, getDouble_signature, F_R) \
do_intrinsic(_putObjectOpaque, jdk_internal_misc_Unsafe, putObjectOpaque_name, putObject_signature, F_R) \ do_intrinsic(_putReferenceOpaque, jdk_internal_misc_Unsafe, putReferenceOpaque_name, putReference_signature, F_R) \
do_intrinsic(_putBooleanOpaque, jdk_internal_misc_Unsafe, putBooleanOpaque_name, putBoolean_signature, F_R) \ do_intrinsic(_putBooleanOpaque, jdk_internal_misc_Unsafe, putBooleanOpaque_name, putBoolean_signature, F_R) \
do_intrinsic(_putByteOpaque, jdk_internal_misc_Unsafe, putByteOpaque_name, putByte_signature, F_R) \ do_intrinsic(_putByteOpaque, jdk_internal_misc_Unsafe, putByteOpaque_name, putByte_signature, F_R) \
do_intrinsic(_putShortOpaque, jdk_internal_misc_Unsafe, putShortOpaque_name, putShort_signature, F_R) \ do_intrinsic(_putShortOpaque, jdk_internal_misc_Unsafe, putShortOpaque_name, putShort_signature, F_R) \
do_intrinsic(_putCharOpaque, jdk_internal_misc_Unsafe, putCharOpaque_name, putChar_signature, F_R) \ do_intrinsic(_putCharOpaque, jdk_internal_misc_Unsafe, putCharOpaque_name, putChar_signature, F_R) \
do_intrinsic(_putIntOpaque, jdk_internal_misc_Unsafe, putIntOpaque_name, putInt_signature, F_R) \ do_intrinsic(_putIntOpaque, jdk_internal_misc_Unsafe, putIntOpaque_name, putInt_signature, F_R) \
do_intrinsic(_putLongOpaque, jdk_internal_misc_Unsafe, putLongOpaque_name, putLong_signature, F_R) \ do_intrinsic(_putLongOpaque, jdk_internal_misc_Unsafe, putLongOpaque_name, putLong_signature, F_R) \
do_intrinsic(_putFloatOpaque, jdk_internal_misc_Unsafe, putFloatOpaque_name, putFloat_signature, F_R) \ do_intrinsic(_putFloatOpaque, jdk_internal_misc_Unsafe, putFloatOpaque_name, putFloat_signature, F_R) \
do_intrinsic(_putDoubleOpaque, jdk_internal_misc_Unsafe, putDoubleOpaque_name, putDouble_signature, F_R) \ do_intrinsic(_putDoubleOpaque, jdk_internal_misc_Unsafe, putDoubleOpaque_name, putDouble_signature, F_R) \
\ \
do_name(getObjectAcquire_name, "getObjectAcquire") do_name(putObjectRelease_name, "putObjectRelease") \ do_name(getReferenceAcquire_name, "getReferenceAcquire") do_name(putReferenceRelease_name, "putReferenceRelease") \
do_name(getBooleanAcquire_name, "getBooleanAcquire") do_name(putBooleanRelease_name, "putBooleanRelease") \ do_name(getBooleanAcquire_name, "getBooleanAcquire") do_name(putBooleanRelease_name, "putBooleanRelease") \
do_name(getByteAcquire_name, "getByteAcquire") do_name(putByteRelease_name, "putByteRelease") \ do_name(getByteAcquire_name, "getByteAcquire") do_name(putByteRelease_name, "putByteRelease") \
do_name(getShortAcquire_name, "getShortAcquire") do_name(putShortRelease_name, "putShortRelease") \ do_name(getShortAcquire_name, "getShortAcquire") do_name(putShortRelease_name, "putShortRelease") \
do_name(getCharAcquire_name, "getCharAcquire") do_name(putCharRelease_name, "putCharRelease") \ do_name(getCharAcquire_name, "getCharAcquire") do_name(putCharRelease_name, "putCharRelease") \
do_name(getIntAcquire_name, "getIntAcquire") do_name(putIntRelease_name, "putIntRelease") \ do_name(getIntAcquire_name, "getIntAcquire") do_name(putIntRelease_name, "putIntRelease") \
do_name(getLongAcquire_name, "getLongAcquire") do_name(putLongRelease_name, "putLongRelease") \ do_name(getLongAcquire_name, "getLongAcquire") do_name(putLongRelease_name, "putLongRelease") \
do_name(getFloatAcquire_name, "getFloatAcquire") do_name(putFloatRelease_name, "putFloatRelease") \ do_name(getFloatAcquire_name, "getFloatAcquire") do_name(putFloatRelease_name, "putFloatRelease") \
do_name(getDoubleAcquire_name, "getDoubleAcquire") do_name(putDoubleRelease_name, "putDoubleRelease") \ do_name(getDoubleAcquire_name, "getDoubleAcquire") do_name(putDoubleRelease_name, "putDoubleRelease") \
\ \
do_intrinsic(_getObjectAcquire, jdk_internal_misc_Unsafe, getObjectAcquire_name, getObject_signature, F_R) \ do_intrinsic(_getReferenceAcquire, jdk_internal_misc_Unsafe, getReferenceAcquire_name, getReference_signature, F_R) \
do_intrinsic(_getBooleanAcquire, jdk_internal_misc_Unsafe, getBooleanAcquire_name, getBoolean_signature, F_R) \ do_intrinsic(_getBooleanAcquire, jdk_internal_misc_Unsafe, getBooleanAcquire_name, getBoolean_signature, F_R) \
do_intrinsic(_getByteAcquire, jdk_internal_misc_Unsafe, getByteAcquire_name, getByte_signature, F_R) \ do_intrinsic(_getByteAcquire, jdk_internal_misc_Unsafe, getByteAcquire_name, getByte_signature, F_R) \
do_intrinsic(_getShortAcquire, jdk_internal_misc_Unsafe, getShortAcquire_name, getShort_signature, F_R) \ do_intrinsic(_getShortAcquire, jdk_internal_misc_Unsafe, getShortAcquire_name, getShort_signature, F_R) \
do_intrinsic(_getCharAcquire, jdk_internal_misc_Unsafe, getCharAcquire_name, getChar_signature, F_R) \ do_intrinsic(_getCharAcquire, jdk_internal_misc_Unsafe, getCharAcquire_name, getChar_signature, F_R) \
do_intrinsic(_getIntAcquire, jdk_internal_misc_Unsafe, getIntAcquire_name, getInt_signature, F_R) \ do_intrinsic(_getIntAcquire, jdk_internal_misc_Unsafe, getIntAcquire_name, getInt_signature, F_R) \
do_intrinsic(_getLongAcquire, jdk_internal_misc_Unsafe, getLongAcquire_name, getLong_signature, F_R) \ do_intrinsic(_getLongAcquire, jdk_internal_misc_Unsafe, getLongAcquire_name, getLong_signature, F_R) \
do_intrinsic(_getFloatAcquire, jdk_internal_misc_Unsafe, getFloatAcquire_name, getFloat_signature, F_R) \ do_intrinsic(_getFloatAcquire, jdk_internal_misc_Unsafe, getFloatAcquire_name, getFloat_signature, F_R) \
do_intrinsic(_getDoubleAcquire, jdk_internal_misc_Unsafe, getDoubleAcquire_name, getDouble_signature, F_R) \ do_intrinsic(_getDoubleAcquire, jdk_internal_misc_Unsafe, getDoubleAcquire_name, getDouble_signature, F_R) \
do_intrinsic(_putObjectRelease, jdk_internal_misc_Unsafe, putObjectRelease_name, putObject_signature, F_R) \ do_intrinsic(_putReferenceRelease, jdk_internal_misc_Unsafe, putReferenceRelease_name, putReference_signature, F_R) \
do_intrinsic(_putBooleanRelease, jdk_internal_misc_Unsafe, putBooleanRelease_name, putBoolean_signature, F_R) \ do_intrinsic(_putBooleanRelease, jdk_internal_misc_Unsafe, putBooleanRelease_name, putBoolean_signature, F_R) \
do_intrinsic(_putByteRelease, jdk_internal_misc_Unsafe, putByteRelease_name, putByte_signature, F_R) \ do_intrinsic(_putByteRelease, jdk_internal_misc_Unsafe, putByteRelease_name, putByte_signature, F_R) \
do_intrinsic(_putShortRelease, jdk_internal_misc_Unsafe, putShortRelease_name, putShort_signature, F_R) \ do_intrinsic(_putShortRelease, jdk_internal_misc_Unsafe, putShortRelease_name, putShort_signature, F_R) \
do_intrinsic(_putCharRelease, jdk_internal_misc_Unsafe, putCharRelease_name, putChar_signature, F_R) \ do_intrinsic(_putCharRelease, jdk_internal_misc_Unsafe, putCharRelease_name, putChar_signature, F_R) \
do_intrinsic(_putIntRelease, jdk_internal_misc_Unsafe, putIntRelease_name, putInt_signature, F_R) \ do_intrinsic(_putIntRelease, jdk_internal_misc_Unsafe, putIntRelease_name, putInt_signature, F_R) \
do_intrinsic(_putLongRelease, jdk_internal_misc_Unsafe, putLongRelease_name, putLong_signature, F_R) \ do_intrinsic(_putLongRelease, jdk_internal_misc_Unsafe, putLongRelease_name, putLong_signature, F_R) \
do_intrinsic(_putFloatRelease, jdk_internal_misc_Unsafe, putFloatRelease_name, putFloat_signature, F_R) \ do_intrinsic(_putFloatRelease, jdk_internal_misc_Unsafe, putFloatRelease_name, putFloat_signature, F_R) \
do_intrinsic(_putDoubleRelease, jdk_internal_misc_Unsafe, putDoubleRelease_name, putDouble_signature, F_R) \ do_intrinsic(_putDoubleRelease, jdk_internal_misc_Unsafe, putDoubleRelease_name, putDouble_signature, F_R) \
\ \
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") \
@ -1233,8 +1233,8 @@
do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \ do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \
do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \ do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \
\ \
do_signature(compareAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \ do_signature(compareAndSetReference_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \ do_signature(compareAndExchangeReference_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \
do_signature(compareAndSetLong_signature, "(Ljava/lang/Object;JJJ)Z") \ do_signature(compareAndSetLong_signature, "(Ljava/lang/Object;JJJ)Z") \
do_signature(compareAndExchangeLong_signature, "(Ljava/lang/Object;JJJ)J") \ do_signature(compareAndExchangeLong_signature, "(Ljava/lang/Object;JJJ)J") \
do_signature(compareAndSetInt_signature, "(Ljava/lang/Object;JII)Z") \ do_signature(compareAndSetInt_signature, "(Ljava/lang/Object;JII)Z") \
@ -1244,52 +1244,52 @@
do_signature(compareAndSetShort_signature, "(Ljava/lang/Object;JSS)Z") \ do_signature(compareAndSetShort_signature, "(Ljava/lang/Object;JSS)Z") \
do_signature(compareAndExchangeShort_signature, "(Ljava/lang/Object;JSS)S") \ do_signature(compareAndExchangeShort_signature, "(Ljava/lang/Object;JSS)S") \
\ \
do_name(compareAndSetObject_name, "compareAndSetObject") \ do_name(compareAndSetReference_name, "compareAndSetReference") \
do_name(compareAndExchangeObject_name, "compareAndExchangeObject") \ do_name(compareAndExchangeReference_name, "compareAndExchangeReference") \
do_name(compareAndExchangeObjectAcquire_name, "compareAndExchangeObjectAcquire") \ do_name(compareAndExchangeReferenceAcquire_name, "compareAndExchangeReferenceAcquire") \
do_name(compareAndExchangeObjectRelease_name, "compareAndExchangeObjectRelease") \ do_name(compareAndExchangeReferenceRelease_name, "compareAndExchangeReferenceRelease") \
do_name(compareAndSetLong_name, "compareAndSetLong") \ do_name(compareAndSetLong_name, "compareAndSetLong") \
do_name(compareAndExchangeLong_name, "compareAndExchangeLong") \ do_name(compareAndExchangeLong_name, "compareAndExchangeLong") \
do_name(compareAndExchangeLongAcquire_name, "compareAndExchangeLongAcquire") \ do_name(compareAndExchangeLongAcquire_name, "compareAndExchangeLongAcquire") \
do_name(compareAndExchangeLongRelease_name, "compareAndExchangeLongRelease") \ do_name(compareAndExchangeLongRelease_name, "compareAndExchangeLongRelease") \
do_name(compareAndSetInt_name, "compareAndSetInt") \ do_name(compareAndSetInt_name, "compareAndSetInt") \
do_name(compareAndExchangeInt_name, "compareAndExchangeInt") \ do_name(compareAndExchangeInt_name, "compareAndExchangeInt") \
do_name(compareAndExchangeIntAcquire_name, "compareAndExchangeIntAcquire") \ do_name(compareAndExchangeIntAcquire_name, "compareAndExchangeIntAcquire") \
do_name(compareAndExchangeIntRelease_name, "compareAndExchangeIntRelease") \ do_name(compareAndExchangeIntRelease_name, "compareAndExchangeIntRelease") \
do_name(compareAndSetByte_name, "compareAndSetByte") \ do_name(compareAndSetByte_name, "compareAndSetByte") \
do_name(compareAndExchangeByte_name, "compareAndExchangeByte") \ do_name(compareAndExchangeByte_name, "compareAndExchangeByte") \
do_name(compareAndExchangeByteAcquire_name, "compareAndExchangeByteAcquire") \ do_name(compareAndExchangeByteAcquire_name, "compareAndExchangeByteAcquire") \
do_name(compareAndExchangeByteRelease_name, "compareAndExchangeByteRelease") \ do_name(compareAndExchangeByteRelease_name, "compareAndExchangeByteRelease") \
do_name(compareAndSetShort_name, "compareAndSetShort") \ do_name(compareAndSetShort_name, "compareAndSetShort") \
do_name(compareAndExchangeShort_name, "compareAndExchangeShort") \ do_name(compareAndExchangeShort_name, "compareAndExchangeShort") \
do_name(compareAndExchangeShortAcquire_name, "compareAndExchangeShortAcquire") \ do_name(compareAndExchangeShortAcquire_name, "compareAndExchangeShortAcquire") \
do_name(compareAndExchangeShortRelease_name, "compareAndExchangeShortRelease") \ do_name(compareAndExchangeShortRelease_name, "compareAndExchangeShortRelease") \
\ \
do_name(weakCompareAndSetObjectPlain_name, "weakCompareAndSetObjectPlain") \ do_name(weakCompareAndSetReferencePlain_name, "weakCompareAndSetReferencePlain") \
do_name(weakCompareAndSetObjectAcquire_name, "weakCompareAndSetObjectAcquire") \ do_name(weakCompareAndSetReferenceAcquire_name, "weakCompareAndSetReferenceAcquire") \
do_name(weakCompareAndSetObjectRelease_name, "weakCompareAndSetObjectRelease") \ do_name(weakCompareAndSetReferenceRelease_name, "weakCompareAndSetReferenceRelease") \
do_name(weakCompareAndSetObject_name, "weakCompareAndSetObject") \ do_name(weakCompareAndSetReference_name, "weakCompareAndSetReference") \
do_name(weakCompareAndSetLongPlain_name, "weakCompareAndSetLongPlain") \ do_name(weakCompareAndSetLongPlain_name, "weakCompareAndSetLongPlain") \
do_name(weakCompareAndSetLongAcquire_name, "weakCompareAndSetLongAcquire") \ do_name(weakCompareAndSetLongAcquire_name, "weakCompareAndSetLongAcquire") \
do_name(weakCompareAndSetLongRelease_name, "weakCompareAndSetLongRelease") \ do_name(weakCompareAndSetLongRelease_name, "weakCompareAndSetLongRelease") \
do_name(weakCompareAndSetLong_name, "weakCompareAndSetLong") \ do_name(weakCompareAndSetLong_name, "weakCompareAndSetLong") \
do_name(weakCompareAndSetIntPlain_name, "weakCompareAndSetIntPlain") \ do_name(weakCompareAndSetIntPlain_name, "weakCompareAndSetIntPlain") \
do_name(weakCompareAndSetIntAcquire_name, "weakCompareAndSetIntAcquire") \ do_name(weakCompareAndSetIntAcquire_name, "weakCompareAndSetIntAcquire") \
do_name(weakCompareAndSetIntRelease_name, "weakCompareAndSetIntRelease") \ do_name(weakCompareAndSetIntRelease_name, "weakCompareAndSetIntRelease") \
do_name(weakCompareAndSetInt_name, "weakCompareAndSetInt") \ do_name(weakCompareAndSetInt_name, "weakCompareAndSetInt") \
do_name(weakCompareAndSetBytePlain_name, "weakCompareAndSetBytePlain") \ do_name(weakCompareAndSetBytePlain_name, "weakCompareAndSetBytePlain") \
do_name(weakCompareAndSetByteAcquire_name, "weakCompareAndSetByteAcquire") \ do_name(weakCompareAndSetByteAcquire_name, "weakCompareAndSetByteAcquire") \
do_name(weakCompareAndSetByteRelease_name, "weakCompareAndSetByteRelease") \ do_name(weakCompareAndSetByteRelease_name, "weakCompareAndSetByteRelease") \
do_name(weakCompareAndSetByte_name, "weakCompareAndSetByte") \ do_name(weakCompareAndSetByte_name, "weakCompareAndSetByte") \
do_name(weakCompareAndSetShortPlain_name, "weakCompareAndSetShortPlain") \ do_name(weakCompareAndSetShortPlain_name, "weakCompareAndSetShortPlain") \
do_name(weakCompareAndSetShortAcquire_name, "weakCompareAndSetShortAcquire") \ do_name(weakCompareAndSetShortAcquire_name, "weakCompareAndSetShortAcquire") \
do_name(weakCompareAndSetShortRelease_name, "weakCompareAndSetShortRelease") \ do_name(weakCompareAndSetShortRelease_name, "weakCompareAndSetShortRelease") \
do_name(weakCompareAndSetShort_name, "weakCompareAndSetShort") \ do_name(weakCompareAndSetShort_name, "weakCompareAndSetShort") \
\ \
do_intrinsic(_compareAndSetObject, jdk_internal_misc_Unsafe, compareAndSetObject_name, compareAndSetObject_signature, F_RN) \ do_intrinsic(_compareAndSetReference, jdk_internal_misc_Unsafe, compareAndSetReference_name, compareAndSetReference_signature, F_RN) \
do_intrinsic(_compareAndExchangeObject, jdk_internal_misc_Unsafe, compareAndExchangeObject_name, compareAndExchangeObject_signature, F_RN) \ do_intrinsic(_compareAndExchangeReference, jdk_internal_misc_Unsafe, compareAndExchangeReference_name, compareAndExchangeReference_signature, F_RN) \
do_intrinsic(_compareAndExchangeObjectAcquire, jdk_internal_misc_Unsafe, compareAndExchangeObjectAcquire_name, compareAndExchangeObject_signature, F_R) \ do_intrinsic(_compareAndExchangeReferenceAcquire, jdk_internal_misc_Unsafe, compareAndExchangeReferenceAcquire_name, compareAndExchangeReference_signature, F_R) \
do_intrinsic(_compareAndExchangeObjectRelease, jdk_internal_misc_Unsafe, compareAndExchangeObjectRelease_name, compareAndExchangeObject_signature, F_R) \ do_intrinsic(_compareAndExchangeReferenceRelease, jdk_internal_misc_Unsafe, compareAndExchangeReferenceRelease_name, compareAndExchangeReference_signature, F_R) \
do_intrinsic(_compareAndSetLong, jdk_internal_misc_Unsafe, compareAndSetLong_name, compareAndSetLong_signature, F_RN) \ do_intrinsic(_compareAndSetLong, jdk_internal_misc_Unsafe, compareAndSetLong_name, compareAndSetLong_signature, F_RN) \
do_intrinsic(_compareAndExchangeLong, jdk_internal_misc_Unsafe, compareAndExchangeLong_name, compareAndExchangeLong_signature, F_RN) \ do_intrinsic(_compareAndExchangeLong, jdk_internal_misc_Unsafe, compareAndExchangeLong_name, compareAndExchangeLong_signature, F_RN) \
do_intrinsic(_compareAndExchangeLongAcquire, jdk_internal_misc_Unsafe, compareAndExchangeLongAcquire_name, compareAndExchangeLong_signature, F_R) \ do_intrinsic(_compareAndExchangeLongAcquire, jdk_internal_misc_Unsafe, compareAndExchangeLongAcquire_name, compareAndExchangeLong_signature, F_R) \
@ -1307,10 +1307,10 @@
do_intrinsic(_compareAndExchangeShortAcquire, jdk_internal_misc_Unsafe, compareAndExchangeShortAcquire_name, compareAndExchangeShort_signature, F_R) \ do_intrinsic(_compareAndExchangeShortAcquire, jdk_internal_misc_Unsafe, compareAndExchangeShortAcquire_name, compareAndExchangeShort_signature, F_R) \
do_intrinsic(_compareAndExchangeShortRelease, jdk_internal_misc_Unsafe, compareAndExchangeShortRelease_name, compareAndExchangeShort_signature, F_R) \ do_intrinsic(_compareAndExchangeShortRelease, jdk_internal_misc_Unsafe, compareAndExchangeShortRelease_name, compareAndExchangeShort_signature, F_R) \
\ \
do_intrinsic(_weakCompareAndSetObjectPlain, jdk_internal_misc_Unsafe, weakCompareAndSetObjectPlain_name, compareAndSetObject_signature, F_R) \ do_intrinsic(_weakCompareAndSetReferencePlain, jdk_internal_misc_Unsafe, weakCompareAndSetReferencePlain_name, compareAndSetReference_signature, F_R) \
do_intrinsic(_weakCompareAndSetObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetObjectAcquire_name, compareAndSetObject_signature, F_R) \ do_intrinsic(_weakCompareAndSetReferenceAcquire,jdk_internal_misc_Unsafe, weakCompareAndSetReferenceAcquire_name, compareAndSetReference_signature, F_R) \
do_intrinsic(_weakCompareAndSetObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSetObjectRelease_name, compareAndSetObject_signature, F_R) \ do_intrinsic(_weakCompareAndSetReferenceRelease,jdk_internal_misc_Unsafe, weakCompareAndSetReferenceRelease_name, compareAndSetReference_signature, F_R) \
do_intrinsic(_weakCompareAndSetObject, jdk_internal_misc_Unsafe, weakCompareAndSetObject_name, compareAndSetObject_signature, F_R) \ do_intrinsic(_weakCompareAndSetReference, jdk_internal_misc_Unsafe, weakCompareAndSetReference_name, compareAndSetReference_signature, F_R) \
do_intrinsic(_weakCompareAndSetLongPlain, jdk_internal_misc_Unsafe, weakCompareAndSetLongPlain_name, compareAndSetLong_signature, F_R) \ do_intrinsic(_weakCompareAndSetLongPlain, jdk_internal_misc_Unsafe, weakCompareAndSetLongPlain_name, compareAndSetLong_signature, F_R) \
do_intrinsic(_weakCompareAndSetLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetLongAcquire_name, compareAndSetLong_signature, F_R) \ do_intrinsic(_weakCompareAndSetLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetLongAcquire_name, compareAndSetLong_signature, F_R) \
do_intrinsic(_weakCompareAndSetLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSetLongRelease_name, compareAndSetLong_signature, F_R) \ do_intrinsic(_weakCompareAndSetLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSetLongRelease_name, compareAndSetLong_signature, F_R) \
@ -1352,9 +1352,9 @@
do_intrinsic(_getAndSetShort, jdk_internal_misc_Unsafe, getAndSetShort_name, getAndSetShort_signature, F_R) \ do_intrinsic(_getAndSetShort, jdk_internal_misc_Unsafe, getAndSetShort_name, getAndSetShort_signature, F_R) \
do_name( getAndSetShort_name, "getAndSetShort") \ do_name( getAndSetShort_name, "getAndSetShort") \
do_alias( getAndSetShort_signature, /*"(Ljava/lang/Object;JS)S"*/ getAndAddShort_signature) \ do_alias( getAndSetShort_signature, /*"(Ljava/lang/Object;JS)S"*/ getAndAddShort_signature) \
do_intrinsic(_getAndSetObject, jdk_internal_misc_Unsafe, getAndSetObject_name, getAndSetObject_signature, F_R)\ do_intrinsic(_getAndSetReference, jdk_internal_misc_Unsafe, getAndSetReference_name, getAndSetReference_signature, F_R) \
do_name( getAndSetObject_name, "getAndSetObject") \ do_name( getAndSetReference_name, "getAndSetReference") \
do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \ do_signature(getAndSetReference_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
\ \
/* (2) Bytecode intrinsics */ \ /* (2) Bytecode intrinsics */ \
\ \
@ -1541,7 +1541,7 @@ class vmIntrinsics: AllStatic {
#undef VM_INTRINSIC_ENUM #undef VM_INTRINSIC_ENUM
ID_LIMIT, ID_LIMIT,
LAST_COMPILER_INLINE = _getAndSetObject, LAST_COMPILER_INLINE = _getAndSetReference,
FIRST_MH_SIG_POLY = _invokeGeneric, FIRST_MH_SIG_POLY = _invokeGeneric,
FIRST_MH_STATIC = _linkToVirtual, FIRST_MH_STATIC = _linkToVirtual,
LAST_MH_SIG_POLY = _linkToInterface, LAST_MH_SIG_POLY = _linkToInterface,

View file

@ -76,7 +76,7 @@ protected:
// Helper for unsafe accesses, that may or may not be on the referent field. // Helper for unsafe accesses, that may or may not be on the referent field.
// Generates the guards that check whether the result of // Generates the guards that check whether the result of
// Unsafe.getObject should be recorded in an SATB log buffer. // Unsafe.getReference should be recorded in an SATB log buffer.
void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) const; void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) const;
static const TypeFunc* write_ref_field_pre_entry_Type(); static const TypeFunc* write_ref_field_pre_entry_Type();

View file

@ -25,6 +25,7 @@
#ifndef SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP #ifndef SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
#define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1ParScanThreadState.hpp" #include "gc/g1/g1ParScanThreadState.hpp"
#include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1RemSet.hpp"
#include "oops/access.inline.hpp" #include "oops/access.inline.hpp"
@ -40,21 +41,25 @@ template <class T> void G1ParScanThreadState::do_oop_evac(T* p) {
// processed multiple times, and so we might get references into old gen here. // processed multiple times, and so we might get references into old gen here.
// So we need to redo this check. // So we need to redo this check.
const InCSetState in_cset_state = _g1h->in_cset_state(obj); const InCSetState in_cset_state = _g1h->in_cset_state(obj);
if (in_cset_state.is_in_cset()) { // References pushed onto the work stack should never point to a humongous region
markOop m = obj->mark_raw(); // as they are not added to the collection set due to above precondition.
if (m->is_marked()) { assert(!in_cset_state.is_humongous(),
obj = (oop) m->decode_pointer(); "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
} else { p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));
obj = copy_to_survivor_space(in_cset_state, obj, m);
} if (!in_cset_state.is_in_cset()) {
RawAccess<IS_NOT_NULL>::oop_store(p, obj); // In this case somebody else already did all the work.
} else if (in_cset_state.is_humongous()) { return;
_g1h->set_humongous_is_live(obj);
} else {
assert(in_cset_state.is_default(),
"In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value());
} }
markOop m = obj->mark_raw();
if (m->is_marked()) {
obj = (oop) m->decode_pointer();
} else {
obj = copy_to_survivor_space(in_cset_state, obj, m);
}
RawAccess<IS_NOT_NULL>::oop_store(p, obj);
assert(obj != NULL, "Must be"); assert(obj != NULL, "Must be");
if (!HeapRegion::is_in_same_region(p, obj)) { if (!HeapRegion::is_in_same_region(p, obj)) {
HeapRegion* from = _g1h->heap_region_containing(p); HeapRegion* from = _g1h->heap_region_containing(p);

View file

@ -213,8 +213,8 @@ public:
virtual void register_potential_barrier_node(Node* node) const { } virtual void register_potential_barrier_node(Node* node) const { }
virtual void unregister_potential_barrier_node(Node* node) const { } virtual void unregister_potential_barrier_node(Node* node) const { }
virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { } virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { }
virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const {} virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const {}
virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful) const {} virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const {}
virtual void add_users_to_worklist(Unique_Node_List* worklist) const {} virtual void add_users_to_worklist(Unique_Node_List* worklist) const {}
// Allow barrier sets to have shared state that is preserved across a compilation unit. // Allow barrier sets to have shared state that is preserved across a compilation unit.

View file

@ -102,7 +102,7 @@ void ZBarrierSetC2::unregister_potential_barrier_node(Node* node) const {
} }
} }
void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful) const { void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const {
// Remove useless LoadBarrier nodes // Remove useless LoadBarrier nodes
ZBarrierSetC2State* s = state(); ZBarrierSetC2State* s = state();
for (int i = s->load_barrier_count()-1; i >= 0; i--) { for (int i = s->load_barrier_count()-1; i >= 0; i--) {
@ -113,9 +113,9 @@ void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful) cons
} }
} }
void ZBarrierSetC2::enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const { void ZBarrierSetC2::enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const {
if (node->is_LoadBarrier() && !node->as_LoadBarrier()->has_true_uses()) { if (node->is_LoadBarrier() && !node->as_LoadBarrier()->has_true_uses()) {
worklist.push(node); igvn->_worklist.push(node);
} }
} }

View file

@ -189,9 +189,9 @@ public:
virtual bool has_load_barriers() const { return true; } virtual bool has_load_barriers() const { return true; }
virtual bool is_gc_barrier_node(Node* node) const; virtual bool is_gc_barrier_node(Node* node) const;
virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { } virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { }
virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful) const; virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const;
virtual void add_users_to_worklist(Unique_Node_List* worklist) const; virtual void add_users_to_worklist(Unique_Node_List* worklist) const;
virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const; virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const;
virtual void register_potential_barrier_node(Node* node) const; virtual void register_potential_barrier_node(Node* node) const;
virtual void unregister_potential_barrier_node(Node* node) const; virtual void unregister_potential_barrier_node(Node* node) const;
virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const; virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;

View file

@ -367,7 +367,7 @@ void JfrCheckpointManager::write_type_set() {
} }
void JfrCheckpointManager::write_type_set_for_unloaded_classes() { void JfrCheckpointManager::write_type_set_for_unloaded_classes() {
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!"); assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
JfrTypeManager::write_type_set_for_unloaded_classes(); JfrTypeManager::write_type_set_for_unloaded_classes();
} }

View file

@ -158,7 +158,7 @@ void JfrTypeManager::write_type_set() {
} }
void JfrTypeManager::write_type_set_for_unloaded_classes() { void JfrTypeManager::write_type_set_for_unloaded_classes() {
assert(SafepointSynchronize::is_at_safepoint(), "invariant"); assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
JfrCheckpointWriter writer(false, true, Thread::current()); JfrCheckpointWriter writer(false, true, Thread::current());
ClassUnloadTypeSet class_unload_set; ClassUnloadTypeSet class_unload_set;
class_unload_set.serialize(writer); class_unload_set.serialize(writer);

View file

@ -61,11 +61,9 @@ class ArrayKlass: public Klass {
inline Klass* higher_dimension_acquire() const; // load with acquire semantics inline Klass* higher_dimension_acquire() const; // load with acquire semantics
void set_higher_dimension(Klass* k) { _higher_dimension = k; } void set_higher_dimension(Klass* k) { _higher_dimension = k; }
inline void release_set_higher_dimension(Klass* k); // store with release semantics inline void release_set_higher_dimension(Klass* k); // store with release semantics
Klass** adr_higher_dimension() { return (Klass**)&this->_higher_dimension;}
Klass* lower_dimension() const { return _lower_dimension; } Klass* lower_dimension() const { return _lower_dimension; }
void set_lower_dimension(Klass* k) { _lower_dimension = k; } void set_lower_dimension(Klass* k) { _lower_dimension = k; }
Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;}
// offset of first element, including any padding for the sake of alignment // offset of first element, including any padding for the sake of alignment
int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); } int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); }

View file

@ -248,7 +248,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
break; break;
/* CompareAndSet, Object: */ /* CompareAndSet, Object: */
case vmIntrinsics::_compareAndSetObject: case vmIntrinsics::_compareAndSetReference:
#ifdef _LP64 #ifdef _LP64
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false; if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false;
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
@ -256,10 +256,10 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
#endif #endif
break; break;
case vmIntrinsics::_weakCompareAndSetObjectPlain: case vmIntrinsics::_weakCompareAndSetReferencePlain:
case vmIntrinsics::_weakCompareAndSetObjectAcquire: case vmIntrinsics::_weakCompareAndSetReferenceAcquire:
case vmIntrinsics::_weakCompareAndSetObjectRelease: case vmIntrinsics::_weakCompareAndSetReferenceRelease:
case vmIntrinsics::_weakCompareAndSetObject: case vmIntrinsics::_weakCompareAndSetReference:
#ifdef _LP64 #ifdef _LP64
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false; if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false;
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
@ -312,9 +312,9 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
break; break;
/* CompareAndExchange, Object: */ /* CompareAndExchange, Object: */
case vmIntrinsics::_compareAndExchangeObject: case vmIntrinsics::_compareAndExchangeReference:
case vmIntrinsics::_compareAndExchangeObjectAcquire: case vmIntrinsics::_compareAndExchangeReferenceAcquire:
case vmIntrinsics::_compareAndExchangeObjectRelease: case vmIntrinsics::_compareAndExchangeReferenceRelease:
#ifdef _LP64 #ifdef _LP64
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeN)) return false; if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeN)) return false;
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false;
@ -376,7 +376,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_getAndSetLong: case vmIntrinsics::_getAndSetLong:
if (!Matcher::match_rule_supported(Op_GetAndSetL)) return false; if (!Matcher::match_rule_supported(Op_GetAndSetL)) return false;
break; break;
case vmIntrinsics::_getAndSetObject: case vmIntrinsics::_getAndSetReference:
#ifdef _LP64 #ifdef _LP64
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return false; if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return false;
if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return false; if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return false;
@ -455,7 +455,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_getCharsStringU: case vmIntrinsics::_getCharsStringU:
case vmIntrinsics::_getCharStringU: case vmIntrinsics::_getCharStringU:
case vmIntrinsics::_putCharStringU: case vmIntrinsics::_putCharStringU:
case vmIntrinsics::_getObject: case vmIntrinsics::_getReference:
case vmIntrinsics::_getBoolean: case vmIntrinsics::_getBoolean:
case vmIntrinsics::_getByte: case vmIntrinsics::_getByte:
case vmIntrinsics::_getShort: case vmIntrinsics::_getShort:
@ -464,7 +464,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_getLong: case vmIntrinsics::_getLong:
case vmIntrinsics::_getFloat: case vmIntrinsics::_getFloat:
case vmIntrinsics::_getDouble: case vmIntrinsics::_getDouble:
case vmIntrinsics::_putObject: case vmIntrinsics::_putReference:
case vmIntrinsics::_putBoolean: case vmIntrinsics::_putBoolean:
case vmIntrinsics::_putByte: case vmIntrinsics::_putByte:
case vmIntrinsics::_putShort: case vmIntrinsics::_putShort:
@ -473,7 +473,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_putLong: case vmIntrinsics::_putLong:
case vmIntrinsics::_putFloat: case vmIntrinsics::_putFloat:
case vmIntrinsics::_putDouble: case vmIntrinsics::_putDouble:
case vmIntrinsics::_getObjectVolatile: case vmIntrinsics::_getReferenceVolatile:
case vmIntrinsics::_getBooleanVolatile: case vmIntrinsics::_getBooleanVolatile:
case vmIntrinsics::_getByteVolatile: case vmIntrinsics::_getByteVolatile:
case vmIntrinsics::_getShortVolatile: case vmIntrinsics::_getShortVolatile:
@ -482,7 +482,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_getLongVolatile: case vmIntrinsics::_getLongVolatile:
case vmIntrinsics::_getFloatVolatile: case vmIntrinsics::_getFloatVolatile:
case vmIntrinsics::_getDoubleVolatile: case vmIntrinsics::_getDoubleVolatile:
case vmIntrinsics::_putObjectVolatile: case vmIntrinsics::_putReferenceVolatile:
case vmIntrinsics::_putBooleanVolatile: case vmIntrinsics::_putBooleanVolatile:
case vmIntrinsics::_putByteVolatile: case vmIntrinsics::_putByteVolatile:
case vmIntrinsics::_putShortVolatile: case vmIntrinsics::_putShortVolatile:
@ -491,7 +491,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_putLongVolatile: case vmIntrinsics::_putLongVolatile:
case vmIntrinsics::_putFloatVolatile: case vmIntrinsics::_putFloatVolatile:
case vmIntrinsics::_putDoubleVolatile: case vmIntrinsics::_putDoubleVolatile:
case vmIntrinsics::_getObjectAcquire: case vmIntrinsics::_getReferenceAcquire:
case vmIntrinsics::_getBooleanAcquire: case vmIntrinsics::_getBooleanAcquire:
case vmIntrinsics::_getByteAcquire: case vmIntrinsics::_getByteAcquire:
case vmIntrinsics::_getShortAcquire: case vmIntrinsics::_getShortAcquire:
@ -500,7 +500,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_getLongAcquire: case vmIntrinsics::_getLongAcquire:
case vmIntrinsics::_getFloatAcquire: case vmIntrinsics::_getFloatAcquire:
case vmIntrinsics::_getDoubleAcquire: case vmIntrinsics::_getDoubleAcquire:
case vmIntrinsics::_putObjectRelease: case vmIntrinsics::_putReferenceRelease:
case vmIntrinsics::_putBooleanRelease: case vmIntrinsics::_putBooleanRelease:
case vmIntrinsics::_putByteRelease: case vmIntrinsics::_putByteRelease:
case vmIntrinsics::_putShortRelease: case vmIntrinsics::_putShortRelease:
@ -509,7 +509,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_putLongRelease: case vmIntrinsics::_putLongRelease:
case vmIntrinsics::_putFloatRelease: case vmIntrinsics::_putFloatRelease:
case vmIntrinsics::_putDoubleRelease: case vmIntrinsics::_putDoubleRelease:
case vmIntrinsics::_getObjectOpaque: case vmIntrinsics::_getReferenceOpaque:
case vmIntrinsics::_getBooleanOpaque: case vmIntrinsics::_getBooleanOpaque:
case vmIntrinsics::_getByteOpaque: case vmIntrinsics::_getByteOpaque:
case vmIntrinsics::_getShortOpaque: case vmIntrinsics::_getShortOpaque:
@ -518,7 +518,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_getLongOpaque: case vmIntrinsics::_getLongOpaque:
case vmIntrinsics::_getFloatOpaque: case vmIntrinsics::_getFloatOpaque:
case vmIntrinsics::_getDoubleOpaque: case vmIntrinsics::_getDoubleOpaque:
case vmIntrinsics::_putObjectOpaque: case vmIntrinsics::_putReferenceOpaque:
case vmIntrinsics::_putBooleanOpaque: case vmIntrinsics::_putBooleanOpaque:
case vmIntrinsics::_putByteOpaque: case vmIntrinsics::_putByteOpaque:
case vmIntrinsics::_putShortOpaque: case vmIntrinsics::_putShortOpaque:

View file

@ -24,6 +24,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "classfile/systemDictionary.hpp" #include "classfile/systemDictionary.hpp"
#include "gc/shared/c2/barrierSetC2.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "oops/objArrayKlass.hpp" #include "oops/objArrayKlass.hpp"
@ -1447,7 +1448,10 @@ static Node *is_x2logic( PhaseGVN *phase, PhiNode *phi, int true_path ) {
} else return NULL; } else return NULL;
// Build int->bool conversion // Build int->bool conversion
Node *n = new Conv2BNode( cmp->in(1) ); Node *in1 = cmp->in(1);
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
in1 = bs->step_over_gc_barrier(in1);
Node *n = new Conv2BNode(in1);
if( flipped ) if( flipped )
n = new XorINode( phase->transform(n), phase->intcon(1) ); n = new XorINode( phase->transform(n), phase->intcon(1) );
@ -1813,7 +1817,12 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (can_reshape && igvn != NULL) { if (can_reshape && igvn != NULL) {
igvn->_worklist.push(r); igvn->_worklist.push(r);
} }
set_req(j, top); // Nuke it down // Nuke it down
if (can_reshape) {
set_req_X(j, top, igvn);
} else {
set_req(j, top);
}
progress = this; // Record progress progress = this; // Record progress
} }
} }

View file

@ -421,7 +421,7 @@ void Compile::remove_useless_nodes(Unique_Node_List &useful) {
} }
} }
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
bs->eliminate_useless_gc_barriers(useful); bs->eliminate_useless_gc_barriers(useful, this);
// clean up the late inline lists // clean up the late inline lists
remove_useless_late_inlines(&_string_late_inlines, useful); remove_useless_late_inlines(&_string_late_inlines, useful);
remove_useless_late_inlines(&_boxing_late_inlines, useful); remove_useless_late_inlines(&_boxing_late_inlines, useful);

View file

@ -3726,6 +3726,10 @@ AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
if (ptr == NULL) { // reduce dumb test in callers if (ptr == NULL) { // reduce dumb test in callers
return NULL; return NULL;
} }
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
ptr = bs->step_over_gc_barrier(ptr);
if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
ptr = ptr->in(1); ptr = ptr->in(1);
if (ptr == NULL) return NULL; if (ptr == NULL) return NULL;

View file

@ -587,7 +587,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_inflateStringC: case vmIntrinsics::_inflateStringC:
case vmIntrinsics::_inflateStringB: return inline_string_copy(!is_compress); case vmIntrinsics::_inflateStringB: return inline_string_copy(!is_compress);
case vmIntrinsics::_getObject: return inline_unsafe_access(!is_store, T_OBJECT, Relaxed, false); case vmIntrinsics::_getReference: return inline_unsafe_access(!is_store, T_OBJECT, Relaxed, false);
case vmIntrinsics::_getBoolean: return inline_unsafe_access(!is_store, T_BOOLEAN, Relaxed, false); case vmIntrinsics::_getBoolean: return inline_unsafe_access(!is_store, T_BOOLEAN, Relaxed, false);
case vmIntrinsics::_getByte: return inline_unsafe_access(!is_store, T_BYTE, Relaxed, false); case vmIntrinsics::_getByte: return inline_unsafe_access(!is_store, T_BYTE, Relaxed, false);
case vmIntrinsics::_getShort: return inline_unsafe_access(!is_store, T_SHORT, Relaxed, false); case vmIntrinsics::_getShort: return inline_unsafe_access(!is_store, T_SHORT, Relaxed, false);
@ -597,7 +597,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_store, T_FLOAT, Relaxed, false); case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_store, T_FLOAT, Relaxed, false);
case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_store, T_DOUBLE, Relaxed, false); case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_store, T_DOUBLE, Relaxed, false);
case vmIntrinsics::_putObject: return inline_unsafe_access( is_store, T_OBJECT, Relaxed, false); case vmIntrinsics::_putReference: return inline_unsafe_access( is_store, T_OBJECT, Relaxed, false);
case vmIntrinsics::_putBoolean: return inline_unsafe_access( is_store, T_BOOLEAN, Relaxed, false); case vmIntrinsics::_putBoolean: return inline_unsafe_access( is_store, T_BOOLEAN, Relaxed, false);
case vmIntrinsics::_putByte: return inline_unsafe_access( is_store, T_BYTE, Relaxed, false); case vmIntrinsics::_putByte: return inline_unsafe_access( is_store, T_BYTE, Relaxed, false);
case vmIntrinsics::_putShort: return inline_unsafe_access( is_store, T_SHORT, Relaxed, false); case vmIntrinsics::_putShort: return inline_unsafe_access( is_store, T_SHORT, Relaxed, false);
@ -607,7 +607,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_putFloat: return inline_unsafe_access( is_store, T_FLOAT, Relaxed, false); case vmIntrinsics::_putFloat: return inline_unsafe_access( is_store, T_FLOAT, Relaxed, false);
case vmIntrinsics::_putDouble: return inline_unsafe_access( is_store, T_DOUBLE, Relaxed, false); case vmIntrinsics::_putDouble: return inline_unsafe_access( is_store, T_DOUBLE, Relaxed, false);
case vmIntrinsics::_getObjectVolatile: return inline_unsafe_access(!is_store, T_OBJECT, Volatile, false); case vmIntrinsics::_getReferenceVolatile: return inline_unsafe_access(!is_store, T_OBJECT, Volatile, false);
case vmIntrinsics::_getBooleanVolatile: return inline_unsafe_access(!is_store, T_BOOLEAN, Volatile, false); case vmIntrinsics::_getBooleanVolatile: return inline_unsafe_access(!is_store, T_BOOLEAN, Volatile, false);
case vmIntrinsics::_getByteVolatile: return inline_unsafe_access(!is_store, T_BYTE, Volatile, false); case vmIntrinsics::_getByteVolatile: return inline_unsafe_access(!is_store, T_BYTE, Volatile, false);
case vmIntrinsics::_getShortVolatile: return inline_unsafe_access(!is_store, T_SHORT, Volatile, false); case vmIntrinsics::_getShortVolatile: return inline_unsafe_access(!is_store, T_SHORT, Volatile, false);
@ -617,7 +617,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_getFloatVolatile: return inline_unsafe_access(!is_store, T_FLOAT, Volatile, false); case vmIntrinsics::_getFloatVolatile: return inline_unsafe_access(!is_store, T_FLOAT, Volatile, false);
case vmIntrinsics::_getDoubleVolatile: return inline_unsafe_access(!is_store, T_DOUBLE, Volatile, false); case vmIntrinsics::_getDoubleVolatile: return inline_unsafe_access(!is_store, T_DOUBLE, Volatile, false);
case vmIntrinsics::_putObjectVolatile: return inline_unsafe_access( is_store, T_OBJECT, Volatile, false); case vmIntrinsics::_putReferenceVolatile: return inline_unsafe_access( is_store, T_OBJECT, Volatile, false);
case vmIntrinsics::_putBooleanVolatile: return inline_unsafe_access( is_store, T_BOOLEAN, Volatile, false); case vmIntrinsics::_putBooleanVolatile: return inline_unsafe_access( is_store, T_BOOLEAN, Volatile, false);
case vmIntrinsics::_putByteVolatile: return inline_unsafe_access( is_store, T_BYTE, Volatile, false); case vmIntrinsics::_putByteVolatile: return inline_unsafe_access( is_store, T_BYTE, Volatile, false);
case vmIntrinsics::_putShortVolatile: return inline_unsafe_access( is_store, T_SHORT, Volatile, false); case vmIntrinsics::_putShortVolatile: return inline_unsafe_access( is_store, T_SHORT, Volatile, false);
@ -637,7 +637,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_putIntUnaligned: return inline_unsafe_access( is_store, T_INT, Relaxed, true); case vmIntrinsics::_putIntUnaligned: return inline_unsafe_access( is_store, T_INT, Relaxed, true);
case vmIntrinsics::_putLongUnaligned: return inline_unsafe_access( is_store, T_LONG, Relaxed, true); case vmIntrinsics::_putLongUnaligned: return inline_unsafe_access( is_store, T_LONG, Relaxed, true);
case vmIntrinsics::_getObjectAcquire: return inline_unsafe_access(!is_store, T_OBJECT, Acquire, false); case vmIntrinsics::_getReferenceAcquire: return inline_unsafe_access(!is_store, T_OBJECT, Acquire, false);
case vmIntrinsics::_getBooleanAcquire: return inline_unsafe_access(!is_store, T_BOOLEAN, Acquire, false); case vmIntrinsics::_getBooleanAcquire: return inline_unsafe_access(!is_store, T_BOOLEAN, Acquire, false);
case vmIntrinsics::_getByteAcquire: return inline_unsafe_access(!is_store, T_BYTE, Acquire, false); case vmIntrinsics::_getByteAcquire: return inline_unsafe_access(!is_store, T_BYTE, Acquire, false);
case vmIntrinsics::_getShortAcquire: return inline_unsafe_access(!is_store, T_SHORT, Acquire, false); case vmIntrinsics::_getShortAcquire: return inline_unsafe_access(!is_store, T_SHORT, Acquire, false);
@ -647,7 +647,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_getFloatAcquire: return inline_unsafe_access(!is_store, T_FLOAT, Acquire, false); case vmIntrinsics::_getFloatAcquire: return inline_unsafe_access(!is_store, T_FLOAT, Acquire, false);
case vmIntrinsics::_getDoubleAcquire: return inline_unsafe_access(!is_store, T_DOUBLE, Acquire, false); case vmIntrinsics::_getDoubleAcquire: return inline_unsafe_access(!is_store, T_DOUBLE, Acquire, false);
case vmIntrinsics::_putObjectRelease: return inline_unsafe_access( is_store, T_OBJECT, Release, false); case vmIntrinsics::_putReferenceRelease: return inline_unsafe_access( is_store, T_OBJECT, Release, false);
case vmIntrinsics::_putBooleanRelease: return inline_unsafe_access( is_store, T_BOOLEAN, Release, false); case vmIntrinsics::_putBooleanRelease: return inline_unsafe_access( is_store, T_BOOLEAN, Release, false);
case vmIntrinsics::_putByteRelease: return inline_unsafe_access( is_store, T_BYTE, Release, false); case vmIntrinsics::_putByteRelease: return inline_unsafe_access( is_store, T_BYTE, Release, false);
case vmIntrinsics::_putShortRelease: return inline_unsafe_access( is_store, T_SHORT, Release, false); case vmIntrinsics::_putShortRelease: return inline_unsafe_access( is_store, T_SHORT, Release, false);
@ -657,7 +657,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_putFloatRelease: return inline_unsafe_access( is_store, T_FLOAT, Release, false); case vmIntrinsics::_putFloatRelease: return inline_unsafe_access( is_store, T_FLOAT, Release, false);
case vmIntrinsics::_putDoubleRelease: return inline_unsafe_access( is_store, T_DOUBLE, Release, false); case vmIntrinsics::_putDoubleRelease: return inline_unsafe_access( is_store, T_DOUBLE, Release, false);
case vmIntrinsics::_getObjectOpaque: return inline_unsafe_access(!is_store, T_OBJECT, Opaque, false); case vmIntrinsics::_getReferenceOpaque: return inline_unsafe_access(!is_store, T_OBJECT, Opaque, false);
case vmIntrinsics::_getBooleanOpaque: return inline_unsafe_access(!is_store, T_BOOLEAN, Opaque, false); case vmIntrinsics::_getBooleanOpaque: return inline_unsafe_access(!is_store, T_BOOLEAN, Opaque, false);
case vmIntrinsics::_getByteOpaque: return inline_unsafe_access(!is_store, T_BYTE, Opaque, false); case vmIntrinsics::_getByteOpaque: return inline_unsafe_access(!is_store, T_BYTE, Opaque, false);
case vmIntrinsics::_getShortOpaque: return inline_unsafe_access(!is_store, T_SHORT, Opaque, false); case vmIntrinsics::_getShortOpaque: return inline_unsafe_access(!is_store, T_SHORT, Opaque, false);
@ -667,7 +667,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_getFloatOpaque: return inline_unsafe_access(!is_store, T_FLOAT, Opaque, false); case vmIntrinsics::_getFloatOpaque: return inline_unsafe_access(!is_store, T_FLOAT, Opaque, false);
case vmIntrinsics::_getDoubleOpaque: return inline_unsafe_access(!is_store, T_DOUBLE, Opaque, false); case vmIntrinsics::_getDoubleOpaque: return inline_unsafe_access(!is_store, T_DOUBLE, Opaque, false);
case vmIntrinsics::_putObjectOpaque: return inline_unsafe_access( is_store, T_OBJECT, Opaque, false); case vmIntrinsics::_putReferenceOpaque: return inline_unsafe_access( is_store, T_OBJECT, Opaque, false);
case vmIntrinsics::_putBooleanOpaque: return inline_unsafe_access( is_store, T_BOOLEAN, Opaque, false); case vmIntrinsics::_putBooleanOpaque: return inline_unsafe_access( is_store, T_BOOLEAN, Opaque, false);
case vmIntrinsics::_putByteOpaque: return inline_unsafe_access( is_store, T_BYTE, Opaque, false); case vmIntrinsics::_putByteOpaque: return inline_unsafe_access( is_store, T_BYTE, Opaque, false);
case vmIntrinsics::_putShortOpaque: return inline_unsafe_access( is_store, T_SHORT, Opaque, false); case vmIntrinsics::_putShortOpaque: return inline_unsafe_access( is_store, T_SHORT, Opaque, false);
@ -677,48 +677,48 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false); case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false);
case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false); case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false);
case vmIntrinsics::_compareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetReference: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile);
case vmIntrinsics::_weakCompareAndSetObjectPlain: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSetReferencePlain: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSetReferenceAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release); case vmIntrinsics::_weakCompareAndSetReferenceRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSetReference: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetBytePlain: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSetBytePlain: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSetByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release); case vmIntrinsics::_weakCompareAndSetByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetShortPlain: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSetShortPlain: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSetShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release); case vmIntrinsics::_weakCompareAndSetShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetIntPlain: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSetIntPlain: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSetIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release); case vmIntrinsics::_weakCompareAndSetIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetLongPlain: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSetLongPlain: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSetLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release); case vmIntrinsics::_weakCompareAndSetLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_compareAndExchangeObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeReference: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeReferenceAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Release); case vmIntrinsics::_compareAndExchangeReferenceRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Release); case vmIntrinsics::_compareAndExchangeByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Release); case vmIntrinsics::_compareAndExchangeShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeInt: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeInt: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Release); case vmIntrinsics::_compareAndExchangeIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeLong: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeLong: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Acquire); case vmIntrinsics::_compareAndExchangeLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Release); case vmIntrinsics::_compareAndExchangeLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Release);
case vmIntrinsics::_getAndAddByte: return inline_unsafe_load_store(T_BYTE, LS_get_add, Volatile); case vmIntrinsics::_getAndAddByte: return inline_unsafe_load_store(T_BYTE, LS_get_add, Volatile);
case vmIntrinsics::_getAndAddShort: return inline_unsafe_load_store(T_SHORT, LS_get_add, Volatile); case vmIntrinsics::_getAndAddShort: return inline_unsafe_load_store(T_SHORT, LS_get_add, Volatile);
@ -729,7 +729,7 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_getAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_get_set, Volatile); case vmIntrinsics::_getAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_get_set, Volatile);
case vmIntrinsics::_getAndSetInt: return inline_unsafe_load_store(T_INT, LS_get_set, Volatile); case vmIntrinsics::_getAndSetInt: return inline_unsafe_load_store(T_INT, LS_get_set, Volatile);
case vmIntrinsics::_getAndSetLong: return inline_unsafe_load_store(T_LONG, LS_get_set, Volatile); case vmIntrinsics::_getAndSetLong: return inline_unsafe_load_store(T_LONG, LS_get_set, Volatile);
case vmIntrinsics::_getAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_get_set, Volatile); case vmIntrinsics::_getAndSetReference: return inline_unsafe_load_store(T_OBJECT, LS_get_set, Volatile);
case vmIntrinsics::_loadFence: case vmIntrinsics::_loadFence:
case vmIntrinsics::_storeFence: case vmIntrinsics::_storeFence:
@ -2344,14 +2344,14 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
ciSignature* sig = callee()->signature(); ciSignature* sig = callee()->signature();
#ifdef ASSERT #ifdef ASSERT
if (!is_store) { if (!is_store) {
// Object getObject(Object base, int/long offset), etc. // Object getReference(Object base, int/long offset), etc.
BasicType rtype = sig->return_type()->basic_type(); BasicType rtype = sig->return_type()->basic_type();
assert(rtype == type, "getter must return the expected value"); assert(rtype == type, "getter must return the expected value");
assert(sig->count() == 2, "oop getter has 2 arguments"); assert(sig->count() == 2, "oop getter has 2 arguments");
assert(sig->type_at(0)->basic_type() == T_OBJECT, "getter base is object"); assert(sig->type_at(0)->basic_type() == T_OBJECT, "getter base is object");
assert(sig->type_at(1)->basic_type() == T_LONG, "getter offset is correct"); assert(sig->type_at(1)->basic_type() == T_LONG, "getter offset is correct");
} else { } else {
// void putObject(Object base, int/long offset, Object x), etc. // void putReference(Object base, int/long offset, Object x), etc.
assert(sig->return_type()->basic_type() == T_VOID, "putter must not return a value"); assert(sig->return_type()->basic_type() == T_VOID, "putter must not return a value");
assert(sig->count() == 3, "oop putter has 3 arguments"); assert(sig->count() == 3, "oop putter has 3 arguments");
assert(sig->type_at(0)->basic_type() == T_OBJECT, "putter base is object"); assert(sig->type_at(0)->basic_type() == T_OBJECT, "putter base is object");
@ -2422,7 +2422,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); bt = adr_type->is_aryptr()->elem()->array_element_basic_type();
} }
if (bt == T_ARRAY || bt == T_NARROWOOP) { if (bt == T_ARRAY || bt == T_NARROWOOP) {
// accessing an array field with getObject is not a mismatch // accessing an array field with getReference is not a mismatch
bt = T_OBJECT; bt = T_OBJECT;
} }
if ((bt == T_OBJECT) != (type == T_OBJECT)) { if ((bt == T_OBJECT) != (type == T_OBJECT)) {
@ -2521,16 +2521,16 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
// //
// LS_cmp_swap: // LS_cmp_swap:
// //
// boolean compareAndSetObject(Object o, long offset, Object expected, Object x); // boolean compareAndSetReference(Object o, long offset, Object expected, Object x);
// boolean compareAndSetInt( Object o, long offset, int expected, int x); // boolean compareAndSetInt( Object o, long offset, int expected, int x);
// boolean compareAndSetLong( Object o, long offset, long expected, long x); // boolean compareAndSetLong( Object o, long offset, long expected, long x);
// //
// LS_cmp_swap_weak: // LS_cmp_swap_weak:
// //
// boolean weakCompareAndSetObject( Object o, long offset, Object expected, Object x); // boolean weakCompareAndSetReference( Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObjectPlain( Object o, long offset, Object expected, Object x); // boolean weakCompareAndSetReferencePlain( Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObjectAcquire(Object o, long offset, Object expected, Object x); // boolean weakCompareAndSetReferenceAcquire(Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObjectRelease(Object o, long offset, Object expected, Object x); // boolean weakCompareAndSetReferenceRelease(Object o, long offset, Object expected, Object x);
// //
// boolean weakCompareAndSetInt( Object o, long offset, int expected, int x); // boolean weakCompareAndSetInt( Object o, long offset, int expected, int x);
// boolean weakCompareAndSetIntPlain( Object o, long offset, int expected, int x); // boolean weakCompareAndSetIntPlain( Object o, long offset, int expected, int x);
@ -2544,9 +2544,9 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
// //
// LS_cmp_exchange: // LS_cmp_exchange:
// //
// Object compareAndExchangeObjectVolatile(Object o, long offset, Object expected, Object x); // Object compareAndExchangeReferenceVolatile(Object o, long offset, Object expected, Object x);
// Object compareAndExchangeObjectAcquire( Object o, long offset, Object expected, Object x); // Object compareAndExchangeReferenceAcquire( Object o, long offset, Object expected, Object x);
// Object compareAndExchangeObjectRelease( Object o, long offset, Object expected, Object x); // Object compareAndExchangeReferenceRelease( Object o, long offset, Object expected, Object x);
// //
// Object compareAndExchangeIntVolatile( Object o, long offset, Object expected, Object x); // Object compareAndExchangeIntVolatile( Object o, long offset, Object expected, Object x);
// Object compareAndExchangeIntAcquire( Object o, long offset, Object expected, Object x); // Object compareAndExchangeIntAcquire( Object o, long offset, Object expected, Object x);

View file

@ -434,7 +434,10 @@ Node *PhaseMacroExpand::value_from_mem_phi(Node *mem, BasicType ft, const Type *
if (val == mem) { if (val == mem) {
values.at_put(j, mem); values.at_put(j, mem);
} else if (val->is_Store()) { } else if (val->is_Store()) {
values.at_put(j, val->in(MemNode::ValueIn)); Node* n = val->in(MemNode::ValueIn);
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
n = bs->step_over_gc_barrier(n);
values.at_put(j, n);
} else if(val->is_Proj() && val->in(0) == alloc) { } else if(val->is_Proj() && val->in(0) == alloc) {
values.at_put(j, _igvn.zerocon(ft)); values.at_put(j, _igvn.zerocon(ft));
} else if (val->is_Phi()) { } else if (val->is_Phi()) {
@ -546,7 +549,10 @@ Node *PhaseMacroExpand::value_from_mem(Node *sfpt_mem, Node *sfpt_ctl, BasicType
// hit a sentinel, return appropriate 0 value // hit a sentinel, return appropriate 0 value
return _igvn.zerocon(ft); return _igvn.zerocon(ft);
} else if (mem->is_Store()) { } else if (mem->is_Store()) {
return mem->in(MemNode::ValueIn); Node* n = mem->in(MemNode::ValueIn);
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
n = bs->step_over_gc_barrier(n);
return n;
} else if (mem->is_Phi()) { } else if (mem->is_Phi()) {
// attempt to produce a Phi reflecting the values on the input paths of the Phi // attempt to produce a Phi reflecting the values on the input paths of the Phi
Node_Stack value_phis(a, 8); Node_Stack value_phis(a, 8);

View file

@ -924,8 +924,10 @@ Node* LoadNode::can_see_arraycopy_value(Node* st, PhaseGVN* phase) const {
if (ac->as_ArrayCopy()->is_clonebasic()) { if (ac->as_ArrayCopy()->is_clonebasic()) {
assert(ld_alloc != NULL, "need an alloc"); assert(ld_alloc != NULL, "need an alloc");
assert(addp->is_AddP(), "address must be addp"); assert(addp->is_AddP(), "address must be addp");
assert(addp->in(AddPNode::Base) == ac->in(ArrayCopyNode::Dest)->in(AddPNode::Base), "strange pattern"); assert(ac->in(ArrayCopyNode::Dest)->is_AddP(), "dest must be an address");
assert(addp->in(AddPNode::Address) == ac->in(ArrayCopyNode::Dest)->in(AddPNode::Address), "strange pattern"); BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
assert(bs->step_over_gc_barrier(addp->in(AddPNode::Base)) == bs->step_over_gc_barrier(ac->in(ArrayCopyNode::Dest)->in(AddPNode::Base)), "strange pattern");
assert(bs->step_over_gc_barrier(addp->in(AddPNode::Address)) == bs->step_over_gc_barrier(ac->in(ArrayCopyNode::Dest)->in(AddPNode::Address)), "strange pattern");
addp->set_req(AddPNode::Base, src->in(AddPNode::Base)); addp->set_req(AddPNode::Base, src->in(AddPNode::Base));
addp->set_req(AddPNode::Address, src->in(AddPNode::Address)); addp->set_req(AddPNode::Address, src->in(AddPNode::Address));
} else { } else {
@ -1081,6 +1083,8 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
(tp != NULL) && tp->is_ptr_to_boxed_value()) { (tp != NULL) && tp->is_ptr_to_boxed_value()) {
intptr_t ignore = 0; intptr_t ignore = 0;
Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore); Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
base = bs->step_over_gc_barrier(base);
if (base != NULL && base->is_Proj() && if (base != NULL && base->is_Proj() &&
base->as_Proj()->_con == TypeFunc::Parms && base->as_Proj()->_con == TypeFunc::Parms &&
base->in(0)->is_CallStaticJava() && base->in(0)->is_CallStaticJava() &&

View file

@ -1396,7 +1396,7 @@ static void kill_dead_code( Node *dead, PhaseIterGVN *igvn ) {
// and remove_globally_dead_node(). // and remove_globally_dead_node().
igvn->add_users_to_worklist( n ); igvn->add_users_to_worklist( n );
} else { } else {
BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn->_worklist, n); BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, n);
} }
} }
} }

View file

@ -1375,7 +1375,7 @@ void PhaseIterGVN::remove_globally_dead_node( Node *dead ) {
assert(!(i < imax), "sanity"); assert(!(i < imax), "sanity");
} }
} else { } else {
BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(_worklist, in); BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(this, in);
} }
if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory && if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory &&
in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) { in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) {
@ -2089,6 +2089,8 @@ void Node::set_req_X( uint i, Node *n, PhaseIterGVN *igvn ) {
default: default:
break; break;
} }
BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, old);
} }
} }

View file

@ -883,9 +883,7 @@ static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
// LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror)))) // LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror))))
// or NULL if not matching. // or NULL if not matching.
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
if (bs->is_gc_barrier_node(n)) {
n = bs->step_over_gc_barrier(n); n = bs->step_over_gc_barrier(n);
}
if (n->Opcode() != Op_LoadP) return NULL; if (n->Opcode() != Op_LoadP) return NULL;
@ -959,8 +957,14 @@ Node *CmpPNode::Ideal( PhaseGVN *phase, bool can_reshape ) {
if (k1 && (k2 || conk2)) { if (k1 && (k2 || conk2)) {
Node* lhs = k1; Node* lhs = k1;
Node* rhs = (k2 != NULL) ? k2 : conk2; Node* rhs = (k2 != NULL) ? k2 : conk2;
this->set_req(1, lhs); PhaseIterGVN* igvn = phase->is_IterGVN();
this->set_req(2, rhs); if (igvn != NULL) {
set_req_X(1, lhs, igvn);
set_req_X(2, rhs, igvn);
} else {
set_req(1, lhs);
set_req(2, rhs);
}
return this; return this;
} }
} }

View file

@ -538,7 +538,7 @@ class JvmtiSampledObjectAllocEventCollector : public JvmtiObjectAllocEventCollec
JvmtiSampledObjectAllocEventCollector() NOT_JVMTI_RETURN; JvmtiSampledObjectAllocEventCollector() NOT_JVMTI_RETURN;
~JvmtiSampledObjectAllocEventCollector() NOT_JVMTI_RETURN; ~JvmtiSampledObjectAllocEventCollector() NOT_JVMTI_RETURN;
bool is_sampled_object_alloc_event() { return true; } bool is_sampled_object_alloc_event() { return true; }
static bool object_alloc_is_safe_to_sample(); static bool object_alloc_is_safe_to_sample() NOT_JVMTI_RETURN_(false);
}; };
// Marker class to disable the posting of VMObjectAlloc events // Marker class to disable the posting of VMObjectAlloc events

View file

@ -257,28 +257,28 @@ public:
// These functions allow a null base pointer with an arbitrary address. // These functions allow a null base pointer with an arbitrary address.
// But if the base pointer is non-null, the offset should make some sense. // But if the base pointer is non-null, the offset should make some sense.
// That is, it should be in the range [0, MAX_OBJECT_SIZE]. // That is, it should be in the range [0, MAX_OBJECT_SIZE].
UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { UNSAFE_ENTRY(jobject, Unsafe_GetReference(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) {
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
assert_field_offset_sane(p, offset); assert_field_offset_sane(p, offset);
oop v = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(p, offset); oop v = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(p, offset);
return JNIHandles::make_local(env, v); return JNIHandles::make_local(env, v);
} UNSAFE_END } UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_PutObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) { UNSAFE_ENTRY(void, Unsafe_PutReference(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
oop x = JNIHandles::resolve(x_h); oop x = JNIHandles::resolve(x_h);
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
assert_field_offset_sane(p, offset); assert_field_offset_sane(p, offset);
HeapAccess<ON_UNKNOWN_OOP_REF>::oop_store_at(p, offset, x); HeapAccess<ON_UNKNOWN_OOP_REF>::oop_store_at(p, offset, x);
} UNSAFE_END } UNSAFE_END
UNSAFE_ENTRY(jobject, Unsafe_GetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { UNSAFE_ENTRY(jobject, Unsafe_GetReferenceVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) {
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
assert_field_offset_sane(p, offset); assert_field_offset_sane(p, offset);
oop v = HeapAccess<MO_SEQ_CST | ON_UNKNOWN_OOP_REF>::oop_load_at(p, offset); oop v = HeapAccess<MO_SEQ_CST | ON_UNKNOWN_OOP_REF>::oop_load_at(p, offset);
return JNIHandles::make_local(env, v); return JNIHandles::make_local(env, v);
} UNSAFE_END } UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_PutObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) { UNSAFE_ENTRY(void, Unsafe_PutReferenceVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
oop x = JNIHandles::resolve(x_h); oop x = JNIHandles::resolve(x_h);
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
assert_field_offset_sane(p, offset); assert_field_offset_sane(p, offset);
@ -864,7 +864,7 @@ UNSAFE_ENTRY(void, Unsafe_ThrowException(JNIEnv *env, jobject unsafe, jthrowable
// JSR166 ------------------------------------------------------------------ // JSR166 ------------------------------------------------------------------
UNSAFE_ENTRY(jobject, Unsafe_CompareAndExchangeObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) { UNSAFE_ENTRY(jobject, Unsafe_CompareAndExchangeReference(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
oop x = JNIHandles::resolve(x_h); oop x = JNIHandles::resolve(x_h);
oop e = JNIHandles::resolve(e_h); oop e = JNIHandles::resolve(e_h);
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
@ -895,7 +895,7 @@ UNSAFE_ENTRY(jlong, Unsafe_CompareAndExchangeLong(JNIEnv *env, jobject unsafe, j
} }
} UNSAFE_END } UNSAFE_END
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) { UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetReference(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
oop x = JNIHandles::resolve(x_h); oop x = JNIHandles::resolve(x_h);
oop e = JNIHandles::resolve(e_h); oop e = JNIHandles::resolve(e_h);
oop p = JNIHandles::resolve(obj); oop p = JNIHandles::resolve(obj);
@ -1034,10 +1034,10 @@ UNSAFE_ENTRY(jint, Unsafe_GetLoadAverage0(JNIEnv *env, jobject unsafe, jdoubleAr
static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = { static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
{CC "getObject", CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetObject)}, {CC "getReference", CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetReference)},
{CC "putObject", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutObject)}, {CC "putReference", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutReference)},
{CC "getObjectVolatile",CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetObjectVolatile)}, {CC "getReferenceVolatile", CC "(" OBJ "J)" OBJ, FN_PTR(Unsafe_GetReferenceVolatile)},
{CC "putObjectVolatile",CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutObjectVolatile)}, {CC "putReferenceVolatile", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutReferenceVolatile)},
{CC "getUncompressedObject", CC "(" ADR ")" OBJ, FN_PTR(Unsafe_GetUncompressedObject)}, {CC "getUncompressedObject", CC "(" ADR ")" OBJ, FN_PTR(Unsafe_GetUncompressedObject)},
@ -1067,10 +1067,10 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
{CC "defineClass0", CC "(" DC_Args ")" CLS, FN_PTR(Unsafe_DefineClass0)}, {CC "defineClass0", CC "(" DC_Args ")" CLS, FN_PTR(Unsafe_DefineClass0)},
{CC "allocateInstance", CC "(" CLS ")" OBJ, FN_PTR(Unsafe_AllocateInstance)}, {CC "allocateInstance", CC "(" CLS ")" OBJ, FN_PTR(Unsafe_AllocateInstance)},
{CC "throwException", CC "(" THR ")V", FN_PTR(Unsafe_ThrowException)}, {CC "throwException", CC "(" THR ")V", FN_PTR(Unsafe_ThrowException)},
{CC "compareAndSetObject",CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSetObject)}, {CC "compareAndSetReference",CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSetReference)},
{CC "compareAndSetInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSetInt)}, {CC "compareAndSetInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSetInt)},
{CC "compareAndSetLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSetLong)}, {CC "compareAndSetLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSetLong)},
{CC "compareAndExchangeObject", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)}, {CC "compareAndExchangeReference", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeReference)},
{CC "compareAndExchangeInt", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)}, {CC "compareAndExchangeInt", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
{CC "compareAndExchangeLong", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)}, {CC "compareAndExchangeLong", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},

View file

@ -326,13 +326,6 @@ static Klass* basic_type_mirror_to_arrayklass(oop basic_type_mirror, TRAPS) {
} }
} }
#ifdef ASSERT
static oop basic_type_arrayklass_to_mirror(Klass* basic_type_arrayklass, TRAPS) {
BasicType type = TypeArrayKlass::cast(basic_type_arrayklass)->element_type();
return Universe::java_mirror(type);
}
#endif
arrayOop Reflection::reflect_new_array(oop element_mirror, jint length, TRAPS) { arrayOop Reflection::reflect_new_array(oop element_mirror, jint length, TRAPS) {
if (element_mirror == NULL) { if (element_mirror == NULL) {
THROW_0(vmSymbols::java_lang_NullPointerException()); THROW_0(vmSymbols::java_lang_NullPointerException());
@ -396,35 +389,6 @@ arrayOop Reflection::reflect_new_multi_array(oop element_mirror, typeArrayOop di
} }
oop Reflection::array_component_type(oop mirror, TRAPS) {
if (java_lang_Class::is_primitive(mirror)) {
return NULL;
}
Klass* klass = java_lang_Class::as_Klass(mirror);
if (!klass->is_array_klass()) {
return NULL;
}
oop result = java_lang_Class::component_mirror(mirror);
#ifdef ASSERT
oop result2 = NULL;
if (ArrayKlass::cast(klass)->dimension() == 1) {
if (klass->is_typeArray_klass()) {
result2 = basic_type_arrayklass_to_mirror(klass, CHECK_NULL);
} else {
result2 = ObjArrayKlass::cast(klass)->element_klass()->java_mirror();
}
} else {
Klass* lower_dim = ArrayKlass::cast(klass)->lower_dimension();
assert(lower_dim->is_array_klass(), "just checking");
result2 = lower_dim->java_mirror();
}
assert(oopDesc::equals(result, result2), "results must be consistent");
#endif //ASSERT
return result;
}
static bool under_unsafe_anonymous_host(const InstanceKlass* ik, const InstanceKlass* unsafe_anonymous_host) { static bool under_unsafe_anonymous_host(const InstanceKlass* ik, const InstanceKlass* unsafe_anonymous_host) {
DEBUG_ONLY(int inf_loop_check = 1000 * 1000 * 1000); DEBUG_ONLY(int inf_loop_check = 1000 * 1000 * 1000);
for (;;) { for (;;) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -73,8 +73,6 @@ class Reflection: public AllStatic {
// Reflective array access. Returns type code. Throws ArrayIndexOutOfBoundsException. // Reflective array access. Returns type code. Throws ArrayIndexOutOfBoundsException.
static BasicType array_get(jvalue* value, arrayOop a, int index, TRAPS); static BasicType array_get(jvalue* value, arrayOop a, int index, TRAPS);
static void array_set(jvalue* value, arrayOop a, int index, BasicType value_type, TRAPS); static void array_set(jvalue* value, arrayOop a, int index, BasicType value_type, TRAPS);
// Returns mirror on array element type (NULL for basic type arrays and non-arrays).
static oop array_component_type(oop mirror, TRAPS);
// Object creation // Object creation
static arrayOop reflect_new_array(oop element_mirror, jint length, TRAPS); static arrayOop reflect_new_array(oop element_mirror, jint length, TRAPS);

View file

@ -238,7 +238,7 @@ class BufferedInputStream extends FilterInputStream {
nsz = marklimit; nsz = marklimit;
byte[] nbuf = new byte[nsz]; byte[] nbuf = new byte[nsz];
System.arraycopy(buffer, 0, nbuf, 0, pos); System.arraycopy(buffer, 0, nbuf, 0, pos);
if (!U.compareAndSetObject(this, BUF_OFFSET, buffer, nbuf)) { if (!U.compareAndSetReference(this, BUF_OFFSET, buffer, nbuf)) {
// Can't replace buf if there was an async close. // Can't replace buf if there was an async close.
// Note: This would need to be changed if fill() // Note: This would need to be changed if fill()
// is ever made accessible to multiple threads. // is ever made accessible to multiple threads.
@ -482,7 +482,7 @@ class BufferedInputStream extends FilterInputStream {
public void close() throws IOException { public void close() throws IOException {
byte[] buffer; byte[] buffer;
while ( (buffer = buf) != null) { while ( (buffer = buf) != null) {
if (U.compareAndSetObject(this, BUF_OFFSET, buffer, null)) { if (U.compareAndSetReference(this, BUF_OFFSET, buffer, null)) {
InputStream input = in; InputStream input = in;
in = null; in = null;
if (input != null) if (input != null)

View file

@ -2237,7 +2237,7 @@ public class File
if (sep != separatorChar) if (sep != separatorChar)
pathField = pathField.replace(sep, separatorChar); pathField = pathField.replace(sep, separatorChar);
String path = fs.normalize(pathField); String path = fs.normalize(pathField);
UNSAFE.putObject(this, PATH_OFFSET, path); UNSAFE.putReference(this, PATH_OFFSET, path);
UNSAFE.putIntVolatile(this, PREFIX_LENGTH_OFFSET, fs.prefixLength(path)); UNSAFE.putIntVolatile(this, PREFIX_LENGTH_OFFSET, fs.prefixLength(path));
} }

View file

@ -2135,7 +2135,7 @@ public class ObjectStreamClass implements Serializable {
switch (typeCodes[i]) { switch (typeCodes[i]) {
case 'L': case 'L':
case '[': case '[':
vals[offsets[i]] = unsafe.getObject(obj, readKeys[i]); vals[offsets[i]] = unsafe.getReference(obj, readKeys[i]);
break; break;
default: default:
@ -2190,7 +2190,7 @@ public class ObjectStreamClass implements Serializable {
obj.getClass().getName()); obj.getClass().getName());
} }
if (!dryRun) if (!dryRun)
unsafe.putObject(obj, key, val); unsafe.putReference(obj, key, val);
break; break;
default: default:

View file

@ -405,7 +405,7 @@ public final class Class<T> implements java.io.Serializable,
/** /**
* Returns the {@code Class} with the given <a href="ClassLoader.html#name"> * Returns the {@code Class} with the given <a href="ClassLoader.html#binary-name">
* binary name</a> in the given module. * binary name</a> in the given module.
* *
* <p> This method attempts to locate, load, and link the class or interface. * <p> This method attempts to locate, load, and link the class or interface.
@ -427,7 +427,7 @@ public final class Class<T> implements java.io.Serializable,
* loads a class in another module. * loads a class in another module.
* *
* @param module A module * @param module A module
* @param name The <a href="ClassLoader.html#name">binary name</a> * @param name The <a href="ClassLoader.html#binary-name">binary name</a>
* of the class * of the class
* @return {@code Class} object of the given name defined in the given module; * @return {@code Class} object of the given name defined in the given module;
* {@code null} if not found. * {@code null} if not found.
@ -2904,19 +2904,19 @@ public final class Class<T> implements java.io.Serializable,
static <T> boolean casReflectionData(Class<?> clazz, static <T> boolean casReflectionData(Class<?> clazz,
SoftReference<ReflectionData<T>> oldData, SoftReference<ReflectionData<T>> oldData,
SoftReference<ReflectionData<T>> newData) { SoftReference<ReflectionData<T>> newData) {
return unsafe.compareAndSetObject(clazz, reflectionDataOffset, oldData, newData); return unsafe.compareAndSetReference(clazz, reflectionDataOffset, oldData, newData);
} }
static <T> boolean casAnnotationType(Class<?> clazz, static <T> boolean casAnnotationType(Class<?> clazz,
AnnotationType oldType, AnnotationType oldType,
AnnotationType newType) { AnnotationType newType) {
return unsafe.compareAndSetObject(clazz, annotationTypeOffset, oldType, newType); return unsafe.compareAndSetReference(clazz, annotationTypeOffset, oldType, newType);
} }
static <T> boolean casAnnotationData(Class<?> clazz, static <T> boolean casAnnotationData(Class<?> clazz,
AnnotationData oldData, AnnotationData oldData,
AnnotationData newData) { AnnotationData newData) {
return unsafe.compareAndSetObject(clazz, annotationDataOffset, oldData, newData); return unsafe.compareAndSetReference(clazz, annotationDataOffset, oldData, newData);
} }
} }

View file

@ -3002,7 +3002,7 @@ public abstract class ClassLoader {
Class<?> k = ClassLoader.class; Class<?> k = ClassLoader.class;
long offset; long offset;
offset = unsafe.objectFieldOffset(k, name); offset = unsafe.objectFieldOffset(k, name);
return unsafe.compareAndSetObject(this, offset, null, obj); return unsafe.compareAndSetReference(this, offset, null, obj);
} }
} }

View file

@ -100,7 +100,7 @@ public final class StackWalker {
*/ */
public interface StackFrame { public interface StackFrame {
/** /**
* Gets the <a href="ClassLoader.html#name">binary name</a> * Gets the <a href="ClassLoader.html#binary-name">binary name</a>
* of the declaring class of the method represented by this stack frame. * of the declaring class of the method represented by this stack frame.
* *
* @return the binary name of the declaring class of the method * @return the binary name of the declaring class of the method

View file

@ -287,7 +287,7 @@ public class CallSite {
} }
/*package-private*/ /*package-private*/
MethodHandle getTargetVolatile() { MethodHandle getTargetVolatile() {
return (MethodHandle) UNSAFE.getObjectVolatile(this, getTargetOffset()); return (MethodHandle) UNSAFE.getReferenceVolatile(this, getTargetOffset());
} }
/*package-private*/ /*package-private*/
void setTargetVolatile(MethodHandle newTarget) { void setTargetVolatile(MethodHandle newTarget) {

View file

@ -940,7 +940,7 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
Object base = MethodHandleNatives.staticFieldBase(sdField); Object base = MethodHandleNatives.staticFieldBase(sdField);
long offset = MethodHandleNatives.staticFieldOffset(sdField); long offset = MethodHandleNatives.staticFieldOffset(sdField);
UNSAFE.loadFence(); UNSAFE.loadFence();
return metaType.cast(UNSAFE.getObject(base, offset)); return metaType.cast(UNSAFE.getReference(base, offset));
} catch (Error err) { } catch (Error err) {
throw err; throw err;
} catch (Exception ex) { } catch (Exception ex) {
@ -970,7 +970,7 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
Object base = MethodHandleNatives.staticFieldBase(sdField); Object base = MethodHandleNatives.staticFieldBase(sdField);
long offset = MethodHandleNatives.staticFieldOffset(sdField); long offset = MethodHandleNatives.staticFieldOffset(sdField);
UNSAFE.storeFence(); UNSAFE.storeFence();
UNSAFE.putObject(base, offset, speciesData); UNSAFE.putReference(base, offset, speciesData);
UNSAFE.storeFence(); UNSAFE.storeFence();
} catch (Error err) { } catch (Error err) {
throw err; throw err;

View file

@ -655,7 +655,7 @@ class DirectMethodHandle extends MethodHandle {
case LONG: return GET_LONG_VOLATILE; case LONG: return GET_LONG_VOLATILE;
case FLOAT: return GET_FLOAT_VOLATILE; case FLOAT: return GET_FLOAT_VOLATILE;
case DOUBLE: return GET_DOUBLE_VOLATILE; case DOUBLE: return GET_DOUBLE_VOLATILE;
case OBJECT: return GET_OBJECT_VOLATILE; case OBJECT: return GET_REFERENCE_VOLATILE;
} }
} else { } else {
switch (wrapper) { switch (wrapper) {
@ -667,7 +667,7 @@ class DirectMethodHandle extends MethodHandle {
case LONG: return GET_LONG; case LONG: return GET_LONG;
case FLOAT: return GET_FLOAT; case FLOAT: return GET_FLOAT;
case DOUBLE: return GET_DOUBLE; case DOUBLE: return GET_DOUBLE;
case OBJECT: return GET_OBJECT; case OBJECT: return GET_REFERENCE;
} }
} }
} else { } else {
@ -681,7 +681,7 @@ class DirectMethodHandle extends MethodHandle {
case LONG: return PUT_LONG_VOLATILE; case LONG: return PUT_LONG_VOLATILE;
case FLOAT: return PUT_FLOAT_VOLATILE; case FLOAT: return PUT_FLOAT_VOLATILE;
case DOUBLE: return PUT_DOUBLE_VOLATILE; case DOUBLE: return PUT_DOUBLE_VOLATILE;
case OBJECT: return PUT_OBJECT_VOLATILE; case OBJECT: return PUT_REFERENCE_VOLATILE;
} }
} else { } else {
switch (wrapper) { switch (wrapper) {
@ -693,7 +693,7 @@ class DirectMethodHandle extends MethodHandle {
case LONG: return PUT_LONG; case LONG: return PUT_LONG;
case FLOAT: return PUT_FLOAT; case FLOAT: return PUT_FLOAT;
case DOUBLE: return PUT_DOUBLE; case DOUBLE: return PUT_DOUBLE;
case OBJECT: return PUT_OBJECT; case OBJECT: return PUT_REFERENCE;
} }
} }
} }

View file

@ -653,7 +653,7 @@ class InvokerBytecodeGenerator {
case LINK_TO_TARGET_METHOD: // fall-through case LINK_TO_TARGET_METHOD: // fall-through
case GENERIC_INVOKER: // fall-through case GENERIC_INVOKER: // fall-through
case GENERIC_LINKER: return resolveFrom(name, invokerType.basicType(), Invokers.Holder.class); case GENERIC_LINKER: return resolveFrom(name, invokerType.basicType(), Invokers.Holder.class);
case GET_OBJECT: // fall-through case GET_REFERENCE: // fall-through
case GET_BOOLEAN: // fall-through case GET_BOOLEAN: // fall-through
case GET_BYTE: // fall-through case GET_BYTE: // fall-through
case GET_CHAR: // fall-through case GET_CHAR: // fall-through
@ -662,7 +662,7 @@ class InvokerBytecodeGenerator {
case GET_LONG: // fall-through case GET_LONG: // fall-through
case GET_FLOAT: // fall-through case GET_FLOAT: // fall-through
case GET_DOUBLE: // fall-through case GET_DOUBLE: // fall-through
case PUT_OBJECT: // fall-through case PUT_REFERENCE: // fall-through
case PUT_BOOLEAN: // fall-through case PUT_BOOLEAN: // fall-through
case PUT_BYTE: // fall-through case PUT_BYTE: // fall-through
case PUT_CHAR: // fall-through case PUT_CHAR: // fall-through

View file

@ -296,10 +296,10 @@ class LambdaForm {
DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial", "newInvokeSpecial"), DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial", "newInvokeSpecial"),
DIRECT_INVOKE_INTERFACE("DMH.invokeInterface", "invokeInterface"), DIRECT_INVOKE_INTERFACE("DMH.invokeInterface", "invokeInterface"),
DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit", "invokeStaticInit"), DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit", "invokeStaticInit"),
GET_OBJECT("getObject"), GET_REFERENCE("getReference"),
PUT_OBJECT("putObject"), PUT_REFERENCE("putReference"),
GET_OBJECT_VOLATILE("getObjectVolatile"), GET_REFERENCE_VOLATILE("getReferenceVolatile"),
PUT_OBJECT_VOLATILE("putObjectVolatile"), PUT_REFERENCE_VOLATILE("putReferenceVolatile"),
GET_INT("getInt"), GET_INT("getInt"),
PUT_INT("putInt"), PUT_INT("putInt"),
GET_INT_VOLATILE("getIntVolatile"), GET_INT_VOLATILE("getIntVolatile"),

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -85,7 +85,8 @@ class LambdaFormEditor {
PERMUTE_ARGS = 13, PERMUTE_ARGS = 13,
LOCAL_TYPES = 14, LOCAL_TYPES = 14,
FOLD_SELECT_ARGS = 15, FOLD_SELECT_ARGS = 15,
FOLD_SELECT_ARGS_TO_VOID = 16; FOLD_SELECT_ARGS_TO_VOID = 16,
FILTER_SELECT_ARGS = 17;
private static final boolean STRESS_TEST = false; // turn on to disable most packing private static final boolean STRESS_TEST = false; // turn on to disable most packing
private static final int private static final int
@ -730,21 +731,23 @@ class LambdaFormEditor {
Name getCombiner = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress); Name getCombiner = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress);
Object[] combinerArgs = new Object[1 + combinerArity]; Object[] combinerArgs = new Object[1 + combinerArity];
combinerArgs[0] = getCombiner; combinerArgs[0] = getCombiner;
Name[] newParams; Name newParam = null;
if (keepArguments) { if (keepArguments) {
newParams = new Name[0];
for (int i = 0; i < combinerArity; i++) { for (int i = 0; i < combinerArity; i++) {
combinerArgs[i + 1] = lambdaForm.parameter(1 + argPositions[i]); combinerArgs[i + 1] = lambdaForm.parameter(1 + argPositions[i]);
assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i])); assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i]));
} }
} else { } else {
newParams = new Name[combinerArity]; newParam = new Name(pos, BasicType.basicType(combinerType.returnType()));
for (int i = 0; i < newParams.length; i++) { for (int i = 0; i < combinerArity; i++) {
newParams[i] = lambdaForm.parameter(1 + argPositions[i]); int argPos = 1 + argPositions[i];
if (argPos == pos) {
combinerArgs[i + 1] = newParam;
} else {
combinerArgs[i + 1] = lambdaForm.parameter(argPos);
}
assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i])); assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i]));
} }
System.arraycopy(newParams, 0,
combinerArgs, 1, combinerArity);
} }
Name callCombiner = new Name(combinerType, combinerArgs); Name callCombiner = new Name(combinerType, combinerArgs);
@ -755,12 +758,13 @@ class LambdaFormEditor {
// insert new arguments, if needed // insert new arguments, if needed
int argPos = pos + resultArity; // skip result parameter int argPos = pos + resultArity; // skip result parameter
for (Name newParam : newParams) { if (newParam != null) {
buf.insertParameter(argPos++, newParam); buf.insertParameter(argPos++, newParam);
exprPos++;
} }
assert(buf.lastIndexOf(callCombiner) == exprPos+1+newParams.length); assert(buf.lastIndexOf(callCombiner) == exprPos+1);
if (!dropResult) { if (!dropResult) {
buf.replaceParameterByCopy(pos, exprPos+1+newParams.length); buf.replaceParameterByCopy(pos, exprPos+1);
} }
return buf.endEdit(); return buf.endEdit();
@ -845,6 +849,20 @@ class LambdaFormEditor {
return putInCache(key, form); return putInCache(key, form);
} }
LambdaForm filterArgumentsForm(int filterPos, MethodType combinerType, int ... argPositions) {
byte kind = Transform.FILTER_SELECT_ARGS;
int[] keyArgs = Arrays.copyOf(argPositions, argPositions.length + 1);
keyArgs[argPositions.length] = filterPos;
Transform key = Transform.of(kind, keyArgs);
LambdaForm form = getInCache(key);
if (form != null) {
assert(form.arity == lambdaForm.arity);
return form;
}
form = makeArgumentCombinationForm(filterPos, combinerType, argPositions, false, false);
return putInCache(key, form);
}
LambdaForm permuteArgumentsForm(int skip, int[] reorder) { LambdaForm permuteArgumentsForm(int skip, int[] reorder) {
assert(skip == 1); // skip only the leading MH argument, names[0] assert(skip == 1); // skip only the leading MH argument, names[0]
int length = lambdaForm.names.length; int length = lambdaForm.names.length;

View file

@ -1663,7 +1663,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
assert(newForm.customized == null || newForm.customized == this); assert(newForm.customized == null || newForm.customized == this);
if (form == newForm) return; if (form == newForm) return;
newForm.prepare(); // as in MethodHandle.<init> newForm.prepare(); // as in MethodHandle.<init>
UNSAFE.putObject(this, FORM_OFFSET, newForm); UNSAFE.putReference(this, FORM_OFFSET, newForm);
UNSAFE.fullFence(); UNSAFE.fullFence();
} }

View file

@ -4316,28 +4316,6 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
return result; return result;
} }
/**
* As {@see foldArguments(MethodHandle, int, MethodHandle)}, but with the
* added capability of selecting the arguments from the targets parameters
* to call the combiner with. This allows us to avoid some simple cases of
* permutations and padding the combiner with dropArguments to select the
* right argument, which may ultimately produce fewer intermediaries.
*/
static MethodHandle foldArguments(MethodHandle target, int pos, MethodHandle combiner, int ... argPositions) {
MethodType targetType = target.type();
MethodType combinerType = combiner.type();
Class<?> rtype = foldArgumentChecks(pos, targetType, combinerType, argPositions);
BoundMethodHandle result = target.rebind();
boolean dropResult = rtype == void.class;
LambdaForm lform = result.editor().foldArgumentsForm(1 + pos, dropResult, combinerType.basicType(), argPositions);
MethodType newType = targetType;
if (!dropResult) {
newType = newType.dropParameterTypes(pos, pos + 1);
}
result = result.copyWithExtendL(newType, lform, combiner);
return result;
}
private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) { private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) {
int foldArgs = combinerType.parameterCount(); int foldArgs = combinerType.parameterCount();
Class<?> rtype = combinerType.returnType(); Class<?> rtype = combinerType.returnType();
@ -4359,15 +4337,78 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
return rtype; return rtype;
} }
private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType, int ... argPos) { /**
int foldArgs = combinerType.parameterCount(); * Adapts a target method handle by pre-processing some of its arguments, then calling the target with the result
if (argPos.length != foldArgs) { * of the pre-processing replacing the argument at the given position.
*
* @param target the method handle to invoke after arguments are combined
* @param position the position at which to start folding and at which to insert the folding result; if this is {@code
* 0}, the effect is the same as for {@link #foldArguments(MethodHandle, MethodHandle)}.
* @param combiner method handle to call initially on the incoming arguments
* @param argPositions indexes of the target to pick arguments sent to the combiner from
* @return method handle which incorporates the specified argument folding logic
* @throws NullPointerException if either argument is null
* @throws IllegalArgumentException if either of the following two conditions holds:
* (1) {@code combiner}'s return type is not the same as the argument type at position
* {@code pos} of the target signature;
* (2) the {@code N} argument types at positions {@code argPositions[1...N]} of the target signature are
* not identical with the argument types of {@code combiner}.
*/
/*non-public*/ static MethodHandle filterArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
return argumentsWithCombiner(true, target, position, combiner, argPositions);
}
/**
* Adapts a target method handle by pre-processing some of its arguments, calling the target with the result of
* the pre-processing inserted into the original sequence of arguments at the given position.
*
* @param target the method handle to invoke after arguments are combined
* @param position the position at which to start folding and at which to insert the folding result; if this is {@code
* 0}, the effect is the same as for {@link #foldArguments(MethodHandle, MethodHandle)}.
* @param combiner method handle to call initially on the incoming arguments
* @param argPositions indexes of the target to pick arguments sent to the combiner from
* @return method handle which incorporates the specified argument folding logic
* @throws NullPointerException if either argument is null
* @throws IllegalArgumentException if either of the following two conditions holds:
* (1) {@code combiner}'s return type is non-{@code void} and not the same as the argument type at position
* {@code pos} of the target signature;
* (2) the {@code N} argument types at positions {@code argPositions[1...N]} of the target signature
* (skipping {@code position} where the {@code combiner}'s return will be folded in) are not identical
* with the argument types of {@code combiner}.
*/
/*non-public*/ static MethodHandle foldArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
return argumentsWithCombiner(false, target, position, combiner, argPositions);
}
private static MethodHandle argumentsWithCombiner(boolean filter, MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
MethodType targetType = target.type();
MethodType combinerType = combiner.type();
Class<?> rtype = argumentsWithCombinerChecks(position, filter, targetType, combinerType, argPositions);
BoundMethodHandle result = target.rebind();
MethodType newType = targetType;
LambdaForm lform;
if (filter) {
lform = result.editor().filterArgumentsForm(1 + position, combinerType.basicType(), argPositions);
} else {
boolean dropResult = rtype == void.class;
lform = result.editor().foldArgumentsForm(1 + position, dropResult, combinerType.basicType(), argPositions);
if (!dropResult) {
newType = newType.dropParameterTypes(position, position + 1);
}
}
result = result.copyWithExtendL(newType, lform, combiner);
return result;
}
private static Class<?> argumentsWithCombinerChecks(int position, boolean filter, MethodType targetType, MethodType combinerType, int ... argPos) {
int combinerArgs = combinerType.parameterCount();
if (argPos.length != combinerArgs) {
throw newIllegalArgumentException("combiner and argument map must be equal size", combinerType, argPos.length); throw newIllegalArgumentException("combiner and argument map must be equal size", combinerType, argPos.length);
} }
Class<?> rtype = combinerType.returnType(); Class<?> rtype = combinerType.returnType();
int foldVals = rtype == void.class ? 0 : 1;
boolean ok = true; for (int i = 0; i < combinerArgs; i++) {
for (int i = 0; i < foldArgs; i++) {
int arg = argPos[i]; int arg = argPos[i];
if (arg < 0 || arg > targetType.parameterCount()) { if (arg < 0 || arg > targetType.parameterCount()) {
throw newIllegalArgumentException("arg outside of target parameterRange", targetType, arg); throw newIllegalArgumentException("arg outside of target parameterRange", targetType, arg);
@ -4378,11 +4419,9 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
+ " -> " + combinerType + ", map: " + Arrays.toString(argPos)); + " -> " + combinerType + ", map: " + Arrays.toString(argPos));
} }
} }
if (ok && foldVals != 0 && combinerType.returnType() != targetType.parameterType(foldPos)) { if (filter && combinerType.returnType() != targetType.parameterType(position)) {
ok = false;
}
if (!ok)
throw misMatchedTypes("target and combiner types", targetType, combinerType); throw misMatchedTypes("target and combiner types", targetType, combinerType);
}
return rtype; return rtype;
} }

View file

@ -1245,8 +1245,8 @@ s.writeObject(this.parameterArray());
// store them into the implementation-specific final fields. // store them into the implementation-specific final fields.
checkRtype(rtype); checkRtype(rtype);
checkPtypes(ptypes); checkPtypes(ptypes);
UNSAFE.putObject(this, OffsetHolder.rtypeOffset, rtype); UNSAFE.putReference(this, OffsetHolder.rtypeOffset, rtype);
UNSAFE.putObject(this, OffsetHolder.ptypesOffset, ptypes); UNSAFE.putReference(this, OffsetHolder.ptypesOffset, ptypes);
} }
// Support for resetting final fields while deserializing. Implement Holder // Support for resetting final fields while deserializing. Implement Holder

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1533,21 +1533,20 @@ public final class StringConcatFactory {
// *ending* index. // *ending* index.
for (RecipeElement el : recipe.getElements()) { for (RecipeElement el : recipe.getElements()) {
// Do the prepend, and put "new" index at index 1 // Do the prepend, and put "new" index at index 1
mh = MethodHandles.dropArguments(mh, 2, int.class);
switch (el.getTag()) { switch (el.getTag()) {
case TAG_CONST: { case TAG_CONST: {
MethodHandle prepender = MethodHandles.insertArguments(prepender(String.class), 3, el.getValue()); MethodHandle prepender = MethodHandles.insertArguments(prepender(String.class), 3, el.getValue());
mh = MethodHandles.foldArguments(mh, 1, prepender, mh = MethodHandles.filterArgumentsWithCombiner(mh, 1, prepender,
2, 0, 3 // index, storage, coder 1, 0, 2 // index, storage, coder
); );
break; break;
} }
case TAG_ARG: { case TAG_ARG: {
int pos = el.getArgPos(); int pos = el.getArgPos();
MethodHandle prepender = prepender(ptypes[pos]); MethodHandle prepender = prepender(ptypes[pos]);
mh = MethodHandles.foldArguments(mh, 1, prepender, mh = MethodHandles.filterArgumentsWithCombiner(mh, 1, prepender,
2, 0, 3, // index, storage, coder 1, 0, 2, // index, storage, coder
4 + pos // selected argument 3 + pos // selected argument
); );
break; break;
} }
@ -1557,7 +1556,7 @@ public final class StringConcatFactory {
} }
// Fold in byte[] instantiation at argument 0 // Fold in byte[] instantiation at argument 0
mh = MethodHandles.foldArguments(mh, 0, NEW_ARRAY, mh = MethodHandles.foldArgumentsWithCombiner(mh, 0, NEW_ARRAY,
1, 2 // index, coder 1, 2 // index, coder
); );
@ -1572,7 +1571,7 @@ public final class StringConcatFactory {
// and deduce the coder from there. Arguments would be either converted to Strings // and deduce the coder from there. Arguments would be either converted to Strings
// during the initial filtering, or handled by primitive specializations in CODER_MIXERS. // during the initial filtering, or handled by primitive specializations in CODER_MIXERS.
// //
// The method handle shape after all length and coder mixers is: // The method handle shape before and after all length and coder mixers is:
// (int, byte, <args>)String = ("index", "coder", <args>) // (int, byte, <args>)String = ("index", "coder", <args>)
byte initialCoder = INITIAL_CODER; byte initialCoder = INITIAL_CODER;
int initialLen = 0; // initial length, in characters int initialLen = 0; // initial length, in characters
@ -1589,44 +1588,27 @@ public final class StringConcatFactory {
Class<?> argClass = ptypes[ac]; Class<?> argClass = ptypes[ac];
MethodHandle lm = lengthMixer(argClass); MethodHandle lm = lengthMixer(argClass);
// Read these bottom up:
if (argClass.isPrimitive() && argClass != char.class) { if (argClass.isPrimitive() && argClass != char.class) {
// Compute new "index" in-place using old value plus the appropriate argument.
// 3. Drop old index, producing ("new-index", "coder", <args>) mh = MethodHandles.filterArgumentsWithCombiner(mh, 0, lm,
mh = MethodHandles.dropArguments(mh, 1, int.class); 0, // old-index
2 + ac // selected argument
// 2. Compute "new-index", producing ("new-index", "old-index", "coder", <args>)
// Length mixer needs old index, plus the appropriate argument
mh = MethodHandles.foldArguments(mh, 0, lm,
1, // old-index
3 + ac // selected argument
); );
// 1. The mh shape here is ("old-index", "coder", <args>); we don't need to recalculate
// the coder for non-char primitive arguments
} else { } else {
MethodHandle cm = coderMixer(argClass); MethodHandle cm = coderMixer(argClass);
// 4. Drop old index and coder, producing ("new-index", "new-coder", <args>) // Compute new "index" in-place using old value plus the appropriate argument.
mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class); mh = MethodHandles.filterArgumentsWithCombiner(mh, 0, lm,
0, // old-index
// 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>) 2 + ac // selected argument
// Length mixer needs old index, plus the appropriate argument
mh = MethodHandles.foldArguments(mh, 0, lm,
2, // old-index
4 + ac // selected argument
); );
// 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>) // Compute new "coder" in-place using old value plus the appropriate argument.
// Coder mixer needs old coder, plus the appropriate argument. mh = MethodHandles.filterArgumentsWithCombiner(mh, 1, cm,
mh = MethodHandles.foldArguments(mh, 0, cm, 1, // old-coder
2, // old-coder 2 + ac // selected argument
3 + ac // selected argument
); );
// 1. The mh shape here is ("old-index", "old-coder", <args>)
} }
break; break;

View file

@ -1999,7 +1999,7 @@ public abstract class VarHandle {
/*non-public*/ /*non-public*/
final void updateVarForm(VarForm newVForm) { final void updateVarForm(VarForm newVForm) {
if (vform == newVForm) return; if (vform == newVForm) return;
UNSAFE.putObject(this, VFORM_OFFSET, newVForm); UNSAFE.putReference(this, VFORM_OFFSET, newVForm);
UNSAFE.fullFence(); UNSAFE.fullFence();
} }

View file

@ -34,8 +34,8 @@ final class VarHandles {
long foffset = MethodHandleNatives.objectFieldOffset(f); long foffset = MethodHandleNatives.objectFieldOffset(f);
if (!type.isPrimitive()) { if (!type.isPrimitive()) {
return f.isFinal() && !isWriteAllowedOnFinalFields return f.isFinal() && !isWriteAllowedOnFinalFields
? new VarHandleObjects.FieldInstanceReadOnly(refc, foffset, type) ? new VarHandleReferences.FieldInstanceReadOnly(refc, foffset, type)
: new VarHandleObjects.FieldInstanceReadWrite(refc, foffset, type); : new VarHandleReferences.FieldInstanceReadWrite(refc, foffset, type);
} }
else if (type == boolean.class) { else if (type == boolean.class) {
return f.isFinal() && !isWriteAllowedOnFinalFields return f.isFinal() && !isWriteAllowedOnFinalFields
@ -95,8 +95,8 @@ final class VarHandles {
long foffset = MethodHandleNatives.staticFieldOffset(f); long foffset = MethodHandleNatives.staticFieldOffset(f);
if (!type.isPrimitive()) { if (!type.isPrimitive()) {
return f.isFinal() && !isWriteAllowedOnFinalFields return f.isFinal() && !isWriteAllowedOnFinalFields
? new VarHandleObjects.FieldStaticReadOnly(base, foffset, type) ? new VarHandleReferences.FieldStaticReadOnly(base, foffset, type)
: new VarHandleObjects.FieldStaticReadWrite(base, foffset, type); : new VarHandleReferences.FieldStaticReadWrite(base, foffset, type);
} }
else if (type == boolean.class) { else if (type == boolean.class) {
return f.isFinal() && !isWriteAllowedOnFinalFields return f.isFinal() && !isWriteAllowedOnFinalFields
@ -155,7 +155,7 @@ final class VarHandles {
int ashift = 31 - Integer.numberOfLeadingZeros(ascale); int ashift = 31 - Integer.numberOfLeadingZeros(ascale);
if (!componentType.isPrimitive()) { if (!componentType.isPrimitive()) {
return new VarHandleObjects.Array(aoffset, ashift, arrayClass); return new VarHandleReferences.Array(aoffset, ashift, arrayClass);
} }
else if (componentType == boolean.class) { else if (componentType == boolean.class) {
return new VarHandleBooleans.Array(aoffset, ashift); return new VarHandleBooleans.Array(aoffset, ashift);

View file

@ -186,10 +186,17 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
#if[Object]
return UNSAFE.compareAndSetReference(
ba,
address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value));
#else[Object]
return UNSAFE.compareAndSet$RawType$( return UNSAFE.compareAndSet$RawType$(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
#end[Object]
} }
@ForceInline @ForceInline
@ -261,11 +268,19 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static $type$ getAndSet(ArrayHandle handle, Object oba, int index, $type$ value) { static $type$ getAndSet(ArrayHandle handle, Object oba, int index, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
#if[Object]
return convEndian(handle.be,
UNSAFE.getAndSetReference(
ba,
address(ba, index(ba, index)),
convEndian(handle.be, value)));
#else[Object]
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.getAndSet$RawType$( UNSAFE.getAndSet$RawType$(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, value))); convEndian(handle.be, value)));
#end[Object]
} }
@ForceInline @ForceInline
@ -537,13 +552,13 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
#if[floatingPoint] #if[floatingPoint]
$rawType$ rawValue = UNSAFE.get$RawType$Unaligned( $rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), ((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
handle.be); handle.be);
return $Type$.$rawType$BitsTo$Type$(rawValue); return $Type$.$rawType$BitsTo$Type$(rawValue);
#else[floatingPoint] #else[floatingPoint]
return UNSAFE.get$Type$Unaligned( return UNSAFE.get$Type$Unaligned(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), ((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
handle.be); handle.be);
#end[floatingPoint] #end[floatingPoint]
@ -554,13 +569,13 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
#if[floatingPoint] #if[floatingPoint]
UNSAFE.put$RawType$Unaligned( UNSAFE.put$RawType$Unaligned(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), ((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
$Type$.$type$ToRaw$RawType$Bits(value), $Type$.$type$ToRaw$RawType$Bits(value),
handle.be); handle.be);
#else[floatingPoint] #else[floatingPoint]
UNSAFE.put$Type$Unaligned( UNSAFE.put$Type$Unaligned(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS), ((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
value, value,
handle.be); handle.be);
@ -572,7 +587,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.get$RawType$Volatile( UNSAFE.get$RawType$Volatile(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, index(bb, index)))); address(bb, index(bb, index))));
} }
@ -580,7 +595,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) { static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
UNSAFE.put$RawType$Volatile( UNSAFE.put$RawType$Volatile(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, value)); convEndian(handle.be, value));
} }
@ -590,7 +605,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.get$RawType$Acquire( UNSAFE.get$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, index(bb, index)))); address(bb, index(bb, index))));
} }
@ -598,7 +613,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
UNSAFE.put$RawType$Release( UNSAFE.put$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, value)); convEndian(handle.be, value));
} }
@ -608,7 +623,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.get$RawType$Opaque( UNSAFE.get$RawType$Opaque(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, index(bb, index)))); address(bb, index(bb, index))));
} }
@ -616,7 +631,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) { static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
UNSAFE.put$RawType$Opaque( UNSAFE.put$RawType$Opaque(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, value)); convEndian(handle.be, value));
} }
@ -625,10 +640,17 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return UNSAFE.compareAndSet$RawType$( #if[Object]
UNSAFE.getObject(bb, BYTE_BUFFER_HB), return UNSAFE.compareAndSetReference(
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
#else[Object]
return UNSAFE.compareAndSet$RawType$(
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value));
#end[Object]
} }
@ForceInline @ForceInline
@ -636,7 +658,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.compareAndExchange$RawType$( UNSAFE.compareAndExchange$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value))); convEndian(handle.be, expected), convEndian(handle.be, value)));
} }
@ -646,7 +668,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.compareAndExchange$RawType$Acquire( UNSAFE.compareAndExchange$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value))); convEndian(handle.be, expected), convEndian(handle.be, value)));
} }
@ -656,7 +678,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.compareAndExchange$RawType$Release( UNSAFE.compareAndExchange$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value))); convEndian(handle.be, expected), convEndian(handle.be, value)));
} }
@ -665,7 +687,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return UNSAFE.weakCompareAndSet$RawType$Plain( return UNSAFE.weakCompareAndSet$RawType$Plain(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
} }
@ -674,7 +696,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return UNSAFE.weakCompareAndSet$RawType$( return UNSAFE.weakCompareAndSet$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
} }
@ -683,7 +705,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return UNSAFE.weakCompareAndSet$RawType$Acquire( return UNSAFE.weakCompareAndSet$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
} }
@ -692,7 +714,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return UNSAFE.weakCompareAndSet$RawType$Release( return UNSAFE.weakCompareAndSet$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
} }
@ -700,11 +722,19 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) { static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
#if[Object]
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.getAndSet$RawType$( UNSAFE.getAndSetReference(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, value))); convEndian(handle.be, value)));
#else[Object]
return convEndian(handle.be,
UNSAFE.getAndSet$RawType$(
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)),
convEndian(handle.be, value)));
#end[Object]
} }
@ForceInline @ForceInline
@ -712,7 +742,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.getAndSet$RawType$Acquire( UNSAFE.getAndSet$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, value))); convEndian(handle.be, value)));
} }
@ -722,7 +752,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.getAndSet$RawType$Release( UNSAFE.getAndSet$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, value))); convEndian(handle.be, value)));
} }
@ -734,7 +764,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndAdd$RawType$( return UNSAFE.getAndAdd$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
delta); delta);
} else { } else {
@ -747,7 +777,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndAdd$RawType$Acquire( return UNSAFE.getAndAdd$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
delta); delta);
} else { } else {
@ -760,7 +790,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndAdd$RawType$Release( return UNSAFE.getAndAdd$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
delta); delta);
} else { } else {
@ -771,7 +801,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) { static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) {
$type$ nativeExpectedValue, expectedValue; $type$ nativeExpectedValue, expectedValue;
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
long offset = address(bb, indexRO(bb, index)); long offset = address(bb, indexRO(bb, index));
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
@ -788,7 +818,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseOr$RawType$( return UNSAFE.getAndBitwiseOr$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -801,7 +831,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseOr$RawType$Release( return UNSAFE.getAndBitwiseOr$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -814,7 +844,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseOr$RawType$Acquire( return UNSAFE.getAndBitwiseOr$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -825,7 +855,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
$type$ nativeExpectedValue, expectedValue; $type$ nativeExpectedValue, expectedValue;
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
long offset = address(bb, indexRO(bb, index)); long offset = address(bb, indexRO(bb, index));
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
@ -840,7 +870,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseAnd$RawType$( return UNSAFE.getAndBitwiseAnd$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -853,7 +883,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseAnd$RawType$Release( return UNSAFE.getAndBitwiseAnd$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -866,7 +896,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseAnd$RawType$Acquire( return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -877,7 +907,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
$type$ nativeExpectedValue, expectedValue; $type$ nativeExpectedValue, expectedValue;
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
long offset = address(bb, indexRO(bb, index)); long offset = address(bb, indexRO(bb, index));
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
@ -893,7 +923,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseXor$RawType$( return UNSAFE.getAndBitwiseXor$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -906,7 +936,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseXor$RawType$Release( return UNSAFE.getAndBitwiseXor$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -919,7 +949,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb); ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
if (handle.be == BE) { if (handle.be == BE) {
return UNSAFE.getAndBitwiseXor$RawType$Acquire( return UNSAFE.getAndBitwiseXor$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getReference(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
value); value);
} else { } else {
@ -930,7 +960,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
$type$ nativeExpectedValue, expectedValue; $type$ nativeExpectedValue, expectedValue;
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
long offset = address(bb, indexRO(bb, index)); long offset = address(bb, indexRO(bb, index));
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);

View file

@ -4079,7 +4079,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
} }
static void setIntValVolatile(BigDecimal bd, BigInteger val) { static void setIntValVolatile(BigDecimal bd, BigInteger val) {
unsafe.putObjectVolatile(bd, intValOffset, val); unsafe.putReferenceVolatile(bd, intValOffset, val);
} }
} }

View file

@ -4600,7 +4600,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
} }
static void putMag(BigInteger bi, int[] magnitude) { static void putMag(BigInteger bi, int[] magnitude) {
unsafe.putObject(bi, magOffset, magnitude); unsafe.putReference(bi, magOffset, magnitude);
} }
} }

View file

@ -641,7 +641,7 @@ class Inet6Address extends InetAddress {
ipaddress, scope_id, scope_id_set, scope_ifname, scope_ifname_set ipaddress, scope_id, scope_id_set, scope_ifname, scope_ifname_set
); );
UNSAFE.putObject(this, FIELDS_OFFSET, h); UNSAFE.putReference(this, FIELDS_OFFSET, h);
} }
/** /**

View file

@ -1734,7 +1734,7 @@ class InetAddress implements java.io.Serializable {
throw new InvalidObjectException("invalid address family type: " + family); throw new InvalidObjectException("invalid address family type: " + family);
} }
InetAddressHolder h = new InetAddressHolder(host, address, family); InetAddressHolder h = new InetAddressHolder(host, address, family);
UNSAFE.putObject(this, FIELDS_OFFSET, h); UNSAFE.putReference(this, FIELDS_OFFSET, h);
} }
/* needed because the serializable fields no longer exist */ /* needed because the serializable fields no longer exist */

View file

@ -293,7 +293,7 @@ public class InetSocketAddress
InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname, InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname,
oisAddr, oisAddr,
oisPort); oisPort);
UNSAFE.putObject(this, FIELDS_OFFSET, h); UNSAFE.putReference(this, FIELDS_OFFSET, h);
} }
private void readObjectNoData() private void readObjectNoData()

View file

@ -232,11 +232,8 @@ class SocketInputStream extends FileInputStream {
* @return the number of immediately available bytes * @return the number of immediately available bytes
*/ */
public int available() throws IOException { public int available() throws IOException {
if (eof) { int available = impl.available();
return 0; return eof ? 0 : available;
} else {
return impl.available();
}
} }
/** /**

View file

@ -1222,6 +1222,6 @@ class Random implements java.io.Serializable {
} catch (Exception ex) { throw new Error(ex); } } catch (Exception ex) { throw new Error(ex); }
} }
private void resetSeed(long seedVal) { private void resetSeed(long seedVal) {
unsafe.putObjectVolatile(this, seedOffset, new AtomicLong(seedVal)); unsafe.putReferenceVolatile(this, seedOffset, new AtomicLong(seedVal));
} }
} }

View file

@ -757,16 +757,16 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static final <K,V> Node<K,V> tabAt(Node<K,V>[] tab, int i) { static final <K,V> Node<K,V> tabAt(Node<K,V>[] tab, int i) {
return (Node<K,V>)U.getObjectAcquire(tab, ((long)i << ASHIFT) + ABASE); return (Node<K,V>)U.getReferenceAcquire(tab, ((long)i << ASHIFT) + ABASE);
} }
static final <K,V> boolean casTabAt(Node<K,V>[] tab, int i, static final <K,V> boolean casTabAt(Node<K,V>[] tab, int i,
Node<K,V> c, Node<K,V> v) { Node<K,V> c, Node<K,V> v) {
return U.compareAndSetObject(tab, ((long)i << ASHIFT) + ABASE, c, v); return U.compareAndSetReference(tab, ((long)i << ASHIFT) + ABASE, c, v);
} }
static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) { static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) {
U.putObjectRelease(tab, ((long)i << ASHIFT) + ABASE, v); U.putReferenceRelease(tab, ((long)i << ASHIFT) + ABASE, v);
} }
/* ---------------- Fields -------------- */ /* ---------------- Fields -------------- */

View file

@ -976,13 +976,13 @@ public class ThreadLocalRandom extends Random {
* Erases ThreadLocals by nulling out Thread maps. * Erases ThreadLocals by nulling out Thread maps.
*/ */
static final void eraseThreadLocals(Thread thread) { static final void eraseThreadLocals(Thread thread) {
U.putObject(thread, THREADLOCALS, null); U.putReference(thread, THREADLOCALS, null);
U.putObject(thread, INHERITABLETHREADLOCALS, null); U.putReference(thread, INHERITABLETHREADLOCALS, null);
} }
static final void setInheritedAccessControlContext(Thread thread, static final void setInheritedAccessControlContext(Thread thread,
AccessControlContext acc) { AccessControlContext acc) {
U.putObjectRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc); U.putReferenceRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc);
} }
// Serialization support // Serialization support

View file

@ -439,39 +439,39 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
public final boolean compareAndSet(T obj, V expect, V update) { public final boolean compareAndSet(T obj, V expect, V update) {
accessCheck(obj); accessCheck(obj);
valueCheck(update); valueCheck(update);
return U.compareAndSetObject(obj, offset, expect, update); return U.compareAndSetReference(obj, offset, expect, update);
} }
public final boolean weakCompareAndSet(T obj, V expect, V update) { public final boolean weakCompareAndSet(T obj, V expect, V update) {
// same implementation as strong form for now // same implementation as strong form for now
accessCheck(obj); accessCheck(obj);
valueCheck(update); valueCheck(update);
return U.compareAndSetObject(obj, offset, expect, update); return U.compareAndSetReference(obj, offset, expect, update);
} }
public final void set(T obj, V newValue) { public final void set(T obj, V newValue) {
accessCheck(obj); accessCheck(obj);
valueCheck(newValue); valueCheck(newValue);
U.putObjectVolatile(obj, offset, newValue); U.putReferenceVolatile(obj, offset, newValue);
} }
public final void lazySet(T obj, V newValue) { public final void lazySet(T obj, V newValue) {
accessCheck(obj); accessCheck(obj);
valueCheck(newValue); valueCheck(newValue);
U.putObjectRelease(obj, offset, newValue); U.putReferenceRelease(obj, offset, newValue);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public final V get(T obj) { public final V get(T obj) {
accessCheck(obj); accessCheck(obj);
return (V)U.getObjectVolatile(obj, offset); return (V)U.getReferenceVolatile(obj, offset);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public final V getAndSet(T obj, V newValue) { public final V getAndSet(T obj, V newValue) {
accessCheck(obj); accessCheck(obj);
valueCheck(newValue); valueCheck(newValue);
return (V)U.getAndSetObject(obj, offset, newValue); return (V)U.getAndSetReference(obj, offset, newValue);
} }
} }
} }

View file

@ -141,7 +141,7 @@ public class LockSupport {
private static void setBlocker(Thread t, Object arg) { private static void setBlocker(Thread t, Object arg) {
// Even though volatile, hotspot doesn't need a write barrier here. // Even though volatile, hotspot doesn't need a write barrier here.
U.putObject(t, PARKBLOCKER, arg); U.putReference(t, PARKBLOCKER, arg);
} }
/** /**
@ -291,7 +291,7 @@ public class LockSupport {
public static Object getBlocker(Thread t) { public static Object getBlocker(Thread t) {
if (t == null) if (t == null)
throw new NullPointerException(); throw new NullPointerException();
return U.getObjectVolatile(t, PARKBLOCKER); return U.getReferenceVolatile(t, PARKBLOCKER);
} }
/** /**

View file

@ -25,7 +25,6 @@
package java.util.zip; package java.util.zip;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.file.attribute.FileTime; import java.nio.file.attribute.FileTime;
import java.security.AccessController; import java.security.AccessController;
@ -40,7 +39,6 @@ import java.util.concurrent.TimeUnit;
import static java.util.zip.ZipConstants.ENDHDR; import static java.util.zip.ZipConstants.ENDHDR;
import jdk.internal.misc.Unsafe; import jdk.internal.misc.Unsafe;
import sun.nio.ch.DirectBuffer;
class ZipUtils { class ZipUtils {
@ -295,7 +293,7 @@ class ZipUtils {
private static final long byteBufferOffsetOffset = unsafe.objectFieldOffset(ByteBuffer.class, "offset"); private static final long byteBufferOffsetOffset = unsafe.objectFieldOffset(ByteBuffer.class, "offset");
static byte[] getBufferArray(ByteBuffer byteBuffer) { static byte[] getBufferArray(ByteBuffer byteBuffer) {
return (byte[]) unsafe.getObject(byteBuffer, byteBufferArrayOffset); return (byte[]) unsafe.getReference(byteBuffer, byteBufferArrayOffset);
} }
static int getBufferOffset(ByteBuffer byteBuffer) { static int getBufferOffset(ByteBuffer byteBuffer) {

View file

@ -98,8 +98,8 @@ public final class InnocuousThread extends Thread {
private InnocuousThread(ThreadGroup group, Runnable target, String name, ClassLoader tccl) { private InnocuousThread(ThreadGroup group, Runnable target, String name, ClassLoader tccl) {
super(group, target, name, 0L, false); super(group, target, name, 0L, false);
UNSAFE.putObjectRelease(this, INHERITEDACCESSCONTROLCONTEXT, ACC); UNSAFE.putReferenceRelease(this, INHERITEDACCESSCONTROLCONTEXT, ACC);
UNSAFE.putObjectRelease(this, CONTEXTCLASSLOADER, tccl); UNSAFE.putReferenceRelease(this, CONTEXTCLASSLOADER, tccl);
} }
@Override @Override
@ -120,8 +120,8 @@ public final class InnocuousThread extends Thread {
* Drops all thread locals (and inherited thread locals). * Drops all thread locals (and inherited thread locals).
*/ */
public final void eraseThreadLocals() { public final void eraseThreadLocals() {
UNSAFE.putObject(this, THREAD_LOCALS, null); UNSAFE.putReference(this, THREAD_LOCALS, null);
UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null); UNSAFE.putReference(this, INHERITABLE_THREAD_LOCALS, null);
} }
// ensure run method is run only once // ensure run method is run only once
@ -158,10 +158,10 @@ public final class InnocuousThread extends Thread {
long tg = UNSAFE.objectFieldOffset(tk, "group"); long tg = UNSAFE.objectFieldOffset(tk, "group");
long gp = UNSAFE.objectFieldOffset(gk, "parent"); long gp = UNSAFE.objectFieldOffset(gk, "parent");
ThreadGroup group = (ThreadGroup) ThreadGroup group = (ThreadGroup)
UNSAFE.getObject(Thread.currentThread(), tg); UNSAFE.getReference(Thread.currentThread(), tg);
while (group != null) { while (group != null) {
ThreadGroup parent = (ThreadGroup)UNSAFE.getObject(group, gp); ThreadGroup parent = (ThreadGroup)UNSAFE.getReference(group, gp);
if (parent == null) if (parent == null)
break; break;
group = parent; group = parent;

View file

@ -179,7 +179,7 @@ public final class Unsafe {
* @see #getInt(Object, long) * @see #getInt(Object, long)
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public native Object getObject(Object o, long offset); public native Object getReference(Object o, long offset);
/** /**
* Stores a reference value into a given Java variable. * Stores a reference value into a given Java variable.
@ -192,7 +192,7 @@ public final class Unsafe {
* @see #putInt(Object, long, int) * @see #putInt(Object, long, int)
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public native void putObject(Object o, long offset, Object x); public native void putReference(Object o, long offset, Object x);
/** @see #getInt(Object, long) */ /** @see #getInt(Object, long) */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
@ -1297,55 +1297,55 @@ public final class Unsafe {
* @return {@code true} if successful * @return {@code true} if successful
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public final native boolean compareAndSetObject(Object o, long offset, public final native boolean compareAndSetReference(Object o, long offset,
Object expected,
Object x);
@HotSpotIntrinsicCandidate
public final native Object compareAndExchangeReference(Object o, long offset,
Object expected,
Object x);
@HotSpotIntrinsicCandidate
public final Object compareAndExchangeReferenceAcquire(Object o, long offset,
Object expected,
Object x) {
return compareAndExchangeReference(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final Object compareAndExchangeReferenceRelease(Object o, long offset,
Object expected,
Object x) {
return compareAndExchangeReference(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetReferencePlain(Object o, long offset,
Object expected,
Object x) {
return compareAndSetReference(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetReferenceAcquire(Object o, long offset,
Object expected,
Object x) {
return compareAndSetReference(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetReferenceRelease(Object o, long offset,
Object expected,
Object x) {
return compareAndSetReference(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetReference(Object o, long offset,
Object expected, Object expected,
Object x); Object x) {
return compareAndSetReference(o, offset, expected, x);
@HotSpotIntrinsicCandidate
public final native Object compareAndExchangeObject(Object o, long offset,
Object expected,
Object x);
@HotSpotIntrinsicCandidate
public final Object compareAndExchangeObjectAcquire(Object o, long offset,
Object expected,
Object x) {
return compareAndExchangeObject(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final Object compareAndExchangeObjectRelease(Object o, long offset,
Object expected,
Object x) {
return compareAndExchangeObject(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetObjectPlain(Object o, long offset,
Object expected,
Object x) {
return compareAndSetObject(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetObjectAcquire(Object o, long offset,
Object expected,
Object x) {
return compareAndSetObject(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetObjectRelease(Object o, long offset,
Object expected,
Object x) {
return compareAndSetObject(o, offset, expected, x);
}
@HotSpotIntrinsicCandidate
public final boolean weakCompareAndSetObject(Object o, long offset,
Object expected,
Object x) {
return compareAndSetObject(o, offset, expected, x);
} }
/** /**
@ -1958,17 +1958,17 @@ public final class Unsafe {
/** /**
* Fetches a reference value from a given Java variable, with volatile * Fetches a reference value from a given Java variable, with volatile
* load semantics. Otherwise identical to {@link #getObject(Object, long)} * load semantics. Otherwise identical to {@link #getReference(Object, long)}
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public native Object getObjectVolatile(Object o, long offset); public native Object getReferenceVolatile(Object o, long offset);
/** /**
* Stores a reference value into a given Java variable, with * Stores a reference value into a given Java variable, with
* volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)} * volatile store semantics. Otherwise identical to {@link #putReference(Object, long, Object)}
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public native void putObjectVolatile(Object o, long offset, Object x); public native void putReferenceVolatile(Object o, long offset, Object x);
/** Volatile version of {@link #getInt(Object, long)} */ /** Volatile version of {@link #getInt(Object, long)} */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
@ -2036,10 +2036,10 @@ public final class Unsafe {
/** Acquire version of {@link #getObjectVolatile(Object, long)} */ /** Acquire version of {@link #getReferenceVolatile(Object, long)} */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public final Object getObjectAcquire(Object o, long offset) { public final Object getReferenceAcquire(Object o, long offset) {
return getObjectVolatile(o, offset); return getReferenceVolatile(o, offset);
} }
/** Acquire version of {@link #getBooleanVolatile(Object, long)} */ /** Acquire version of {@link #getBooleanVolatile(Object, long)} */
@ -2091,7 +2091,7 @@ public final class Unsafe {
} }
/* /*
* Versions of {@link #putObjectVolatile(Object, long, Object)} * Versions of {@link #putReferenceVolatile(Object, long, Object)}
* that do not guarantee immediate visibility of the store to * that do not guarantee immediate visibility of the store to
* other threads. This method is generally only useful if the * other threads. This method is generally only useful if the
* underlying field is a Java volatile (or if an array cell, one * underlying field is a Java volatile (or if an array cell, one
@ -2100,10 +2100,10 @@ public final class Unsafe {
* Corresponds to C11 atomic_store_explicit(..., memory_order_release). * Corresponds to C11 atomic_store_explicit(..., memory_order_release).
*/ */
/** Release version of {@link #putObjectVolatile(Object, long, Object)} */ /** Release version of {@link #putReferenceVolatile(Object, long, Object)} */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public final void putObjectRelease(Object o, long offset, Object x) { public final void putReferenceRelease(Object o, long offset, Object x) {
putObjectVolatile(o, offset, x); putReferenceVolatile(o, offset, x);
} }
/** Release version of {@link #putBooleanVolatile(Object, long, boolean)} */ /** Release version of {@link #putBooleanVolatile(Object, long, boolean)} */
@ -2156,10 +2156,10 @@ public final class Unsafe {
// ------------------------------ Opaque -------------------------------------- // ------------------------------ Opaque --------------------------------------
/** Opaque version of {@link #getObjectVolatile(Object, long)} */ /** Opaque version of {@link #getReferenceVolatile(Object, long)} */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public final Object getObjectOpaque(Object o, long offset) { public final Object getReferenceOpaque(Object o, long offset) {
return getObjectVolatile(o, offset); return getReferenceVolatile(o, offset);
} }
/** Opaque version of {@link #getBooleanVolatile(Object, long)} */ /** Opaque version of {@link #getBooleanVolatile(Object, long)} */
@ -2210,10 +2210,10 @@ public final class Unsafe {
return getDoubleVolatile(o, offset); return getDoubleVolatile(o, offset);
} }
/** Opaque version of {@link #putObjectVolatile(Object, long, Object)} */ /** Opaque version of {@link #putReferenceVolatile(Object, long, Object)} */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public final void putObjectOpaque(Object o, long offset, Object x) { public final void putReferenceOpaque(Object o, long offset, Object x) {
putObjectVolatile(o, offset, x); putReferenceVolatile(o, offset, x);
} }
/** Opaque version of {@link #putBooleanVolatile(Object, long, boolean)} */ /** Opaque version of {@link #putBooleanVolatile(Object, long, boolean)} */
@ -2642,29 +2642,29 @@ public final class Unsafe {
* @since 1.8 * @since 1.8
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate
public final Object getAndSetObject(Object o, long offset, Object newValue) { public final Object getAndSetReference(Object o, long offset, Object newValue) {
Object v; Object v;
do { do {
v = getObjectVolatile(o, offset); v = getReferenceVolatile(o, offset);
} while (!weakCompareAndSetObject(o, offset, v, newValue)); } while (!weakCompareAndSetReference(o, offset, v, newValue));
return v; return v;
} }
@ForceInline @ForceInline
public final Object getAndSetObjectRelease(Object o, long offset, Object newValue) { public final Object getAndSetReferenceRelease(Object o, long offset, Object newValue) {
Object v; Object v;
do { do {
v = getObject(o, offset); v = getReference(o, offset);
} while (!weakCompareAndSetObjectRelease(o, offset, v, newValue)); } while (!weakCompareAndSetReferenceRelease(o, offset, v, newValue));
return v; return v;
} }
@ForceInline @ForceInline
public final Object getAndSetObjectAcquire(Object o, long offset, Object newValue) { public final Object getAndSetReferenceAcquire(Object o, long offset, Object newValue) {
Object v; Object v;
do { do {
v = getObjectAcquire(o, offset); v = getReferenceAcquire(o, offset);
} while (!weakCompareAndSetObjectAcquire(o, offset, v, newValue)); } while (!weakCompareAndSetReferenceAcquire(o, offset, v, newValue));
return v; return v;
} }

View file

@ -34,7 +34,7 @@ class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl {
public Object get(Object obj) throws IllegalArgumentException { public Object get(Object obj) throws IllegalArgumentException {
ensureObj(obj); ensureObj(obj);
return unsafe.getObject(obj, fieldOffset); return unsafe.getReference(obj, fieldOffset);
} }
public boolean getBoolean(Object obj) throws IllegalArgumentException { public boolean getBoolean(Object obj) throws IllegalArgumentException {
@ -81,7 +81,7 @@ class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl {
throwSetIllegalArgumentException(value); throwSetIllegalArgumentException(value);
} }
} }
unsafe.putObject(obj, fieldOffset, value); unsafe.putReference(obj, fieldOffset, value);
} }
public void setBoolean(Object obj, boolean z) public void setBoolean(Object obj, boolean z)

View file

@ -36,7 +36,7 @@ class UnsafeQualifiedObjectFieldAccessorImpl
public Object get(Object obj) throws IllegalArgumentException { public Object get(Object obj) throws IllegalArgumentException {
ensureObj(obj); ensureObj(obj);
return unsafe.getObjectVolatile(obj, fieldOffset); return unsafe.getReferenceVolatile(obj, fieldOffset);
} }
public boolean getBoolean(Object obj) throws IllegalArgumentException { public boolean getBoolean(Object obj) throws IllegalArgumentException {
@ -83,7 +83,7 @@ class UnsafeQualifiedObjectFieldAccessorImpl
throwSetIllegalArgumentException(value); throwSetIllegalArgumentException(value);
} }
} }
unsafe.putObjectVolatile(obj, fieldOffset, value); unsafe.putReferenceVolatile(obj, fieldOffset, value);
} }
public void setBoolean(Object obj, boolean z) public void setBoolean(Object obj, boolean z)

View file

@ -35,7 +35,7 @@ class UnsafeQualifiedStaticObjectFieldAccessorImpl
} }
public Object get(Object obj) throws IllegalArgumentException { public Object get(Object obj) throws IllegalArgumentException {
return unsafe.getObjectVolatile(base, fieldOffset); return unsafe.getReferenceVolatile(base, fieldOffset);
} }
public boolean getBoolean(Object obj) throws IllegalArgumentException { public boolean getBoolean(Object obj) throws IllegalArgumentException {
@ -81,7 +81,7 @@ class UnsafeQualifiedStaticObjectFieldAccessorImpl
throwSetIllegalArgumentException(value); throwSetIllegalArgumentException(value);
} }
} }
unsafe.putObjectVolatile(base, fieldOffset, value); unsafe.putReferenceVolatile(base, fieldOffset, value);
} }
public void setBoolean(Object obj, boolean z) public void setBoolean(Object obj, boolean z)

View file

@ -33,7 +33,7 @@ class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl
} }
public Object get(Object obj) throws IllegalArgumentException { public Object get(Object obj) throws IllegalArgumentException {
return unsafe.getObject(base, fieldOffset); return unsafe.getReference(base, fieldOffset);
} }
public boolean getBoolean(Object obj) throws IllegalArgumentException { public boolean getBoolean(Object obj) throws IllegalArgumentException {
@ -79,7 +79,7 @@ class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl
throwSetIllegalArgumentException(value); throwSetIllegalArgumentException(value);
} }
} }
unsafe.putObject(base, fieldOffset, value); unsafe.putReference(base, fieldOffset, value);
} }
public void setBoolean(Object obj, boolean z) public void setBoolean(Object obj, boolean z)

View file

@ -624,12 +624,12 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
static void setType(AnnotationInvocationHandler o, static void setType(AnnotationInvocationHandler o,
Class<? extends Annotation> type) { Class<? extends Annotation> type) {
unsafe.putObject(o, typeOffset, type); unsafe.putReference(o, typeOffset, type);
} }
static void setMemberValues(AnnotationInvocationHandler o, static void setMemberValues(AnnotationInvocationHandler o,
Map<String, Object> memberValues) { Map<String, Object> memberValues) {
unsafe.putObject(o, memberValuesOffset, memberValues); unsafe.putReference(o, memberValuesOffset, memberValues);
} }
} }
} }

View file

@ -356,12 +356,12 @@ enum SignatureScheme {
} else if (SSLLogger.isOn && } else if (SSLLogger.isOn &&
SSLLogger.isOn("ssl,handshake,verbose")) { SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest( SSLLogger.finest(
"Ignore disabled signature sheme: " + ss.name); "Ignore disabled signature scheme: " + ss.name);
} }
} else if (SSLLogger.isOn && } else if (SSLLogger.isOn &&
SSLLogger.isOn("ssl,handshake,verbose")) { SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest( SSLLogger.finest(
"Ignore inactive signature sheme: " + ss.name); "Ignore inactive signature scheme: " + ss.name);
} }
} }

View file

@ -179,7 +179,7 @@ public class PrincipalName implements Cloneable {
public Object clone() { public Object clone() {
try { try {
PrincipalName pName = (PrincipalName) super.clone(); PrincipalName pName = (PrincipalName) super.clone();
UNSAFE.putObject(this, NAME_STRINGS_OFFSET, nameStrings.clone()); UNSAFE.putReference(this, NAME_STRINGS_OFFSET, nameStrings.clone());
return pName; return pName;
} catch (CloneNotSupportedException ex) { } catch (CloneNotSupportedException ex) {
throw new AssertionError("Should never happen"); throw new AssertionError("Should never happen");

View file

@ -724,17 +724,14 @@ jobject getJavaOID(JNIEnv *env, gss_OID cOid) {
if (jbytes == NULL) { if (jbytes == NULL) {
return NULL; return NULL;
} }
(*env)->SetByteArrayRegion(env, jbytes, 0, 2, (jbyte *) oidHdr); if (!(*env)->ExceptionCheck(env)) {
if ((*env)->ExceptionCheck(env)) { (*env)->SetByteArrayRegion(env, jbytes, 0, 2, (jbyte *) oidHdr);
return NULL;
} }
(*env)->SetByteArrayRegion(env, jbytes, 2, cLen, (jbyte *) cOid->elements); if (!(*env)->ExceptionCheck(env)) {
if ((*env)->ExceptionCheck(env)) { (*env)->SetByteArrayRegion(env, jbytes, 2, cLen, (jbyte *) cOid->elements);
return NULL;
} }
result = (*env)->NewObject(env, CLS_Oid, MID_Oid_ctor1, jbytes); if (!(*env)->ExceptionCheck(env)) {
if ((*env)->ExceptionCheck(env)) { result = (*env)->NewObject(env, CLS_Oid, MID_Oid_ctor1, jbytes);
return NULL;
} }
(*env)->DeleteLocalRef(env, jbytes); (*env)->DeleteLocalRef(env, jbytes);
return result; return result;

View file

@ -74,8 +74,8 @@ public class SafeThread extends Thread {
* Drops all thread locals (and inherited thread locals). * Drops all thread locals (and inherited thread locals).
*/ */
public final void eraseThreadLocals() { public final void eraseThreadLocals() {
UNSAFE.putObject(this, THREAD_LOCALS, null); UNSAFE.putReference(this, THREAD_LOCALS, null);
UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null); UNSAFE.putReference(this, INHERITABLE_THREAD_LOCALS, null);
} }
static { static {

View file

@ -203,7 +203,7 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider {
assert verifyReadRawObject(ret, baseConstant, initialDisplacement); assert verifyReadRawObject(ret, baseConstant, initialDisplacement);
} else { } else {
assert runtime.getConfig().useCompressedOops == compressed; assert runtime.getConfig().useCompressedOops == compressed;
ret = UNSAFE.getObject(base, displacement); ret = UNSAFE.getReference(base, displacement);
} }
return ret; return ret;
} }
@ -233,7 +233,7 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider {
case Double: case Double:
return JavaConstant.forDouble(isVolatile ? UNSAFE.getDoubleVolatile(obj, displacement) : UNSAFE.getDouble(obj, displacement)); return JavaConstant.forDouble(isVolatile ? UNSAFE.getDoubleVolatile(obj, displacement) : UNSAFE.getDouble(obj, displacement));
case Object: case Object:
return HotSpotObjectConstantImpl.forObject(isVolatile ? UNSAFE.getObjectVolatile(obj, displacement) : UNSAFE.getObject(obj, displacement)); return HotSpotObjectConstantImpl.forObject(isVolatile ? UNSAFE.getReferenceVolatile(obj, displacement) : UNSAFE.getReference(obj, displacement));
default: default:
throw new IllegalArgumentException("Unsupported kind: " + kind); throw new IllegalArgumentException("Unsupported kind: " + kind);
} }

View file

@ -312,8 +312,8 @@ public class CheckGraalIntrinsics extends GraalTest {
"jdk/internal/misc/Unsafe.compareAndExchangeIntRelease(Ljava/lang/Object;JII)I", "jdk/internal/misc/Unsafe.compareAndExchangeIntRelease(Ljava/lang/Object;JII)I",
"jdk/internal/misc/Unsafe.compareAndExchangeLongAcquire(Ljava/lang/Object;JJJ)J", "jdk/internal/misc/Unsafe.compareAndExchangeLongAcquire(Ljava/lang/Object;JJJ)J",
"jdk/internal/misc/Unsafe.compareAndExchangeLongRelease(Ljava/lang/Object;JJJ)J", "jdk/internal/misc/Unsafe.compareAndExchangeLongRelease(Ljava/lang/Object;JJJ)J",
"jdk/internal/misc/Unsafe.compareAndExchangeObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "jdk/internal/misc/Unsafe.compareAndExchangeReferenceAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "jdk/internal/misc/Unsafe.compareAndExchangeReferenceRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeShortAcquire(Ljava/lang/Object;JSS)S", "jdk/internal/misc/Unsafe.compareAndExchangeShortAcquire(Ljava/lang/Object;JSS)S",
"jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S", "jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S",
@ -330,10 +330,10 @@ public class CheckGraalIntrinsics extends GraalTest {
"jdk/internal/misc/Unsafe.weakCompareAndSetLongAcquire(Ljava/lang/Object;JJJ)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetLongAcquire(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetLongPlain(Ljava/lang/Object;JJJ)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetLongPlain(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetLongRelease(Ljava/lang/Object;JJJ)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetLongRelease(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetReference(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetReferenceAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectPlain(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetReferencePlain(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetReferenceRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShort(Ljava/lang/Object;JSS)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetShort(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShortAcquire(Ljava/lang/Object;JSS)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetShortAcquire(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShortPlain(Ljava/lang/Object;JSS)Z", "jdk/internal/misc/Unsafe.weakCompareAndSetShortPlain(Ljava/lang/Object;JSS)Z",
@ -399,7 +399,7 @@ public class CheckGraalIntrinsics extends GraalTest {
"sun/misc/Unsafe.getAndAddLong(Ljava/lang/Object;JJ)J", "sun/misc/Unsafe.getAndAddLong(Ljava/lang/Object;JJ)J",
"sun/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I", "sun/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I",
"sun/misc/Unsafe.getAndSetLong(Ljava/lang/Object;JJ)J", "sun/misc/Unsafe.getAndSetLong(Ljava/lang/Object;JJ)J",
"sun/misc/Unsafe.getAndSetObject(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;"); "sun/misc/Unsafe.getAndSetReference(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;");
if (isJDK9OrHigher()) { if (isJDK9OrHigher()) {
if (!(arch instanceof AArch64)) { if (!(arch instanceof AArch64)) {
@ -412,7 +412,7 @@ public class CheckGraalIntrinsics extends GraalTest {
"jdk/internal/misc/Unsafe.getAndAddLong(Ljava/lang/Object;JJ)J", "jdk/internal/misc/Unsafe.getAndAddLong(Ljava/lang/Object;JJ)J",
"jdk/internal/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I", "jdk/internal/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I",
"jdk/internal/misc/Unsafe.getAndSetLong(Ljava/lang/Object;JJ)J", "jdk/internal/misc/Unsafe.getAndSetLong(Ljava/lang/Object;JJ)J",
"jdk/internal/misc/Unsafe.getAndSetObject(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;"); "jdk/internal/misc/Unsafe.getAndSetReference(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;");
} }
add(toBeInvestigated, add(toBeInvestigated,
"jdk/internal/misc/Unsafe.getCharUnaligned(Ljava/lang/Object;J)C", "jdk/internal/misc/Unsafe.getCharUnaligned(Ljava/lang/Object;J)C",

View file

@ -32,6 +32,7 @@ import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.Una
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.SIN; import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.SIN;
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN; import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN;
import static org.graalvm.compiler.serviceprovider.GraalServices.JAVA_SPECIFICATION_VERSION; import static org.graalvm.compiler.serviceprovider.GraalServices.JAVA_SPECIFICATION_VERSION;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java11OrEarlier;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier; import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier;
import org.graalvm.compiler.bytecode.BytecodeProvider; import org.graalvm.compiler.bytecode.BytecodeProvider;
@ -179,8 +180,8 @@ public class AArch64GraphBuilderPlugins {
for (JavaKind kind : unsafeJavaKinds) { for (JavaKind kind : unsafeJavaKinds) {
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass(); Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
String kindName = (kind == JavaKind.Object && !Java11OrEarlier) ? "Reference" : kind.name();
r.register4("getAndSet" + kind.name(), Receiver.class, Object.class, long.class, javaClass, new InvocationPlugin() { r.register4("getAndSet" + kindName, Receiver.class, Object.class, long.class, javaClass, new InvocationPlugin() {
@Override @Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) {
// Emits a null-check for the otherwise unused receiver // Emits a null-check for the otherwise unused receiver
@ -192,7 +193,7 @@ public class AArch64GraphBuilderPlugins {
}); });
if (kind != JavaKind.Boolean && kind.isNumericInteger()) { if (kind != JavaKind.Boolean && kind.isNumericInteger()) {
r.register4("getAndAdd" + kind.name(), Receiver.class, Object.class, long.class, javaClass, new InvocationPlugin() { r.register4("getAndAdd" + kindName, Receiver.class, Object.class, long.class, javaClass, new InvocationPlugin() {
@Override @Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode delta) { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode delta) {
// Emits a null-check for the otherwise unused receiver // Emits a null-check for the otherwise unused receiver

View file

@ -33,6 +33,7 @@ import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.Una
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.SIN; import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.SIN;
import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN; import static org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode.UnaryOperation.TAN;
import static org.graalvm.compiler.serviceprovider.GraalServices.JAVA_SPECIFICATION_VERSION; import static org.graalvm.compiler.serviceprovider.GraalServices.JAVA_SPECIFICATION_VERSION;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java11OrEarlier;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier; import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier;
import java.util.Arrays; import java.util.Arrays;
@ -230,18 +231,18 @@ public class AMD64GraphBuilderPlugins {
} }
private static void registerUnsafePlugins(InvocationPlugins plugins, BytecodeProvider replacementsBytecodeProvider, boolean explicitUnsafeNullChecks) { private static void registerUnsafePlugins(InvocationPlugins plugins, BytecodeProvider replacementsBytecodeProvider, boolean explicitUnsafeNullChecks) {
registerUnsafePlugins(new Registration(plugins, Unsafe.class), explicitUnsafeNullChecks, new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object}); registerUnsafePlugins(new Registration(plugins, Unsafe.class), explicitUnsafeNullChecks, new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object}, true);
if (!Java8OrEarlier) { if (!Java8OrEarlier) {
registerUnsafePlugins(new Registration(plugins, "jdk.internal.misc.Unsafe", replacementsBytecodeProvider), explicitUnsafeNullChecks, registerUnsafePlugins(new Registration(plugins, "jdk.internal.misc.Unsafe", replacementsBytecodeProvider), explicitUnsafeNullChecks,
new JavaKind[]{JavaKind.Boolean, JavaKind.Byte, JavaKind.Char, JavaKind.Short, JavaKind.Int, JavaKind.Long, JavaKind.Object}); new JavaKind[]{JavaKind.Boolean, JavaKind.Byte, JavaKind.Char, JavaKind.Short, JavaKind.Int, JavaKind.Long, JavaKind.Object}, Java11OrEarlier);
} }
} }
private static void registerUnsafePlugins(Registration r, boolean explicitUnsafeNullChecks, JavaKind[] unsafeJavaKinds) { private static void registerUnsafePlugins(Registration r, boolean explicitUnsafeNullChecks, JavaKind[] unsafeJavaKinds, boolean java11OrEarlier) {
for (JavaKind kind : unsafeJavaKinds) { for (JavaKind kind : unsafeJavaKinds) {
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass(); Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
String kindName = (kind == JavaKind.Object && !java11OrEarlier) ? "Reference" : kind.name();
r.register4("getAndSet" + kind.name(), Receiver.class, Object.class, long.class, javaClass, new UnsafeAccessPlugin(kind, explicitUnsafeNullChecks) { r.register4("getAndSet" + kindName, Receiver.class, Object.class, long.class, javaClass, new UnsafeAccessPlugin(kind, explicitUnsafeNullChecks) {
@Override @Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) {
// Emits a null-check for the otherwise unused receiver // Emits a null-check for the otherwise unused receiver
@ -251,7 +252,7 @@ public class AMD64GraphBuilderPlugins {
} }
}); });
if (kind != JavaKind.Boolean && kind.isNumericInteger()) { if (kind != JavaKind.Boolean && kind.isNumericInteger()) {
r.register4("getAndAdd" + kind.name(), Receiver.class, Object.class, long.class, javaClass, new UnsafeAccessPlugin(kind, explicitUnsafeNullChecks) { r.register4("getAndAdd" + kindName, Receiver.class, Object.class, long.class, javaClass, new UnsafeAccessPlugin(kind, explicitUnsafeNullChecks) {
@Override @Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode delta) { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode delta) {
// Emits a null-check for the otherwise unused receiver // Emits a null-check for the otherwise unused receiver

View file

@ -121,9 +121,9 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.compareAndSetDouble(container, doubleOffset, 0.125, 0.25); return unsafe.compareAndSetDouble(container, doubleOffset, 0.125, 0.25);
} }
public static boolean unsafeCompareAndSetObject() { public static boolean unsafeCompareAndSetReference() {
Container container = new Container(); Container container = new Container();
return unsafe.compareAndSetObject(container, objectOffset, dummyValue, newDummyValue); return unsafe.compareAndSetReference(container, objectOffset, dummyValue, newDummyValue);
} }
public static boolean unsafeCompareAndExchangeBoolean() { public static boolean unsafeCompareAndExchangeBoolean() {
@ -166,9 +166,9 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.compareAndExchangeDouble(container, doubleOffset, 0.125, 0.25); return unsafe.compareAndExchangeDouble(container, doubleOffset, 0.125, 0.25);
} }
public static Object unsafeCompareAndExchangeObject() { public static Object unsafeCompareAndExchangeReference() {
Container container = new Container(); Container container = new Container();
return unsafe.compareAndExchangeObject(container, objectOffset, dummyValue, newDummyValue); return unsafe.compareAndExchangeReference(container, objectOffset, dummyValue, newDummyValue);
} }
@Test @Test
@ -183,7 +183,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
testGraph("unsafeCompareAndSetLong"); testGraph("unsafeCompareAndSetLong");
testGraph("unsafeCompareAndSetFloat"); testGraph("unsafeCompareAndSetFloat");
testGraph("unsafeCompareAndSetDouble"); testGraph("unsafeCompareAndSetDouble");
testGraph("unsafeCompareAndSetObject"); testGraph("unsafeCompareAndSetReference");
testGraph("unsafeCompareAndExchangeBoolean"); testGraph("unsafeCompareAndExchangeBoolean");
testGraph("unsafeCompareAndExchangeByte"); testGraph("unsafeCompareAndExchangeByte");
testGraph("unsafeCompareAndExchangeChar"); testGraph("unsafeCompareAndExchangeChar");
@ -192,7 +192,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
testGraph("unsafeCompareAndExchangeLong"); testGraph("unsafeCompareAndExchangeLong");
testGraph("unsafeCompareAndExchangeFloat"); testGraph("unsafeCompareAndExchangeFloat");
testGraph("unsafeCompareAndExchangeDouble"); testGraph("unsafeCompareAndExchangeDouble");
testGraph("unsafeCompareAndExchangeObject"); testGraph("unsafeCompareAndExchangeReference");
} }
test("unsafeCompareAndSetBoolean"); test("unsafeCompareAndSetBoolean");
test("unsafeCompareAndSetByte"); test("unsafeCompareAndSetByte");
@ -202,7 +202,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
test("unsafeCompareAndSetLong"); test("unsafeCompareAndSetLong");
test("unsafeCompareAndSetFloat"); test("unsafeCompareAndSetFloat");
test("unsafeCompareAndSetDouble"); test("unsafeCompareAndSetDouble");
test("unsafeCompareAndSetObject"); test("unsafeCompareAndSetReference");
test("unsafeCompareAndExchangeBoolean"); test("unsafeCompareAndExchangeBoolean");
test("unsafeCompareAndExchangeByte"); test("unsafeCompareAndExchangeByte");
test("unsafeCompareAndExchangeChar"); test("unsafeCompareAndExchangeChar");
@ -211,7 +211,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
test("unsafeCompareAndExchangeLong"); test("unsafeCompareAndExchangeLong");
test("unsafeCompareAndExchangeFloat"); test("unsafeCompareAndExchangeFloat");
test("unsafeCompareAndExchangeDouble"); test("unsafeCompareAndExchangeDouble");
test("unsafeCompareAndExchangeObject"); test("unsafeCompareAndExchangeReference");
} }
public static int unsafeGetAndAddByte() { public static int unsafeGetAndAddByte() {
@ -288,11 +288,11 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.getAndSetLong(container, longOffset, 0x12345678abL); return unsafe.getAndSetLong(container, longOffset, 0x12345678abL);
} }
public static Object unsafeGetAndSetObject() { public static Object unsafeGetAndSetReference() {
Container container = new Container(); Container container = new Container();
container.objectField = null; container.objectField = null;
Container other = new Container(); Container other = new Container();
return unsafe.getAndSetObject(container, objectOffset, other); return unsafe.getAndSetReference(container, objectOffset, other);
} }
@Test @Test
@ -307,7 +307,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
if (target.arch instanceof AMD64 || target.arch instanceof AArch64) { if (target.arch instanceof AMD64 || target.arch instanceof AArch64) {
testGraph("unsafeGetAndSetInt"); testGraph("unsafeGetAndSetInt");
testGraph("unsafeGetAndSetLong"); testGraph("unsafeGetAndSetLong");
testGraph("unsafeGetAndSetObject"); testGraph("unsafeGetAndSetReference");
} }
test("unsafeGetAndSetBoolean"); test("unsafeGetAndSetBoolean");
test("unsafeGetAndSetByte"); test("unsafeGetAndSetByte");
@ -315,7 +315,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
test("unsafeGetAndSetShort"); test("unsafeGetAndSetShort");
test("unsafeGetAndSetInt"); test("unsafeGetAndSetInt");
test("unsafeGetAndSetLong"); test("unsafeGetAndSetLong");
test("unsafeGetAndSetObject"); test("unsafeGetAndSetReference");
} }
public static void fieldInstance() { public static void fieldInstance() {
@ -562,10 +562,10 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.getDouble(container, doubleOffset); return unsafe.getDouble(container, doubleOffset);
} }
public static Object unsafeGetPutObject() { public static Object unsafeGetPutReference() {
Container container = new Container(); Container container = new Container();
unsafe.putObject(container, objectOffset, "Hello there"); unsafe.putReference(container, objectOffset, "Hello there");
return unsafe.getObject(container, objectOffset); return unsafe.getReference(container, objectOffset);
} }
public static boolean unsafeGetPutBooleanOpaque() { public static boolean unsafeGetPutBooleanOpaque() {
@ -616,10 +616,10 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.getDoubleOpaque(container, doubleOffset); return unsafe.getDoubleOpaque(container, doubleOffset);
} }
public static Object unsafeGetPutObjectOpaque() { public static Object unsafeGetPutReferenceOpaque() {
Container container = new Container(); Container container = new Container();
unsafe.putObjectOpaque(container, objectOffset, "Hello there"); unsafe.putReferenceOpaque(container, objectOffset, "Hello there");
return unsafe.getObjectOpaque(container, objectOffset); return unsafe.getReferenceOpaque(container, objectOffset);
} }
public static boolean unsafeGetPutBooleanRA() { public static boolean unsafeGetPutBooleanRA() {
@ -670,10 +670,10 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.getDoubleAcquire(container, doubleOffset); return unsafe.getDoubleAcquire(container, doubleOffset);
} }
public static Object unsafeGetPutObjectRA() { public static Object unsafeGetPutReferenceRA() {
Container container = new Container(); Container container = new Container();
unsafe.putObjectRelease(container, objectOffset, "Hello there"); unsafe.putReferenceRelease(container, objectOffset, "Hello there");
return unsafe.getObjectAcquire(container, objectOffset); return unsafe.getReferenceAcquire(container, objectOffset);
} }
public static boolean unsafeGetPutBooleanVolatile() { public static boolean unsafeGetPutBooleanVolatile() {
@ -724,10 +724,10 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
return unsafe.getDoubleVolatile(container, doubleOffset); return unsafe.getDoubleVolatile(container, doubleOffset);
} }
public static Object unsafeGetPutObjectVolatile() { public static Object unsafeGetPutReferenceVolatile() {
Container container = new Container(); Container container = new Container();
unsafe.putObjectVolatile(container, objectOffset, "Hello there"); unsafe.putReferenceVolatile(container, objectOffset, "Hello there");
return unsafe.getObjectVolatile(container, objectOffset); return unsafe.getReferenceVolatile(container, objectOffset);
} }
@Test @Test
@ -786,7 +786,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
testGraph("unsafeGetPutLongRA"); testGraph("unsafeGetPutLongRA");
testGraph("unsafeGetPutFloatRA"); testGraph("unsafeGetPutFloatRA");
testGraph("unsafeGetPutDoubleRA"); testGraph("unsafeGetPutDoubleRA");
testGraph("unsafeGetPutObjectRA"); testGraph("unsafeGetPutReferenceRA");
test("unsafeGetPutBooleanRA"); test("unsafeGetPutBooleanRA");
test("unsafeGetPutByteRA"); test("unsafeGetPutByteRA");
@ -796,7 +796,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
test("unsafeGetPutLongRA"); test("unsafeGetPutLongRA");
test("unsafeGetPutFloatRA"); test("unsafeGetPutFloatRA");
test("unsafeGetPutDoubleRA"); test("unsafeGetPutDoubleRA");
test("unsafeGetPutObjectRA"); test("unsafeGetPutReferenceRA");
} }
@Test @Test
@ -809,7 +809,7 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
testGraph("unsafeGetPutLongVolatile"); testGraph("unsafeGetPutLongVolatile");
testGraph("unsafeGetPutFloatVolatile"); testGraph("unsafeGetPutFloatVolatile");
testGraph("unsafeGetPutDoubleVolatile"); testGraph("unsafeGetPutDoubleVolatile");
testGraph("unsafeGetPutObjectVolatile"); testGraph("unsafeGetPutReferenceVolatile");
test("unsafeGetPutBooleanVolatile"); test("unsafeGetPutBooleanVolatile");
test("unsafeGetPutByteVolatile"); test("unsafeGetPutByteVolatile");
@ -819,6 +819,6 @@ public class UnsafeReplacementsTest extends MethodSubstitutionTest {
test("unsafeGetPutLongVolatile"); test("unsafeGetPutLongVolatile");
test("unsafeGetPutFloatVolatile"); test("unsafeGetPutFloatVolatile");
test("unsafeGetPutDoubleVolatile"); test("unsafeGetPutDoubleVolatile");
test("unsafeGetPutObjectVolatile"); test("unsafeGetPutReferenceVolatile");
} }
} }

View file

@ -33,6 +33,7 @@ import static jdk.vm.ci.code.MemoryBarriers.LOAD_STORE;
import static jdk.vm.ci.code.MemoryBarriers.STORE_LOAD; import static jdk.vm.ci.code.MemoryBarriers.STORE_LOAD;
import static jdk.vm.ci.code.MemoryBarriers.STORE_STORE; import static jdk.vm.ci.code.MemoryBarriers.STORE_STORE;
import static org.graalvm.compiler.nodes.NamedLocationIdentity.OFF_HEAP_LOCATION; import static org.graalvm.compiler.nodes.NamedLocationIdentity.OFF_HEAP_LOCATION;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java11OrEarlier;
import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier; import static org.graalvm.compiler.serviceprovider.GraalServices.Java8OrEarlier;
import java.lang.reflect.Array; import java.lang.reflect.Array;
@ -270,10 +271,11 @@ public class StandardGraphBuilderPlugins {
} }
private abstract static class UnsafeCompareAndUpdatePluginsRegistrar { private abstract static class UnsafeCompareAndUpdatePluginsRegistrar {
public void register(Registration r, String casPrefix, boolean explicitUnsafeNullChecks, JavaKind[] compareAndSwapTypes) { public void register(Registration r, String casPrefix, boolean explicitUnsafeNullChecks, JavaKind[] compareAndSwapTypes, boolean java11OrEarlier) {
for (JavaKind kind : compareAndSwapTypes) { for (JavaKind kind : compareAndSwapTypes) {
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass(); Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
r.register5(casPrefix + kind.name(), Receiver.class, Object.class, long.class, javaClass, javaClass, new UnsafeAccessPlugin(returnKind(kind), explicitUnsafeNullChecks) { String kindName = (kind == JavaKind.Object && !java11OrEarlier) ? "Reference" : kind.name();
r.register5(casPrefix + kindName, Receiver.class, Object.class, long.class, javaClass, javaClass, new UnsafeAccessPlugin(returnKind(kind), explicitUnsafeNullChecks) {
@Override @Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode expected, ValueNode x) { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode expected, ValueNode x) {
// Emits a null-check for the otherwise unused receiver // Emits a null-check for the otherwise unused receiver
@ -332,10 +334,10 @@ public class StandardGraphBuilderPlugins {
private static void registerPlatformSpecificUnsafePlugins(JavaKind[] supportedCasKinds, Registration r, boolean java8OrEarlier, boolean explicitUnsafeNullChecks) { private static void registerPlatformSpecificUnsafePlugins(JavaKind[] supportedCasKinds, Registration r, boolean java8OrEarlier, boolean explicitUnsafeNullChecks) {
if (java8OrEarlier) { if (java8OrEarlier) {
unsafeCompareAndSwapPluginsRegistrar.register(r, "compareAndSwap", explicitUnsafeNullChecks, new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object}); unsafeCompareAndSwapPluginsRegistrar.register(r, "compareAndSwap", explicitUnsafeNullChecks, new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object}, true);
} else { } else {
unsafeCompareAndSwapPluginsRegistrar.register(r, "compareAndSet", explicitUnsafeNullChecks, supportedCasKinds); unsafeCompareAndSwapPluginsRegistrar.register(r, "compareAndSet", explicitUnsafeNullChecks, supportedCasKinds, Java11OrEarlier);
unsafeCompareAndExchangePluginsRegistrar.register(r, "compareAndExchange", explicitUnsafeNullChecks, supportedCasKinds); unsafeCompareAndExchangePluginsRegistrar.register(r, "compareAndExchange", explicitUnsafeNullChecks, supportedCasKinds, Java11OrEarlier);
} }
} }
@ -346,11 +348,11 @@ public class StandardGraphBuilderPlugins {
} }
} }
private static void registerUnsafePlugins(Registration r, boolean java8OrEarlier, boolean explicitUnsafeNullChecks) { private static void registerUnsafePlugins(Registration r, boolean sunMiscUnsafe, boolean explicitUnsafeNullChecks) {
for (JavaKind kind : JavaKind.values()) { for (JavaKind kind : JavaKind.values()) {
if ((kind.isPrimitive() && kind != JavaKind.Void) || kind == JavaKind.Object) { if ((kind.isPrimitive() && kind != JavaKind.Void) || kind == JavaKind.Object) {
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass(); Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
String kindName = kind.name(); String kindName = (kind == JavaKind.Object && !sunMiscUnsafe && !Java11OrEarlier) ? "Reference" : kind.name();
String getName = "get" + kindName; String getName = "get" + kindName;
String putName = "put" + kindName; String putName = "put" + kindName;
// Object-based accesses // Object-based accesses
@ -360,7 +362,7 @@ public class StandardGraphBuilderPlugins {
r.register3(getName + "Volatile", Receiver.class, Object.class, long.class, new UnsafeGetPlugin(kind, AccessKind.VOLATILE, explicitUnsafeNullChecks)); r.register3(getName + "Volatile", Receiver.class, Object.class, long.class, new UnsafeGetPlugin(kind, AccessKind.VOLATILE, explicitUnsafeNullChecks));
r.register4(putName + "Volatile", Receiver.class, Object.class, long.class, javaClass, new UnsafePutPlugin(kind, AccessKind.VOLATILE, explicitUnsafeNullChecks)); r.register4(putName + "Volatile", Receiver.class, Object.class, long.class, javaClass, new UnsafePutPlugin(kind, AccessKind.VOLATILE, explicitUnsafeNullChecks));
// Ordered object-based accesses // Ordered object-based accesses
if (java8OrEarlier) { if (sunMiscUnsafe) {
if (kind == JavaKind.Int || kind == JavaKind.Long || kind == JavaKind.Object) { if (kind == JavaKind.Int || kind == JavaKind.Long || kind == JavaKind.Object) {
r.register4("putOrdered" + kindName, Receiver.class, Object.class, long.class, javaClass, new UnsafePutPlugin(kind, AccessKind.RELEASE_ACQUIRE, explicitUnsafeNullChecks)); r.register4("putOrdered" + kindName, Receiver.class, Object.class, long.class, javaClass, new UnsafePutPlugin(kind, AccessKind.RELEASE_ACQUIRE, explicitUnsafeNullChecks));
} }

View file

@ -61,6 +61,11 @@ public final class GraalServices {
*/ */
public static final boolean Java8OrEarlier = JAVA_SPECIFICATION_VERSION <= 8; public static final boolean Java8OrEarlier = JAVA_SPECIFICATION_VERSION <= 8;
/**
* Determines if the Java runtime is version 11 or earlier.
*/
public static final boolean Java11OrEarlier = JAVA_SPECIFICATION_VERSION <= 11;
private GraalServices() { private GraalServices() {
} }

View file

@ -864,7 +864,7 @@ public class JShellTool implements MessageHandler {
*/ */
@Override @Override
public void errormsg(String key, Object... args) { public void errormsg(String key, Object... args) {
error(messageFormat(key, args)); error("%s", messageFormat(key, args));
} }
/** /**

View file

@ -228,15 +228,15 @@ class CompletenessAnalyzer {
// Declarations and type parameters (thus expressions) // Declarations and type parameters (thus expressions)
EXTENDS(TokenKind.EXTENDS, XEXPR|XDECL), // extends EXTENDS(TokenKind.EXTENDS, XEXPR|XDECL), // extends
COMMA(TokenKind.COMMA, XEXPR|XDECL), // , COMMA(TokenKind.COMMA, XEXPR|XDECL), // ,
AMP(TokenKind.AMP, XEXPR|XDECL), // & AMP(TokenKind.AMP, XEXPR|XDECL, true), // &
GT(TokenKind.GT, XEXPR|XDECL), // > GT(TokenKind.GT, XEXPR|XDECL, true), // >
LT(TokenKind.LT, XEXPR|XDECL1), // < LT(TokenKind.LT, XEXPR|XDECL1, true), // <
LTLT(TokenKind.LTLT, XEXPR|XDECL1), // << LTLT(TokenKind.LTLT, XEXPR|XDECL1, true), // <<
GTGT(TokenKind.GTGT, XEXPR|XDECL), // >> GTGT(TokenKind.GTGT, XEXPR|XDECL, true), // >>
GTGTGT(TokenKind.GTGTGT, XEXPR|XDECL), // >>> GTGTGT(TokenKind.GTGTGT, XEXPR|XDECL, true), // >>>
QUES(TokenKind.QUES, XEXPR|XDECL), // ? QUES(TokenKind.QUES, XEXPR|XDECL, true), // ?
DOT(TokenKind.DOT, XEXPR|XDECL), // . DOT(TokenKind.DOT, XEXPR|XDECL), // .
STAR(TokenKind.STAR, XEXPR), // * (MAPPED: DOTSTAR) STAR(TokenKind.STAR, XEXPR, true), // * (MAPPED: DOTSTAR)
// Statement keywords // Statement keywords
ASSERT(TokenKind.ASSERT, XSTMT1|XSTART), // assert ASSERT(TokenKind.ASSERT, XSTMT1|XSTART), // assert
@ -249,7 +249,7 @@ class CompletenessAnalyzer {
FOR(TokenKind.FOR, XSTMT1|XSTART), // for FOR(TokenKind.FOR, XSTMT1|XSTART), // for
IF(TokenKind.IF, XSTMT1|XSTART), // if IF(TokenKind.IF, XSTMT1|XSTART), // if
RETURN(TokenKind.RETURN, XSTMT1|XTERM|XSTART), // return RETURN(TokenKind.RETURN, XSTMT1|XTERM|XSTART), // return
SWITCH(TokenKind.SWITCH, XSTMT1|XEXPR), // switch SWITCH(TokenKind.SWITCH, XSTMT1|XEXPR1), // switch
SYNCHRONIZED(TokenKind.SYNCHRONIZED, XSTMT1|XDECL), // synchronized SYNCHRONIZED(TokenKind.SYNCHRONIZED, XSTMT1|XDECL), // synchronized
THROW(TokenKind.THROW, XSTMT1|XSTART), // throw THROW(TokenKind.THROW, XSTMT1|XSTART), // throw
TRY(TokenKind.TRY, XSTMT1|XSTART), // try TRY(TokenKind.TRY, XSTMT1|XSTART), // try
@ -276,7 +276,7 @@ class CompletenessAnalyzer {
SUBSUB(TokenKind.SUBSUB, XEXPR1|XTERM), // -- SUBSUB(TokenKind.SUBSUB, XEXPR1|XTERM), // --
// Expressions cannot terminate // Expressions cannot terminate
INSTANCEOF(TokenKind.INSTANCEOF, XEXPR), // instanceof INSTANCEOF(TokenKind.INSTANCEOF, XEXPR, true), // instanceof
NEW(TokenKind.NEW, XEXPR1), // new (MAPPED: COLCOLNEW) NEW(TokenKind.NEW, XEXPR1), // new (MAPPED: COLCOLNEW)
SUPER(TokenKind.SUPER, XEXPR1|XDECL), // super -- shouldn't see as rec. But in type parameters SUPER(TokenKind.SUPER, XEXPR1|XDECL), // super -- shouldn't see as rec. But in type parameters
ARROW(TokenKind.ARROW, XEXPR), // -> ARROW(TokenKind.ARROW, XEXPR), // ->
@ -292,18 +292,18 @@ class CompletenessAnalyzer {
BANG(TokenKind.BANG, XEXPR1), // ! BANG(TokenKind.BANG, XEXPR1), // !
TILDE(TokenKind.TILDE, XEXPR1), // ~ TILDE(TokenKind.TILDE, XEXPR1), // ~
COLON(TokenKind.COLON, XEXPR|XTERM), // : COLON(TokenKind.COLON, XEXPR|XTERM), // :
EQEQ(TokenKind.EQEQ, XEXPR), // == EQEQ(TokenKind.EQEQ, XEXPR, true), // ==
LTEQ(TokenKind.LTEQ, XEXPR), // <= LTEQ(TokenKind.LTEQ, XEXPR, true), // <=
GTEQ(TokenKind.GTEQ, XEXPR), // >= GTEQ(TokenKind.GTEQ, XEXPR, true), // >=
BANGEQ(TokenKind.BANGEQ, XEXPR), // != BANGEQ(TokenKind.BANGEQ, XEXPR, true), // !=
AMPAMP(TokenKind.AMPAMP, XEXPR), // && AMPAMP(TokenKind.AMPAMP, XEXPR, true), // &&
BARBAR(TokenKind.BARBAR, XEXPR), // || BARBAR(TokenKind.BARBAR, XEXPR, true), // ||
PLUS(TokenKind.PLUS, XEXPR1), // + PLUS(TokenKind.PLUS, XEXPR1, true), // +
SUB(TokenKind.SUB, XEXPR1), // - SUB(TokenKind.SUB, XEXPR1, true), // -
SLASH(TokenKind.SLASH, XEXPR), // / SLASH(TokenKind.SLASH, XEXPR, true), // /
BAR(TokenKind.BAR, XEXPR), // | BAR(TokenKind.BAR, XEXPR, true), // |
CARET(TokenKind.CARET, XEXPR), // ^ CARET(TokenKind.CARET, XEXPR, true), // ^
PERCENT(TokenKind.PERCENT, XEXPR), // % PERCENT(TokenKind.PERCENT, XEXPR, true), // %
PLUSEQ(TokenKind.PLUSEQ, XEXPR), // += PLUSEQ(TokenKind.PLUSEQ, XEXPR), // +=
SUBEQ(TokenKind.SUBEQ, XEXPR), // -= SUBEQ(TokenKind.SUBEQ, XEXPR), // -=
STAREQ(TokenKind.STAREQ, XEXPR), // *= STAREQ(TokenKind.STAREQ, XEXPR), // *=
@ -330,6 +330,7 @@ class CompletenessAnalyzer {
final TokenKind tokenKind; final TokenKind tokenKind;
final int belongs; final int belongs;
final boolean valueOp;
Function<TK,TK> mapping; Function<TK,TK> mapping;
TK(int b) { TK(int b) {
@ -337,8 +338,13 @@ class CompletenessAnalyzer {
} }
TK(TokenKind tokenKind, int b) { TK(TokenKind tokenKind, int b) {
this(tokenKind, b, false);
}
TK(TokenKind tokenKind, int b, boolean valueOp) {
this.tokenKind = tokenKind; this.tokenKind = tokenKind;
this.belongs = b; this.belongs = b;
this.valueOp = valueOp;
this.mapping = null; this.mapping = null;
} }
@ -637,6 +643,8 @@ class CompletenessAnalyzer {
return parseExpressionStatement(); // Let this gen the status return parseExpressionStatement(); // Let this gen the status
} }
return error(); return error();
case XSTMT1o | XEXPR1o:
return disambiguateStatementVsExpression();
default: default:
throw new InternalError("Case not covered " + token.kind.belongs + " in " + token.kind); throw new InternalError("Case not covered " + token.kind.belongs + " in " + token.kind);
} }
@ -685,6 +693,44 @@ class CompletenessAnalyzer {
} }
} }
public Completeness disambiguateStatementVsExpression() {
if (token.kind == SWITCH) {
nextToken();
switch (token.kind) {
case PARENS:
nextToken();
break;
case UNMATCHED:
nextToken();
return Completeness.DEFINITELY_INCOMPLETE;
case EOF:
return Completeness.DEFINITELY_INCOMPLETE;
default:
return error();
}
switch (token.kind) {
case BRACES:
nextToken();
break;
case UNMATCHED:
nextToken();
return Completeness.DEFINITELY_INCOMPLETE;
case EOF:
return Completeness.DEFINITELY_INCOMPLETE;
default:
return error();
}
if (token.kind.valueOp) {
return parseExpressionOptionalSemi();
} else {
return Completeness.COMPLETE;
}
} else {
throw new InternalError("Unexpected statement/expression not covered " + token.kind.belongs + " in " + token.kind);
}
}
public Completeness disambiguateDeclarationVsExpression() { public Completeness disambiguateDeclarationVsExpression() {
// String folding messes up position information. // String folding messes up position information.
return parseFactory.apply(pt -> { return parseFactory.apply(pt -> {
@ -699,7 +745,7 @@ class CompletenessAnalyzer {
case LABELED_STATEMENT: case LABELED_STATEMENT:
if (shouldAbort(IDENTIFIER)) return checkResult; if (shouldAbort(IDENTIFIER)) return checkResult;
if (shouldAbort(COLON)) return checkResult; if (shouldAbort(COLON)) return checkResult;
return parseStatement(); return parseStatement();
case VARIABLE: case VARIABLE:
case IMPORT: case IMPORT:
case CLASS: case CLASS:

View file

@ -160,7 +160,6 @@ class ReplParser extends JavacParser {
case WHILE: case WHILE:
case DO: case DO:
case TRY: case TRY:
case SWITCH:
case RETURN: case RETURN:
case THROW: case THROW:
case BREAK: case BREAK:

View file

@ -196,7 +196,7 @@ public final class Unsafe {
*/ */
@ForceInline @ForceInline
public Object getObject(Object o, long offset) { public Object getObject(Object o, long offset) {
return theInternalUnsafe.getObject(o, offset); return theInternalUnsafe.getReference(o, offset);
} }
/** /**
@ -211,7 +211,7 @@ public final class Unsafe {
*/ */
@ForceInline @ForceInline
public void putObject(Object o, long offset, Object x) { public void putObject(Object o, long offset, Object x) {
theInternalUnsafe.putObject(o, offset, x); theInternalUnsafe.putReference(o, offset, x);
} }
/** @see #getInt(Object, long) */ /** @see #getInt(Object, long) */
@ -860,7 +860,7 @@ public final class Unsafe {
public final boolean compareAndSwapObject(Object o, long offset, public final boolean compareAndSwapObject(Object o, long offset,
Object expected, Object expected,
Object x) { Object x) {
return theInternalUnsafe.compareAndSetObject(o, offset, expected, x); return theInternalUnsafe.compareAndSetReference(o, offset, expected, x);
} }
/** /**
@ -901,7 +901,7 @@ public final class Unsafe {
*/ */
@ForceInline @ForceInline
public Object getObjectVolatile(Object o, long offset) { public Object getObjectVolatile(Object o, long offset) {
return theInternalUnsafe.getObjectVolatile(o, offset); return theInternalUnsafe.getReferenceVolatile(o, offset);
} }
/** /**
@ -910,7 +910,7 @@ public final class Unsafe {
*/ */
@ForceInline @ForceInline
public void putObjectVolatile(Object o, long offset, Object x) { public void putObjectVolatile(Object o, long offset, Object x) {
theInternalUnsafe.putObjectVolatile(o, offset, x); theInternalUnsafe.putReferenceVolatile(o, offset, x);
} }
/** Volatile version of {@link #getInt(Object, long)} */ /** Volatile version of {@link #getInt(Object, long)} */
@ -1020,7 +1020,7 @@ public final class Unsafe {
*/ */
@ForceInline @ForceInline
public void putOrderedObject(Object o, long offset, Object x) { public void putOrderedObject(Object o, long offset, Object x) {
theInternalUnsafe.putObjectRelease(o, offset, x); theInternalUnsafe.putReferenceRelease(o, offset, x);
} }
/** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */ /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */
@ -1168,7 +1168,7 @@ public final class Unsafe {
*/ */
@ForceInline @ForceInline
public final Object getAndSetObject(Object o, long offset, Object newValue) { public final Object getAndSetObject(Object o, long offset, Object newValue) {
return theInternalUnsafe.getAndSetObject(o, offset, newValue); return theInternalUnsafe.getAndSetReference(o, offset, newValue);
} }

View file

@ -95,12 +95,12 @@ public class Test7190310_unsafe {
obj = getRef3(unsafe, t, referent_offset); obj = getRef3(unsafe, t, referent_offset);
if (obj != o) { if (obj != o) {
System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + o); System.out.println("FAILED: unsafe.getReference(Object, " + referent_offset + ") " + obj + " != " + o);
System.exit(97); System.exit(97);
} }
obj = getRef4(unsafe, t, referent_offset); obj = getRef4(unsafe, t, referent_offset);
if (obj != o) { if (obj != o) {
System.out.println("FAILED: unsafe.getObject(Test7190310, " + referent_offset + ") " + obj + " != " + o); System.out.println("FAILED: unsafe.getReference(Test7190310, " + referent_offset + ") " + obj + " != " + o);
System.exit(97); System.exit(97);
} }
} }
@ -115,17 +115,17 @@ public class Test7190310_unsafe {
} }
obj = getRef1(unsafe, ref, referent_offset); obj = getRef1(unsafe, ref, referent_offset);
if (obj != str) { if (obj != str) {
System.out.println("FAILED: unsafe.getObject(weakRef, " + referent_offset + ") " + obj + " != " + str); System.out.println("FAILED: unsafe.getReference(weakRef, " + referent_offset + ") " + obj + " != " + str);
return false; return false;
} }
obj = getRef2(unsafe, ref, referent_offset); obj = getRef2(unsafe, ref, referent_offset);
if (obj != str) { if (obj != str) {
System.out.println("FAILED: unsafe.getObject(abstRef, " + referent_offset + ") " + obj + " != " + str); System.out.println("FAILED: unsafe.getReference(abstRef, " + referent_offset + ") " + obj + " != " + str);
return false; return false;
} }
obj = getRef3(unsafe, ref, referent_offset); obj = getRef3(unsafe, ref, referent_offset);
if (obj != str) { if (obj != str) {
System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + str); System.out.println("FAILED: unsafe.getReference(Object, " + referent_offset + ") " + obj + " != " + str);
return false; return false;
} }
return true; return true;
@ -136,19 +136,19 @@ public class Test7190310_unsafe {
} }
static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception { static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception {
return unsafe.getObject(ref, referent_offset); return unsafe.getReference(ref, referent_offset);
} }
static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception { static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception {
return unsafe.getObject(ref, referent_offset); return unsafe.getReference(ref, referent_offset);
} }
static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception { static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception {
return unsafe.getObject(ref, referent_offset); return unsafe.getReference(ref, referent_offset);
} }
static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception { static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception {
return unsafe.getObject(ref, referent_offset); return unsafe.getReference(ref, referent_offset);
} }
} }

View file

@ -75,6 +75,6 @@ class TestUnsafeVolatileCAS
public void testObj(Object x, Object o) public void testObj(Object x, Object o)
{ {
unsafe.compareAndSetObject(this, f_obj_off, x, o); unsafe.compareAndSetReference(this, f_obj_off, x, o);
} }
} }

View file

@ -51,6 +51,6 @@ class TestUnsafeVolatileLoad
public int testObj() public int testObj()
{ {
return ((Integer)unsafe.getObjectVolatile(this, f_obj_off)); return ((Integer)unsafe.getReferenceVolatile(this, f_obj_off));
} }
} }

View file

@ -74,6 +74,6 @@ class TestUnsafeVolatileStore
public void testObj(Object o) public void testObj(Object o)
{ {
unsafe.putObjectVolatile(this, f_obj_off, o); unsafe.putReferenceVolatile(this, f_obj_off, o);
} }
} }

View file

@ -25,7 +25,7 @@
* @test * @test
* @bug 8059022 * @bug 8059022
* @modules java.base/jdk.internal.misc:+open * @modules java.base/jdk.internal.misc:+open
* @summary Validate barriers after Unsafe getObject, CAS and swap (GetAndSet) * @summary Validate barriers after Unsafe getReference, CAS and swap (GetAndSet)
* @requires vm.gc.Z & !vm.graal.enabled * @requires vm.gc.Z & !vm.graal.enabled
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+ZUnmapBadViews -XX:ZCollectionInterval=1 -XX:-CreateCoredumpOnCrash -XX:CompileCommand=dontinline,*::mergeImpl* compiler.gcbarriers.UnsafeIntrinsicsTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:+UnlockDiagnosticVMOptions -XX:+ZUnmapBadViews -XX:ZCollectionInterval=1 -XX:-CreateCoredumpOnCrash -XX:CompileCommand=dontinline,*::mergeImpl* compiler.gcbarriers.UnsafeIntrinsicsTest
*/ */
@ -263,19 +263,19 @@ class Runner implements Runnable {
private Node mergeImplLoad(Node startNode, Node expectedNext, Node head) { private Node mergeImplLoad(Node startNode, Node expectedNext, Node head) {
// Atomic load version // Atomic load version
Node temp = (Node) UNSAFE.getObject(startNode, offset); Node temp = (Node) UNSAFE.getReference(startNode, offset);
startNode.setNext(head); startNode.setNext(head);
return temp; return temp;
} }
private Node mergeImplSwap(Node startNode, Node expectedNext, Node head) { private Node mergeImplSwap(Node startNode, Node expectedNext, Node head) {
// Swap version // Swap version
return (Node) UNSAFE.getAndSetObject(startNode, offset, head); return (Node) UNSAFE.getAndSetReference(startNode, offset, head);
} }
private Node mergeImplCAS(Node startNode, Node expectedNext, Node head) { private Node mergeImplCAS(Node startNode, Node expectedNext, Node head) {
// CAS - should always be true within a single thread - no other thread can have overwritten // CAS - should always be true within a single thread - no other thread can have overwritten
if (!UNSAFE.compareAndSetObject(startNode, offset, expectedNext, head)) { if (!UNSAFE.compareAndSetReference(startNode, offset, expectedNext, head)) {
throw new Error("CAS should always succeed on thread local objects, check you barrier implementation"); throw new Error("CAS should always succeed on thread local objects, check you barrier implementation");
} }
return expectedNext; // continue on old circle return expectedNext; // continue on old circle
@ -283,7 +283,7 @@ class Runner implements Runnable {
private Node mergeImplCASFail(Node startNode, Node expectedNext, Node head) { private Node mergeImplCASFail(Node startNode, Node expectedNext, Node head) {
// Force a fail // Force a fail
if (UNSAFE.compareAndSetObject(startNode, offset, "fail", head)) { if (UNSAFE.compareAndSetReference(startNode, offset, "fail", head)) {
throw new Error("This CAS should always fail, check you barrier implementation"); throw new Error("This CAS should always fail, check you barrier implementation");
} }
if (startNode.next() != expectedNext) { if (startNode.next() != expectedNext) {
@ -294,7 +294,7 @@ class Runner implements Runnable {
private Node mergeImplWeakCAS(Node startNode, Node expectedNext, Node head) { private Node mergeImplWeakCAS(Node startNode, Node expectedNext, Node head) {
// Weak CAS - should always be true within a single thread - no other thread can have overwritten // Weak CAS - should always be true within a single thread - no other thread can have overwritten
if (!UNSAFE.weakCompareAndSetObject(startNode, offset, expectedNext, head)) { if (!UNSAFE.weakCompareAndSetReference(startNode, offset, expectedNext, head)) {
throw new Error("Weak CAS should always succeed on thread local objects, check you barrier implementation"); throw new Error("Weak CAS should always succeed on thread local objects, check you barrier implementation");
} }
return expectedNext; // continue on old circle return expectedNext; // continue on old circle
@ -302,7 +302,7 @@ class Runner implements Runnable {
private Node mergeImplWeakCASFail(Node startNode, Node expectedNext, Node head) { private Node mergeImplWeakCASFail(Node startNode, Node expectedNext, Node head) {
// Force a fail // Force a fail
if (UNSAFE.weakCompareAndSetObject(startNode, offset, "fail", head)) { if (UNSAFE.weakCompareAndSetReference(startNode, offset, "fail", head)) {
throw new Error("This weak CAS should always fail, check you barrier implementation"); throw new Error("This weak CAS should always fail, check you barrier implementation");
} }
if (startNode.next() != expectedNext) { if (startNode.next() != expectedNext) {
@ -313,7 +313,7 @@ class Runner implements Runnable {
private Node mergeImplCMPX(Node startNode, Node expectedNext, Node head) { private Node mergeImplCMPX(Node startNode, Node expectedNext, Node head) {
// CmpX - should always be true within a single thread - no other thread can have overwritten // CmpX - should always be true within a single thread - no other thread can have overwritten
Object res = UNSAFE.compareAndExchangeObject(startNode, offset, expectedNext, head); Object res = UNSAFE.compareAndExchangeReference(startNode, offset, expectedNext, head);
if (!res.equals(expectedNext)) { if (!res.equals(expectedNext)) {
throw new Error("Fail CmpX should always succeed on thread local objects, check you barrier implementation"); throw new Error("Fail CmpX should always succeed on thread local objects, check you barrier implementation");
} }
@ -321,7 +321,7 @@ class Runner implements Runnable {
} }
private Node mergeImplCMPXFail(Node startNode, Node expectedNext, Node head) { private Node mergeImplCMPXFail(Node startNode, Node expectedNext, Node head) {
Object res = UNSAFE.compareAndExchangeObject(startNode, offset, head, head); Object res = UNSAFE.compareAndExchangeReference(startNode, offset, head, head);
if (startNode.next() != expectedNext) { if (startNode.next() != expectedNext) {
throw new Error("Shouldn't have changed"); throw new Error("Shouldn't have changed");
} }

View file

@ -25,7 +25,7 @@
/** /**
* @test * @test
* @bug 8167298 * @bug 8167298
* @summary Unsafe.compareAndExchangeObject should keep track of returned type after matching * @summary Unsafe.compareAndExchangeReference should keep track of returned type after matching
* @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.misc
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-UseCompressedOops TestCAEAntiDep * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-UseCompressedOops TestCAEAntiDep
* *
@ -54,7 +54,7 @@ public class TestCAEAntiDep {
} }
static int m(TestCAEAntiDep test, Object expected, Object x) { static int m(TestCAEAntiDep test, Object expected, Object x) {
C old = (C)UNSAFE.compareAndExchangeObject(test, O_OFFSET, expected, x); C old = (C)UNSAFE.compareAndExchangeReference(test, O_OFFSET, expected, x);
int res = old.f1; int res = old.f1;
old.f1 = 0x42; old.f1 = 0x42;
return res; return res;

View file

@ -52,7 +52,7 @@ public class TestUnsafeMismatchedArrayFieldAccess {
static final long array_offset; static final long array_offset;
void m() { void m() {
UNSAFE.getObject(this, array_offset); UNSAFE.getReference(this, array_offset);
} }
static public void main(String[] args) { static public void main(String[] args) {

View file

@ -49,7 +49,7 @@ public class UnsafeAccess {
static Object helperUnsafeAccess(Object o, boolean isObjArray) { static Object helperUnsafeAccess(Object o, boolean isObjArray) {
if (isObjArray) { if (isObjArray) {
U.putObject(o, off, new Object()); U.putReference(o, off, new Object());
} }
return o; return o;
} }
@ -63,8 +63,8 @@ public class UnsafeAccess {
static Object helperUnsafeLoadStore(Object o, boolean isObjArray) { static Object helperUnsafeLoadStore(Object o, boolean isObjArray) {
if (isObjArray) { if (isObjArray) {
Object o1 = U.getObject(o, off); Object o1 = U.getReference(o, off);
U.compareAndSetObject(o, off, o1, new Object()); U.compareAndSetReference(o, off, o1, new Object());
} }
return o; return o;
} }

View file

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 8027751 * @bug 8027751
* @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill * @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetReference() intrinsic because of the new value spill
* @requires vm.gc.G1 * @requires vm.gc.G1
* *
* @run main/othervm -XX:+UseG1GC compiler.regalloc.C1ObjectSpillInLogicOp * @run main/othervm -XX:+UseG1GC compiler.regalloc.C1ObjectSpillInLogicOp

View file

@ -71,6 +71,6 @@ public class GetUnsafeObjectG1PreBarrier {
} }
private void readField(Object o, long fieldOffset) { private void readField(Object o, long fieldOffset) {
unsafe.getObject(o, fieldOffset); unsafe.getReference(o, fieldOffset);
} }
} }

View file

@ -119,141 +119,141 @@ public class JdkInternalMiscUnsafeAccessTestObject {
static void testAccess(Object base, long offset) { static void testAccess(Object base, long offset) {
// Plain // Plain
{ {
UNSAFE.putObject(base, offset, "foo"); UNSAFE.putReference(base, offset, "foo");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "set Object value"); assertEquals(x, "foo", "set Object value");
} }
// Volatile // Volatile
{ {
UNSAFE.putObjectVolatile(base, offset, "bar"); UNSAFE.putReferenceVolatile(base, offset, "bar");
Object x = UNSAFE.getObjectVolatile(base, offset); Object x = UNSAFE.getReferenceVolatile(base, offset);
assertEquals(x, "bar", "putVolatile Object value"); assertEquals(x, "bar", "putVolatile Object value");
} }
// Lazy // Lazy
{ {
UNSAFE.putObjectRelease(base, offset, "foo"); UNSAFE.putReferenceRelease(base, offset, "foo");
Object x = UNSAFE.getObjectAcquire(base, offset); Object x = UNSAFE.getReferenceAcquire(base, offset);
assertEquals(x, "foo", "putRelease Object value"); assertEquals(x, "foo", "putRelease Object value");
} }
// Opaque // Opaque
{ {
UNSAFE.putObjectOpaque(base, offset, "bar"); UNSAFE.putReferenceOpaque(base, offset, "bar");
Object x = UNSAFE.getObjectOpaque(base, offset); Object x = UNSAFE.getReferenceOpaque(base, offset);
assertEquals(x, "bar", "putOpaque Object value"); assertEquals(x, "bar", "putOpaque Object value");
} }
UNSAFE.putObject(base, offset, "foo"); UNSAFE.putReference(base, offset, "foo");
// Compare // Compare
{ {
boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "bar"); boolean r = UNSAFE.compareAndSetReference(base, offset, "foo", "bar");
assertEquals(r, true, "success compareAndSet Object"); assertEquals(r, true, "success compareAndSet Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "bar", "success compareAndSet Object value"); assertEquals(x, "bar", "success compareAndSet Object value");
} }
{ {
boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "baz"); boolean r = UNSAFE.compareAndSetReference(base, offset, "foo", "baz");
assertEquals(r, false, "failing compareAndSet Object"); assertEquals(r, false, "failing compareAndSet Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "bar", "failing compareAndSet Object value"); assertEquals(x, "bar", "failing compareAndSet Object value");
} }
// Advanced compare // Advanced compare
{ {
Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "foo"); Object r = UNSAFE.compareAndExchangeReference(base, offset, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchange Object"); assertEquals(r, "bar", "success compareAndExchange Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "success compareAndExchange Object value"); assertEquals(x, "foo", "success compareAndExchange Object value");
} }
{ {
Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "baz"); Object r = UNSAFE.compareAndExchangeReference(base, offset, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchange Object"); assertEquals(r, "foo", "failing compareAndExchange Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "failing compareAndExchange Object value"); assertEquals(x, "foo", "failing compareAndExchange Object value");
} }
{ {
Object r = UNSAFE.compareAndExchangeObjectAcquire(base, offset, "foo", "bar"); Object r = UNSAFE.compareAndExchangeReferenceAcquire(base, offset, "foo", "bar");
assertEquals(r, "foo", "success compareAndExchangeAcquire Object"); assertEquals(r, "foo", "success compareAndExchangeAcquire Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "bar", "success compareAndExchangeAcquire Object value"); assertEquals(x, "bar", "success compareAndExchangeAcquire Object value");
} }
{ {
Object r = UNSAFE.compareAndExchangeObjectAcquire(base, offset, "foo", "baz"); Object r = UNSAFE.compareAndExchangeReferenceAcquire(base, offset, "foo", "baz");
assertEquals(r, "bar", "failing compareAndExchangeAcquire Object"); assertEquals(r, "bar", "failing compareAndExchangeAcquire Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "bar", "failing compareAndExchangeAcquire Object value"); assertEquals(x, "bar", "failing compareAndExchangeAcquire Object value");
} }
{ {
Object r = UNSAFE.compareAndExchangeObjectRelease(base, offset, "bar", "foo"); Object r = UNSAFE.compareAndExchangeReferenceRelease(base, offset, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeRelease Object"); assertEquals(r, "bar", "success compareAndExchangeRelease Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "success compareAndExchangeRelease Object value"); assertEquals(x, "foo", "success compareAndExchangeRelease Object value");
} }
{ {
Object r = UNSAFE.compareAndExchangeObjectRelease(base, offset, "bar", "baz"); Object r = UNSAFE.compareAndExchangeReferenceRelease(base, offset, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeRelease Object"); assertEquals(r, "foo", "failing compareAndExchangeRelease Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "failing compareAndExchangeRelease Object value"); assertEquals(x, "foo", "failing compareAndExchangeRelease Object value");
} }
{ {
boolean success = false; boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSetObjectPlain(base, offset, "foo", "bar"); success = UNSAFE.weakCompareAndSetReferencePlain(base, offset, "foo", "bar");
} }
assertEquals(success, true, "weakCompareAndSetPlain Object"); assertEquals(success, true, "weakCompareAndSetPlain Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "bar", "weakCompareAndSetPlain Object value"); assertEquals(x, "bar", "weakCompareAndSetPlain Object value");
} }
{ {
boolean success = false; boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSetObjectAcquire(base, offset, "bar", "foo"); success = UNSAFE.weakCompareAndSetReferenceAcquire(base, offset, "bar", "foo");
} }
assertEquals(success, true, "weakCompareAndSetAcquire Object"); assertEquals(success, true, "weakCompareAndSetAcquire Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "weakCompareAndSetAcquire Object"); assertEquals(x, "foo", "weakCompareAndSetAcquire Object");
} }
{ {
boolean success = false; boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSetObjectRelease(base, offset, "foo", "bar"); success = UNSAFE.weakCompareAndSetReferenceRelease(base, offset, "foo", "bar");
} }
assertEquals(success, true, "weakCompareAndSetRelease Object"); assertEquals(success, true, "weakCompareAndSetRelease Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "bar", "weakCompareAndSetRelease Object"); assertEquals(x, "bar", "weakCompareAndSetRelease Object");
} }
{ {
boolean success = false; boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSetObject(base, offset, "bar", "foo"); success = UNSAFE.weakCompareAndSetReference(base, offset, "bar", "foo");
} }
assertEquals(success, true, "weakCompareAndSet Object"); assertEquals(success, true, "weakCompareAndSet Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "weakCompareAndSet Object"); assertEquals(x, "foo", "weakCompareAndSet Object");
} }
UNSAFE.putObject(base, offset, "bar"); UNSAFE.putReference(base, offset, "bar");
// Compare set and get // Compare set and get
{ {
Object o = UNSAFE.getAndSetObject(base, offset, "foo"); Object o = UNSAFE.getAndSetReference(base, offset, "foo");
assertEquals(o, "bar", "getAndSet Object"); assertEquals(o, "bar", "getAndSet Object");
Object x = UNSAFE.getObject(base, offset); Object x = UNSAFE.getReference(base, offset);
assertEquals(x, "foo", "getAndSet Object value"); assertEquals(x, "foo", "getAndSet Object value");
} }

View file

@ -54,7 +54,7 @@ public class MixedUnsafeStoreObject {
for (int c = 0; c < 20000; c++) { // trigger OSR compilation for (int c = 0; c < 20000; c++) { // trigger OSR compilation
// java/lang/Object+12 * // java/lang/Object+12 *
// _base = InstPtr, _ptr = BotPTR, _field = NULL, mismatched = true // _base = InstPtr, _ptr = BotPTR, _field = NULL, mismatched = true
UNSAFE.putObject(t, F_OFFSET, "foo"); UNSAFE.putReference(t, F_OFFSET, "foo");
} }
} }
@ -62,7 +62,7 @@ public class MixedUnsafeStoreObject {
for (int c = 0; c < 20000; c++) { // trigger OSR compilation for (int c = 0; c < 20000; c++) { // trigger OSR compilation
// ...$T+12 * // ...$T+12 *
// _base = InstPtr, _ptr = BotPTR, _field = T.f, mismatched = false // _base = InstPtr, _ptr = BotPTR, _field = T.f, mismatched = false
UNSAFE.putObject(t, F_OFFSET, "foo"); UNSAFE.putReference(t, F_OFFSET, "foo");
} }
} }
public static void main(String[] args) { public static void main(String[] args) {

View file

@ -78,7 +78,7 @@ public class OpaqueAccesses {
private long l1, l2; private long l1, l2;
static Object testFixedOffsetField(Object o) { static Object testFixedOffsetField(Object o) {
return UNSAFE.getObject(o, F_OFFSET); return UNSAFE.getReference(o, F_OFFSET);
} }
static int testFixedOffsetHeader0(Object o) { static int testFixedOffsetHeader0(Object o) {
@ -106,11 +106,11 @@ public class OpaqueAccesses {
} }
static Object testFixedBase(long off) { static Object testFixedBase(long off) {
return UNSAFE.getObject(INSTANCE, off); return UNSAFE.getReference(INSTANCE, off);
} }
static Object testOpaque(Object o, long off) { static Object testOpaque(Object o, long off) {
return UNSAFE.getObject(o, off); return UNSAFE.getReference(o, off);
} }
static int testFixedOffsetHeaderArray0(Object[] arr) { static int testFixedOffsetHeaderArray0(Object[] arr) {
@ -138,15 +138,15 @@ public class OpaqueAccesses {
} }
static Object testFixedOffsetArray(Object[] arr) { static Object testFixedOffsetArray(Object[] arr) {
return UNSAFE.getObject(arr, E_OFFSET); return UNSAFE.getReference(arr, E_OFFSET);
} }
static Object testFixedBaseArray(long off) { static Object testFixedBaseArray(long off) {
return UNSAFE.getObject(ARRAY, off); return UNSAFE.getReference(ARRAY, off);
} }
static Object testOpaqueArray(Object[] o, long off) { static Object testOpaqueArray(Object[] o, long off) {
return UNSAFE.getObject(o, off); return UNSAFE.getReference(o, off);
} }
static final long ADDR = UNSAFE.allocateMemory(10); static final long ADDR = UNSAFE.allocateMemory(10);

View file

@ -222,6 +222,9 @@ public class UnsafeGetConstantField {
return name(); return name();
} }
} }
String unsafeTypeName() {
return typeName.equals("Object") ? "Reference" : typeName;
}
} }
static String internalName(Class cls) { static String internalName(Class cls) {
@ -352,7 +355,7 @@ public class UnsafeGetConstantField {
} else { } else {
mv.visitInsn(ACONST_NULL); mv.visitInsn(ACONST_NULL);
} }
String name = "put" + type.typeName + nameSuffix; String name = "put" + type.unsafeTypeName() + nameSuffix;
mv.visitMethodInsn(INVOKEVIRTUAL, UNSAFE_NAME, name, "(Ljava/lang/Object;J" + type.desc()+ ")V", false); mv.visitMethodInsn(INVOKEVIRTUAL, UNSAFE_NAME, name, "(Ljava/lang/Object;J" + type.desc()+ ")V", false);
mv.visitInsn(RETURN); mv.visitInsn(RETURN);
@ -438,7 +441,7 @@ public class UnsafeGetConstantField {
mv.visitFieldInsn(GETSTATIC, className, "t", classDesc); mv.visitFieldInsn(GETSTATIC, className, "t", classDesc);
} }
mv.visitFieldInsn(GETSTATIC, className, "FIELD_OFFSET", "J"); mv.visitFieldInsn(GETSTATIC, className, "FIELD_OFFSET", "J");
String name = "get" + type.typeName + nameSuffix; String name = "get" + type.unsafeTypeName() + nameSuffix;
mv.visitMethodInsn(INVOKEVIRTUAL, UNSAFE_NAME, name, "(Ljava/lang/Object;J)" + type.desc(), false); mv.visitMethodInsn(INVOKEVIRTUAL, UNSAFE_NAME, name, "(Ljava/lang/Object;J)" + type.desc(), false);
} }
void wrapResult(MethodVisitor mv) { void wrapResult(MethodVisitor mv) {

View file

@ -173,15 +173,15 @@ public class UnsafeGetStableArrayElement {
static float testD_F() { return U.getFloat( STABLE_DOUBLE_ARRAY, ARRAY_DOUBLE_BASE_OFFSET); } static float testD_F() { return U.getFloat( STABLE_DOUBLE_ARRAY, ARRAY_DOUBLE_BASE_OFFSET); }
static double testD_D() { return U.getDouble( STABLE_DOUBLE_ARRAY, ARRAY_DOUBLE_BASE_OFFSET); } static double testD_D() { return U.getDouble( STABLE_DOUBLE_ARRAY, ARRAY_DOUBLE_BASE_OFFSET); }
static Object testL_L() { return U.getObject( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static Object testL_L() { return U.getReference( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static boolean testL_Z() { return U.getBoolean(STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static boolean testL_Z() { return U.getBoolean(STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static byte testL_B() { return U.getByte( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static byte testL_B() { return U.getByte( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static short testL_S() { return U.getShort( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static short testL_S() { return U.getShort( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static char testL_C() { return U.getChar( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static char testL_C() { return U.getChar( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static int testL_I() { return U.getInt( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static int testL_I() { return U.getInt( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static long testL_J() { return U.getLong( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static long testL_J() { return U.getLong( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static float testL_F() { return U.getFloat( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static float testL_F() { return U.getFloat( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static double testL_D() { return U.getDouble( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static double testL_D() { return U.getDouble( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); }
static short testS_U() { return U.getShortUnaligned(STABLE_SHORT_ARRAY, ARRAY_SHORT_BASE_OFFSET + 1); } static short testS_U() { return U.getShortUnaligned(STABLE_SHORT_ARRAY, ARRAY_SHORT_BASE_OFFSET + 1); }
static char testC_U() { return U.getCharUnaligned( STABLE_CHAR_ARRAY, ARRAY_CHAR_BASE_OFFSET + 1); } static char testC_U() { return U.getCharUnaligned( STABLE_CHAR_ARRAY, ARRAY_CHAR_BASE_OFFSET + 1); }

View file

@ -34,7 +34,6 @@
import jdk.test.lib.cds.CDSOptions; import jdk.test.lib.cds.CDSOptions;
import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
public class NonBootLoaderClasses { public class NonBootLoaderClasses {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
@ -50,16 +49,16 @@ public class NonBootLoaderClasses {
CDSTestUtils.createArchiveAndCheck(opts); CDSTestUtils.createArchiveAndCheck(opts);
// Print the shared dictionary and inspect the output // Print the shared dictionary and inspect the output
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( opts = (new CDSOptions())
"-cp", "\"\"", .setUseVersion(false)
.addSuffix( "-cp", "\"\"",
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
"-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary"); "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "print-shared-archive"); CDSTestUtils.run(opts)
CDSTestUtils.checkMappingFailure(out); .assertNormalExit(output -> {
output.shouldContain("archive is valid");
out.shouldContain("archive is valid") output.shouldContain(PLATFORM_CLASS.replace('/', '.'));
.shouldHaveExitValue(0) // Should report success in error code. output.shouldContain(APP_CLASS.replace('/', '.'));
.shouldContain(PLATFORM_CLASS.replace('/', '.')) });
.shouldContain(APP_CLASS.replace('/', '.'));
} }
} }

View file

@ -33,7 +33,6 @@
import jdk.test.lib.cds.CDSOptions; import jdk.test.lib.cds.CDSOptions;
import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
public class PrintSharedArchiveAndExit { public class PrintSharedArchiveAndExit {
@ -44,23 +43,24 @@ public class PrintSharedArchiveAndExit {
CDSTestUtils.checkDump(out); CDSTestUtils.checkDump(out);
// (1) With a valid archive // (1) With a valid archive
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( opts = (new CDSOptions())
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, .setUseVersion(false)
.addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
"-XX:+PrintSharedArchiveAndExit", "-version"); "-XX:+PrintSharedArchiveAndExit", "-version");
out = CDSTestUtils.executeAndLog(pb, "print-shared-archive-and-version"); CDSTestUtils.run(opts)
CDSTestUtils.checkMappingFailure(out); .assertNormalExit(output -> {
output.shouldContain("archive is valid");
output.shouldNotContain("java version"); // Should not print JVM version
});
out.shouldContain("archive is valid") opts = (new CDSOptions())
.shouldNotContain("java version") // Should not print JVM version .setUseVersion(false)
.shouldHaveExitValue(0); // Should report success in error code. .addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
"-XX:+PrintSharedArchiveAndExit"); "-XX:+PrintSharedArchiveAndExit");
out = CDSTestUtils.executeAndLog(pb, "print-shared-archive"); CDSTestUtils.run(opts)
CDSTestUtils.checkMappingFailure(out); .assertNormalExit(output -> {
out.shouldContain("archive is valid") output.shouldContain("archive is valid");
.shouldNotContain("Usage:") // Should not print JVM help message output.shouldNotContain("Usage:"); // Should not print JVM help message
.shouldHaveExitValue(0); // Should report success in error code. });
} }
} }

View file

@ -42,16 +42,16 @@ public class GetPutObject {
Field field = Test.class.getField("o"); Field field = Test.class.getField("o");
long offset = unsafe.objectFieldOffset(field); long offset = unsafe.objectFieldOffset(field);
assertEquals(t.o, unsafe.getObject(t, offset)); assertEquals(t.o, unsafe.getReference(t, offset));
unsafe.putObject(t, offset, o); unsafe.putReference(t, offset, o);
assertEquals(o, unsafe.getObject(t, offset)); assertEquals(o, unsafe.getReference(t, offset));
Object arrayObject[] = { unsafe, null, new Object() }; Object arrayObject[] = { unsafe, null, new Object() };
int scale = unsafe.arrayIndexScale(arrayObject.getClass()); int scale = unsafe.arrayIndexScale(arrayObject.getClass());
offset = unsafe.arrayBaseOffset(arrayObject.getClass()); offset = unsafe.arrayBaseOffset(arrayObject.getClass());
for (int i = 0; i < arrayObject.length; i++) { for (int i = 0; i < arrayObject.length; i++) {
assertEquals(unsafe.getObject(arrayObject, offset), arrayObject[i]); assertEquals(unsafe.getReference(arrayObject, offset), arrayObject[i]);
offset += scale; offset += scale;
} }
} }

Some files were not shown because too many files have changed in this diff Show more