-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw IdentityException if operand of monent is a value type object #21218
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1536,6 +1536,60 @@ StoreArrayElementTransformer::lower(TR::Node* const node, TR::TreeTop* const tt) | |
} | ||
} | ||
|
||
class IsIdentityObjectTransformer: public TR::TreeLowering::Transformer | ||
{ | ||
public: | ||
explicit IsIdentityObjectTransformer(TR::TreeLowering* opt) | ||
: TR::TreeLowering::Transformer(opt) | ||
{} | ||
|
||
void lower(TR::Node* const node, TR::TreeTop* const tt); | ||
}; | ||
|
||
|
||
/** | ||
* @brief Perform lowering of calls to the <isIdentityObject> non-helper function | ||
* | ||
* A call like the following | ||
* | ||
* @verbatim | ||
n88n icall <isIdentityObject> | ||
n77n aload x | ||
* @endverbatim | ||
* | ||
* will be transformed into | ||
* | ||
* @verbatim | ||
n88n PassThrough | ||
n99n iand | ||
n98n iloadi <isClassFlags> | ||
n97n aloadi <vft-symbol> | ||
n77n aload x | ||
n96n iconst 0x80000 // Test whether class is an identity class | ||
* @endverbatim | ||
Comment on lines
+1562
to
+1569
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
*/ | ||
void | ||
IsIdentityObjectTransformer::lower(TR::Node* const node, TR::TreeTop* const tt) | ||
{ | ||
// If the argument to the call of the <isIdentityObject> non-helper is the | ||
// object of a NULLCHK, pull the NULLCHK into a separate tree before | ||
// transforming the call to <isIdentityObject>. Otherwise, we'll end up | ||
// with the NULLCHK operating on something meaningless. | ||
// | ||
if (tt->getNode()->getOpCode().isNullCheck() && tt->getNode()->getFirstChild() == node) | ||
{ | ||
J9::TransformUtil::separateNullCheck(comp(), tt, trace()); | ||
} | ||
|
||
TR::SymbolReference *vftSymRef = comp()->getSymRefTab()->findOrCreateVftSymbolRef(); | ||
TR::Node *objNode = node->getFirstChild(); | ||
TR::Node *vftNode = TR::Node::createWithSymRef(TR::aloadi, 1, 1, objNode, vftSymRef); | ||
TR::Node *testFlagsNode = comp()->fej9()->testIsClassIdentityType(vftNode); | ||
TR::Node::recreate(node, TR::PassThrough); | ||
objNode->decReferenceCount(); | ||
node->setAndIncChild(0, testFlagsNode); | ||
} | ||
|
||
/** | ||
* @brief Perform lowering related to Valhalla value types | ||
* | ||
|
@@ -1601,5 +1655,9 @@ TR::TreeLowering::lowerValueTypeOperations(TransformationManager& transformation | |
transformations.addTransformation(getTransformer<StoreArrayElementTransformer>(), node, tt); | ||
} | ||
} | ||
else if (symRefTab->isNonHelper(node->getSymbolReference(), TR::SymbolReferenceTable::isIdentityObjectNonHelperSymbol)) | ||
{ | ||
transformations.addTransformation(getTransformer<IsIdentityObjectTransformer>(), node, tt); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1052,12 +1052,12 @@ void initializeCodeRuntimeHelperTable(J9JITConfig *jitConfig, char isSMP) | |
SET(TR_newValueNoZeroInit, (void *)jitNewValueNoZeroInit, TR_CHelper); | ||
|
||
SET(TR_getFlattenableField, (void *)jitGetFlattenableField, TR_Helper); | ||
SET(TR_withFlattenableField, (void *)jitWithFlattenableField, TR_Helper); | ||
SET(TR_withFlattenableField, (void *)jitWithFlattenableField, TR_Helper); | ||
SET(TR_putFlattenableField, (void *)jitPutFlattenableField, TR_Helper); | ||
SET(TR_getFlattenableStaticField, (void *)jitGetFlattenableStaticField, TR_Helper); | ||
SET(TR_putFlattenableStaticField, (void *)jitPutFlattenableStaticField, TR_Helper); | ||
SET(TR_ldFlattenableArrayElement, (void *)jitLoadFlattenableArrayElement, TR_Helper); | ||
SET(TR_strFlattenableArrayElement, (void *)jitStoreFlattenableArrayElement, TR_Helper); | ||
SET(TR_getFlattenableStaticField, (void *)jitGetFlattenableStaticField, TR_Helper); | ||
SET(TR_putFlattenableStaticField, (void *)jitPutFlattenableStaticField, TR_Helper); | ||
SET(TR_ldFlattenableArrayElement, (void *)jitLoadFlattenableArrayElement, TR_Helper); | ||
SET(TR_strFlattenableArrayElement, (void *)jitStoreFlattenableArrayElement, TR_Helper); | ||
|
||
SET(TR_acmpeqHelper, (void *)jitAcmpeqHelper, TR_Helper); | ||
SET(TR_acmpneHelper, (void *)jitAcmpneHelper, TR_Helper); | ||
|
@@ -1081,6 +1081,10 @@ void initializeCodeRuntimeHelperTable(J9JITConfig *jitConfig, char isSMP) | |
SET(TR_typeCheckArrayStore, (void *)jitTypeCheckArrayStoreWithNullCheck, TR_Helper); | ||
#endif | ||
|
||
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) | ||
SET(TR_identityException, (void *)jitThrowIdentityException, TR_Helper); | ||
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
Comment on lines
+1084
to
+1086
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think at one point, I had the entire definition of
and so I conditionally compiled these uses of Yes, I think they can safely be removed. Thanks for pointing that out! |
||
|
||
#if defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390) || defined(TR_HOST_ARM64) | ||
SET(TR_softwareReadBarrier, (void *)jitSoftwareReadBarrier, TR_Helper); | ||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,9 @@ JIT_HELPER(jitThrowCurrentException); // asm calling-convention helper | |
JIT_HELPER(jitThrowException); // asm calling-convention helper | ||
JIT_HELPER(jitThrowUnreportedException); // asm calling-convention helper | ||
JIT_HELPER(jitThrowExceptionInInitializerError); // asm calling-convention helper | ||
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) | ||
JIT_HELPER(jitThrowIdentityException); // asm calling-convention helper | ||
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
Comment on lines
+146
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as the above regarding to J9VM_OPT_VALHALLA_VALUE_TYPES. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the previous comment - I think I had left this |
||
JIT_HELPER(jitThrowInstantiationException); // asm calling-convention helper | ||
JIT_HELPER(jitThrowNullPointerException); // asm calling-convention helper | ||
JIT_HELPER(jitThrowWrongMethodTypeException); // asm calling-convention helper | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra space in
necessary. The
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was intentional. I always use two spaces after the period at the end of sentence, or after a colon. It's a style that was common using typewriters that printed using monospace fonts like Courier, and as we usually look at our code in Courier font, I prefer to continue to follow that convention.