Skip to content

Commit ca376e3

Browse files
authored
Generalize check for dynamic scopes when saving EH clauses (#116217)
The Task returning thunks generated for runtime async methods have a `catch (Exception ex)` in them. During EH we were lazily trying to resolve the dynamic type token to a type handle using the metadata scope from the original IL method. Ensure we do this during JIT time instead, using the right resolver.
1 parent b78c19a commit ca376e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/coreclr/vm/jitinterface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12719,12 +12719,12 @@ void CEECodeGenInfo::setEHinfoWorker(
1271912719
LOG((LF_EH, LL_INFO1000000, " ClassToken : 0x%08lx -> 0x%08lx\n", clause->ClassToken, pEHClause->ClassToken));
1272012720
LOG((LF_EH, LL_INFO1000000, " FilterOffset : 0x%08lx -> 0x%08lx\n", clause->FilterOffset, pEHClause->FilterOffset));
1272112721

12722-
if (m_pMethodBeingCompiled->IsDynamicMethod() &&
12722+
if (IsDynamicScope(m_MethodInfo.scope) &&
1272312723
((pEHClause->Flags & COR_ILEXCEPTION_CLAUSE_FILTER) == 0) &&
1272412724
(clause->ClassToken != mdTokenNil))
1272512725
{
1272612726
ResolvedToken resolved{};
12727-
m_pMethodBeingCompiled->AsDynamicMethodDesc()->GetResolver()->ResolveToken(clause->ClassToken, &resolved);
12727+
GetDynamicResolver(m_MethodInfo.scope)->ResolveToken(clause->ClassToken, &resolved);
1272812728
pEHClause->TypeHandle = (void*)resolved.TypeHandle.AsPtr();
1272912729
SetHasCachedTypeHandle(pEHClause);
1273012730
LOG((LF_EH, LL_INFO1000000, " CachedTypeHandle: 0x%08x -> %p\n", clause->ClassToken, pEHClause->TypeHandle));

0 commit comments

Comments
 (0)