Skip to content

Commit 8eb90a6

Browse files
[clr-interp] Add support for explicit this calli to a valuetype method (#122196)
- Fixes GitHub_35384 - Only required using the correct helper routines. The rest of the implementation fell out from there
1 parent a0d6859 commit 8eb90a6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4419,15 +4419,15 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
44194419
bool isMarshaledPInvoke = isPInvoke && m_compHnd->pInvokeMarshalingRequired(callInfo.hMethod, &callInfo.sig);
44204420

44214421
// Process sVars
4422-
int numArgsFromStack = callInfo.sig.numArgs + (newObj ? 0 : callInfo.sig.hasThis());
4422+
int numArgsFromStack = callInfo.sig.numArgs + (newObj ? 0 : callInfo.sig.hasImplicitThis());
44234423
int newObjThisArgLocation = newObj && !doCallInsteadOfNew ? 0 : INT_MAX;
44244424
int numArgs = numArgsFromStack + (newObjThisArgLocation == 0);
44254425

44264426
int extraParamArgLocation = INT_MAX;
44274427
int continuationArgLocation = INT_MAX;
44284428
if (callInfo.sig.hasTypeArg())
44294429
{
4430-
extraParamArgLocation = callInfo.sig.hasThis() ? 1 : 0;
4430+
extraParamArgLocation = callInfo.sig.hasImplicitThis() ? 1 : 0;
44314431
numArgs++;
44324432
}
44334433

@@ -4471,7 +4471,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
44714471
else
44724472
{
44734473
int iCurrentStackArg = iLogicalArg - numArgsFromStack;
4474-
if (iLogicalArg != 0 || !callInfo.sig.hasThis() || newObj)
4474+
if (iLogicalArg != 0 || !callInfo.sig.hasImplicitThis() || newObj)
44754475
{
44764476
CORINFO_CLASS_HANDLE classHandle;
44774477

@@ -6992,6 +6992,10 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo)
69926992
CORINFO_RESOLVED_TOKEN constrainedToken;
69936993
CORINFO_CALL_INFO callInfo;
69946994
const uint8_t *codeEnd;
6995+
if (m_methodInfo->args.hasExplicitThis())
6996+
{
6997+
BADCODE("Explicit this is only supported for calls");
6998+
}
69956999
int numArgs = m_methodInfo->args.hasThis() + m_methodInfo->args.numArgs;
69967000
bool emittedBBlocks, linkBBlocks, needsRetryEmit;
69977001
m_pILCode = methodInfo->ILCode;

src/coreclr/interpreter/naming.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void AppendMethodName(COMP_HANDLE comp,
266266

267267
// Does it have a 'this' pointer? Don't count explicit this, which has
268268
// the this pointer type as the first element of the arg type list
269-
if (includeThisSpecifier && sig->hasThis() && !sig->hasExplicitThis())
269+
if (includeThisSpecifier && sig->hasImplicitThis())
270270
{
271271
printer->Append(":this", 5);
272272
}

0 commit comments

Comments
 (0)