-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Stop spilling ldvirtftn #120866
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
base: main
Are you sure you want to change the base?
Stop spilling ldvirtftn #120866
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 |
---|---|---|
|
@@ -400,23 +400,26 @@ var_types Compiler::impImportCall(OPCODE opcode, | |
thisPtr = impTransformThis(thisPtr, pConstrainedResolvedToken, callInfo->thisTransform); | ||
assert(thisPtr != nullptr); | ||
|
||
GenTree* origThisPtr = thisPtr; | ||
// Clone the (possibly transformed) "this" pointer | ||
GenTree* thisPtrCopy; | ||
thisPtr = | ||
impCloneExpr(thisPtr, &thisPtrCopy, CHECK_SPILL_ALL, nullptr DEBUGARG("LDVIRTFTN this pointer")); | ||
|
||
// We cloned the "this" pointer, mark it as a single def and set the class for it | ||
if (thisPtr->TypeIs(TYP_REF) && (origThisPtr != thisPtr)) | ||
{ | ||
lvaGetDesc(thisPtr->AsLclVar())->lvSingleDef = 1; | ||
lvaSetClass(thisPtr->AsLclVar()->GetLclNum(), origThisPtr); | ||
hez2010 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
GenTree* fptr = impImportLdvirtftn(thisPtr, pResolvedToken, callInfo); | ||
assert(fptr != nullptr); | ||
|
||
call->AsCall() | ||
->gtArgs.PushFront(this, NewCallArg::Primitive(thisPtrCopy).WellKnown(WellKnownArg::ThisPointer)); | ||
|
||
// Now make an indirect call through the function pointer | ||
|
||
unsigned lclNum = lvaGrabTemp(true DEBUGARG("VirtualCall through function pointer")); | ||
impStoreToTemp(lclNum, fptr, CHECK_SPILL_ALL); | ||
fptr = gtNewLclvNode(lclNum, TYP_I_IMPL); | ||
Comment on lines
-416
to
-418
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. This is the only actual change. |
||
|
||
call->AsCall()->gtCallAddr = fptr; | ||
call->gtFlags |= GTF_EXCEPT | (fptr->gtFlags & GTF_GLOB_EFFECT); | ||
|
||
|
@@ -7603,7 +7606,7 @@ void Compiler::considerGuardedDevirtualization(GenTreeCall* call, | |
} | ||
|
||
addGuardedDevirtualizationCandidate(call, exactMethod, exactCls, exactContext, exactMethodAttrs, | ||
clsAttrs, likelyHood, dvInfo.wasArrayInterfaceDevirt, | ||
clsAttrs, likelyHood, dvInfo.needsMethodContext, | ||
dvInfo.isInstantiatingStub, baseMethod, originalContext); | ||
} | ||
|
||
|
@@ -7676,7 +7679,7 @@ void Compiler::considerGuardedDevirtualization(GenTreeCall* call, | |
|
||
likelyContext = dvInfo.exactContext; | ||
likelyMethod = dvInfo.devirtualizedMethod; | ||
arrayInterface = dvInfo.wasArrayInterfaceDevirt; | ||
arrayInterface = dvInfo.needsMethodContext; | ||
instantiatingStub = dvInfo.isInstantiatingStub; | ||
} | ||
else | ||
|
@@ -8767,14 +8770,14 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, | |
|
||
if (((size_t)exactContext & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_CLASS) | ||
{ | ||
assert(!dvInfo.wasArrayInterfaceDevirt); | ||
assert(!dvInfo.needsMethodContext); | ||
derivedClass = (CORINFO_CLASS_HANDLE)((size_t)exactContext & ~CORINFO_CONTEXTFLAGS_MASK); | ||
} | ||
else | ||
{ | ||
// Array interface devirt can return a nonvirtual generic method of the non-generic SZArrayHelper class. | ||
// | ||
assert(dvInfo.wasArrayInterfaceDevirt); | ||
assert(dvInfo.needsMethodContext); | ||
assert(((size_t)exactContext & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_METHOD); | ||
derivedClass = info.compCompHnd->getMethodClass(derivedMethod); | ||
} | ||
|
@@ -8795,9 +8798,9 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, | |
|
||
if (dvInfo.isInstantiatingStub) | ||
{ | ||
// We should only end up with generic methods for array interface devirt. | ||
// We should only end up with generic methods that needs a method context (eg. array interface). | ||
// | ||
assert(dvInfo.wasArrayInterfaceDevirt); | ||
assert(dvInfo.needsMethodContext); | ||
|
||
// We don't expect NAOT to end up here, since it has Array<T> | ||
// and normal devirtualization. | ||
|
@@ -8920,14 +8923,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, | |
|
||
JITDUMP(" %s; can devirtualize\n", note); | ||
|
||
// Make the updates. | ||
call->gtFlags &= ~GTF_CALL_VIRT_VTABLE; | ||
call->gtFlags &= ~GTF_CALL_VIRT_STUB; | ||
call->gtCallMethHnd = derivedMethod; | ||
call->gtCallType = CT_USER_FUNC; | ||
call->gtControlExpr = nullptr; | ||
INDEBUG(call->gtCallDebugFlags |= GTF_CALL_MD_DEVIRTUALIZED); | ||
|
||
if (dvInfo.isInstantiatingStub) | ||
{ | ||
// Pass the instantiating stub method desc as the inst param arg. | ||
|
@@ -8939,6 +8934,14 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, | |
call->gtArgs.InsertInstParam(this, instParam); | ||
} | ||
|
||
// Make the updates. | ||
call->gtFlags &= ~GTF_CALL_VIRT_VTABLE; | ||
call->gtFlags &= ~GTF_CALL_VIRT_STUB; | ||
call->gtCallMethHnd = derivedMethod; | ||
call->gtCallType = CT_USER_FUNC; | ||
call->gtControlExpr = nullptr; | ||
INDEBUG(call->gtCallDebugFlags |= GTF_CALL_MD_DEVIRTUALIZED); | ||
|
||
// Virtual calls include an implicit null check, which we may | ||
// now need to make explicit. | ||
if (!objIsNonNull) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9451,7 +9451,6 @@ void Lowering::ContainCheckNode(GenTree* node) | |
ContainCheckIndir(node->AsIndir()); | ||
break; | ||
case GT_PUTARG_REG: | ||
case GT_PUTARG_STK: | ||
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. what is the motivation behind this change? 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. It's trying to suppress an assertion before addressing the lowering issue that is specific to windows-x86:
|
||
// The regNum must have been set by the lowering of the call. | ||
assert(node->GetRegNum() != REG_NA); | ||
break; | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
This is just a rename without any meaningful change.