@@ -3835,6 +3835,54 @@ bool J9::ValuePropagation::isUnreliableSignatureType(
3835
3835
return true ;
3836
3836
}
3837
3837
3838
+ bool J9::ValuePropagation::canArrayClassBeTrustedAsFixedClass (TR_OpaqueClassBlock *arrayClass, TR_OpaqueClassBlock *componentClass)
3839
+ {
3840
+ if (TR::Compiler->om .areFlattenableValueTypesEnabled () &&
3841
+ !TR::Compiler->cls .isArrayNullRestricted (comp (), arrayClass) && // If the array is null-restricted array, we know it is a fixed class
3842
+ TR::Compiler->cls .isValueTypeClass (componentClass))
3843
+ return false ;
3844
+
3845
+ return true ;
3846
+ }
3847
+
3848
+ bool J9::ValuePropagation::canClassBeTrustedAsFixedClass (TR::SymbolReference *symRef, TR_OpaqueClassBlock *classObject)
3849
+ {
3850
+ if (!TR::Compiler->om .areFlattenableValueTypesEnabled ())
3851
+ return true ;
3852
+
3853
+ if (!classObject && symRef && symRef->getSymbol ()->isClassObject ())
3854
+ {
3855
+ if (!symRef->isUnresolved ())
3856
+ {
3857
+ classObject = (TR_OpaqueClassBlock*)symRef->getSymbol ()->getStaticSymbol ()->getStaticAddress ();
3858
+ }
3859
+ else
3860
+ {
3861
+ int32_t len;
3862
+ const char *name = TR::Compiler->cls .classNameChars (comp (), symRef, len);
3863
+ char *sig = TR::Compiler->cls .classNameToSignature (name, len, comp ());
3864
+ classObject = fe ()->getClassFromSignature (sig, len, symRef->getOwningMethod (comp ()));
3865
+ }
3866
+ }
3867
+
3868
+ if (classObject)
3869
+ {
3870
+ // If null-restricted array is enabled and the class is an array class, the null-restricted array
3871
+ // class and the nullable array class share the same signature. The null-restricted array can be
3872
+ // viewed as a sub-type of the nullable array. Therefore, if the array is not a null-restricted array,
3873
+ // it can't be trusted as a fixed class.
3874
+ int32_t numDims = 0 ;
3875
+ TR_OpaqueClassBlock *klass = comp ()->fej9 ()->getBaseComponentClass (classObject, numDims);
3876
+
3877
+ if ((numDims > 0 ) &&
3878
+ !TR::Compiler->cls .isArrayNullRestricted (comp (), classObject) && // If the array is null-restricted array, we know it is a fixed class
3879
+ TR::Compiler->cls .isValueTypeClass (klass))
3880
+ return false ;
3881
+ }
3882
+
3883
+ return true ;
3884
+ }
3885
+
3838
3886
static void getHelperSymRefs (OMR::ValuePropagation *vp, TR::Node *curCallNode, TR::SymbolReference *&getHelpersSymRef, TR::SymbolReference *&helperSymRef, const char *helperSig, int32_t helperSigLen, TR::MethodSymbol::Kinds helperCallKind)
3839
3887
{
3840
3888
// Function to retrieve the JITHelpers.getHelpers and JITHelpers.<helperSig> method symbol references.
0 commit comments