Skip to content

Commit 7baa054

Browse files
janvorliCopilot
andauthored
Fix EmitCall in the interpreter compiler (#116654)
* Fix EmitCall in the interpreter compiler There are two issues there: * The token kinds passed to the ResolveToken for NewObj and Method are flipped * The doCallInsteadOfNew is set for non-constructor methods too, resulting in overriding the return type to InterpTypeO * Fix missing parents to ensure correct precendence Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent f8537b2 commit 7baa054

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,7 +2343,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* constrainedClass, bool rea
23432343
else
23442344
{
23452345

2346-
ResolveToken(token, newObj ? CORINFO_TOKENKIND_Method : CORINFO_TOKENKIND_NewObj, &resolvedCallToken);
2346+
ResolveToken(token, newObj ? CORINFO_TOKENKIND_NewObj : CORINFO_TOKENKIND_Method, &resolvedCallToken);
23472347

23482348
CORINFO_CALLINFO_FLAGS flags = (CORINFO_CALLINFO_FLAGS)(CORINFO_CALLINFO_ALLOWINSTPARAM | CORINFO_CALLINFO_SECURITYCHECKS | CORINFO_CALLINFO_DISALLOW_STUB);
23492349
if (isVirtual)
@@ -2357,7 +2357,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* constrainedClass, bool rea
23572357
}
23582358
}
23592359

2360-
if (callInfo.classFlags & CORINFO_FLG_VAROBJSIZE)
2360+
if (newObj && (callInfo.classFlags & CORINFO_FLG_VAROBJSIZE))
23612361
{
23622362
// This is a variable size object which means "System.String".
23632363
// For these, we just call the resolved method directly, but don't actually pass a this pointer to it.

0 commit comments

Comments
 (0)