Use the correct class handle for fat call temporary (dotnet/coreclr#9893)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Thu, 2 Mar 2017 06:15:34 +0000 (22:15 -0800)
committerGitHub <noreply@github.com>
Thu, 2 Mar 2017 06:15:34 +0000 (22:15 -0800)
`clsHnd` is the class handle of the type that owns the method for
`opcode != CEE_CALLI`. We need the class handle for the method's
return type though.

This is ending up with RyuJIT asking weird questions over JitInterface
(`getClassGClayout` of a reference type).

Also removing a line that was added in dotnet/coreclr#9191 to support the old code.

Commit migrated from https://github.com/dotnet/coreclr/commit/58010850217463943ba5910ddc8303b9d36f709e

src/coreclr/src/jit/importer.cpp

index adc06b2..4038a18 100644 (file)
@@ -6432,7 +6432,6 @@ var_types Compiler::impImportCall(OPCODE                  opcode,
         eeGetSig(pResolvedToken->token, info.compScopeHnd, impTokenLookupContextHandle, &calliSig);
 
         callRetTyp = JITtype2varType(calliSig.retType);
-        clsHnd     = calliSig.retTypeClass;
 
         call = impImportIndirectCall(&calliSig, ilOffset);
 
@@ -7715,7 +7714,7 @@ DONE_CALL:
                         unsigned   calliSlot  = lvaGrabTemp(true DEBUGARG("calli"));
                         LclVarDsc* varDsc     = &lvaTable[calliSlot];
                         varDsc->lvVerTypeInfo = tiRetVal;
-                        impAssignTempGen(calliSlot, call, clsHnd, (unsigned)CHECK_SPILL_NONE);
+                        impAssignTempGen(calliSlot, call, tiRetVal.GetClassHandle(), (unsigned)CHECK_SPILL_NONE);
                         // impAssignTempGen can change src arg list and return type for call that returns struct.
                         var_types type = genActualType(lvaTable[calliSlot].TypeGet());
                         call           = gtNewLclvNode(calliSlot, type);