Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2890,7 +2890,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
break;

case CORINFO_VIRTUALCALL_LDVIRTFTN:
if (callInfo.sig.sigInst.methInstCount != 0)
if ((callInfo.sig.sigInst.methInstCount != 0) || (m_compHnd->getClassAttribs(resolvedCallToken.hClass) & CORINFO_FLG_SHAREDINST))
{
assert(extraParamArgLocation == INT_MAX);
// We should not have a type argument for the ldvirtftn path since we don't know
Expand Down
15 changes: 14 additions & 1 deletion src/tests/JIT/interpreter/Interpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ private static Type LoadType<T>()
return typeof(T);
}

class GenericClass<T>
class GenericClass<T> : IGeneric<T>
{
public Type GetTypeOfTInstance()
{
Expand All @@ -1895,6 +1895,11 @@ public static Type GetTypeOfTStatic()
{
return typeof(T);
}

Type IGeneric<T>.Method()
{
return typeof(T);
}
}

public static bool TestSharedGenerics_IsInst<T>(object o)
Expand Down Expand Up @@ -2135,6 +2140,11 @@ public static bool TestSharedGenerics_CallsTo()
return true;
}

interface IGeneric<T>
{
Type Method();
}

public static bool TestGenerics_CallsFrom<T>()
{
if (LoadType<T>() != typeof(T))
Expand All @@ -2146,6 +2156,9 @@ public static bool TestGenerics_CallsFrom<T>()
if (GenericClass<T>.GetTypeOfTStatic() != typeof(T))
return false;

if (((IGeneric<T>)new GenericClass<T>()).Method() != typeof(T))
return false;

return true;
}

Expand Down
Loading