diff --git a/runtime/compiler/optimizer/J9ValuePropagation.cpp b/runtime/compiler/optimizer/J9ValuePropagation.cpp index fa63af75fdd..ea5aa34c743 100644 --- a/runtime/compiler/optimizer/J9ValuePropagation.cpp +++ b/runtime/compiler/optimizer/J9ValuePropagation.cpp @@ -3782,9 +3782,28 @@ bool J9::ValuePropagation::isUnreliableSignatureType( return false; int32_t numDims = 0; + TR_OpaqueClassBlock *originClass = klass; klass = comp()->fej9()->getBaseComponentClass(klass, numDims); + if (!TR::Compiler->cls.isInterfaceClass(comp(), klass)) - return false; + { + // If the original class is an array class and it is not a null-restricted array, + // we can not trust its type as a nullable array because it can either be a nullable + // array class type or a null-restricted array type. + // TODO-VALUETYPE: However, if in the future Value Propagation constraints are able + // to distinguish between nullable and null-restricted arrays, this test can change. + if (TR::Compiler->om.areFlattenableValueTypesEnabled() && + (numDims > 0) && + TR::Compiler->cls.isValueTypeClass(klass) && + !TR::Compiler->cls.isArrayNullRestricted(comp(), originClass)) + { + // Do nothing here and will be handled next like an interface array + } + else + { + return false; + } + } // Find the best array type that we can guarantee based on an // array-of-interface signature. diff --git a/test/functional/Valhalla/playlist.xml b/test/functional/Valhalla/playlist.xml index ac31e212359..7199635b4e3 100644 --- a/test/functional/Valhalla/playlist.xml +++ b/test/functional/Valhalla/playlist.xml @@ -339,8 +339,7 @@ -Xint -Xint -Xgcpolicy:optthruput -XX:ValueTypeFlatteningThreshold=99999 -Xint -Xgcpolicy:optthruput -XX:ValueTypeFlatteningThreshold=99999 -XX:+EnableArrayFlattening - - + -Xjit:count=1,disableAsyncCompilation -Xnocompressedrefs -Xgcpolicy:gencon - + -Xjit:count=1,disableAsyncCompilation,initialOptLevel=warm -Xnocompressedrefs -Xgcpolicy:gencon $(JAVA_COMMAND) $(JVM_OPTIONS) \ --enable-preview \