(0.46) Move anchored instanceof to the correct position #19655
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR ports #19604 to 0.46
This commit includes the following two changes in ILGen:
If the class is unresolved,
genInstanceof
anchorsinstanceof
under atreetop
node. Then the anchoredinstanceof
treetop appears after the callTree and it commons withthe
instanceof
node under theZEROCHK
ingeninterface
.This causes a problem because
expandUnresolvedClassInstanceof
does not expect the treetop that has the anchoredinstanceof
to have already been evaluated when it appears under ZEROCHK. The transformation inexpandUnresolvedClassInstanceof
will not function correctly.Therefore, the anchored
instanceof
treetop needs to be moved up before ZEROCHK.If the receiver of the
instanceof
is non-null, there is no need to transform theinstanceof
into two cases: the null case and the non-null cases inexpandUnresolvedClassInstanceof
.Fixes: #18748