Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7452 from a7ehuo/PR-valuetypes-null-re…
Browse files Browse the repository at this point in the history
…stricted-array

Fix null restricted array related issues for value types
  • Loading branch information
hzongaro authored Oct 21, 2024
2 parents 18d8727 + 833607b commit 8031543
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 52 deletions.
7 changes: 7 additions & 0 deletions compiler/env/FrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ TR_FrontEnd::getArrayClassFromComponentClass(TR_OpaqueClassBlock * componentClas
return 0;
}

TR_OpaqueClassBlock *
TR_FrontEnd::getNullRestrictedArrayClassFromComponentClass(TR_OpaqueClassBlock * componentClass)
{
TR_UNIMPLEMENTED();
return 0;
}

TR_OpaqueClassBlock *
TR_FrontEnd::getLeafComponentClassFromArrayClass(TR_OpaqueClassBlock *arrayClass)
{
Expand Down
10 changes: 10 additions & 0 deletions compiler/env/FrontEnd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ class TR_FrontEnd : private TR::Uncopyable

// VM+Shared
virtual TR_OpaqueClassBlock * getArrayClassFromComponentClass(TR_OpaqueClassBlock * componentClass);
/** \brief
* Retrieves the nullRestrictedArrayClass from the array component class.
*
* \param componentClass
* The array component class
*
* \return
* A pointer to nullRestrictedArrayClass if it exists, otherwise NULL
*/
virtual TR_OpaqueClassBlock * getNullRestrictedArrayClassFromComponentClass(TR_OpaqueClassBlock * componentClass);
virtual TR_OpaqueClassBlock * getClassFromNewArrayType(int32_t arrayType);
virtual TR_OpaqueClassBlock * getClassFromSignature(const char * sig, int32_t length, TR_ResolvedMethod *method, bool callSiteVettedForAOT=false);
virtual TR_OpaqueClassBlock * getClassFromSignature(const char * sig, int32_t length, TR_OpaqueMethodBlock *method, bool callSiteVettedForAOT=false);
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/OMRValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ TR_YesNoMaybe OMR::ValuePropagation::isCastClassObject(TR::VPClassType *type)
}


TR_YesNoMaybe OMR::ValuePropagation::isArrayCompTypePrimitiveValueType(TR::VPConstraint *arrayConstraint)
TR_YesNoMaybe OMR::ValuePropagation::isArrayNullRestricted(TR::VPConstraint *arrayConstraint)
{
return TR::Compiler->om.areFlattenableValueTypesEnabled() ? TR_maybe : TR_no;
}
Expand Down
19 changes: 10 additions & 9 deletions compiler/optimizer/OMRValuePropagation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,14 @@ class ValuePropagation : public TR::Optimization
TR_YesNoMaybe isCastClassObject(TR::VPClassType *type);

/**
* Determine whether the component type of an array is, or might be, a primitive value
* type.
* Determine whether the array is, or might be, null-restricted
*
* \param arrayConstraint The \ref TR::VPConstraint type constraint for the array reference
* \returns \c TR_yes if the array's component type is definitely a primitive value type;\n
* \c TR_no if it is definitely not a primitive value type; or\n
* \returns \c TR_yes if the array is definitely a null-restricted array;\n
* \c TR_no if it is definitely not a null-restricted array; or\n
* \c TR_maybe otherwise.
*/
virtual TR_YesNoMaybe isArrayCompTypePrimitiveValueType(TR::VPConstraint *arrayConstraint);
virtual TR_YesNoMaybe isArrayNullRestricted(TR::VPConstraint *arrayConstraint);

/**
* \brief
Expand Down Expand Up @@ -616,15 +616,16 @@ class ValuePropagation : public TR::Optimization
{
TR_ALLOC(TR_Memory::ValuePropagation)

TR_NeedRuntimeTestNullRestrictedArrayCopy(TR::Node *dstArrRef, TR::Node *srcArrRef,
TR_NeedRuntimeTestNullRestrictedArrayCopy(TR::SymbolReference *dstArrRefSymRef, TR::SymbolReference *srcArrRefSymRef,
TR::TreeTop *ptt, TR::TreeTop *ntt,
TR::Block *originBlock, TR::Block *slowBlock,
bool testDstArray)
: _dstArrayRefNode(dstArrRef), _srcArrayRefNode(srcArrRef), _prevTT(ptt), _nextTT(ntt), _originBlock(originBlock), _slowBlock(slowBlock), _needRuntimeTestDstArray(testDstArray)
: _dstArrRefSymRef(dstArrRefSymRef), _srcArrRefSymRef(srcArrRefSymRef), _prevTT(ptt), _nextTT(ntt),
_originBlock(originBlock), _slowBlock(slowBlock), _needRuntimeTestDstArray(testDstArray)
{}

TR::Node *_dstArrayRefNode;
TR::Node *_srcArrayRefNode;
TR::SymbolReference * _dstArrRefSymRef;
TR::SymbolReference * _srcArrRefSymRef;

TR::TreeTop *_prevTT;
TR::TreeTop *_nextTT;
Expand Down
Loading

0 comments on commit 8031543

Please sign in to comment.