diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs index 1d77e1beca4a7c..4e4785b7012845 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs @@ -1334,6 +1334,9 @@ internal static IRuntimeMethodInfo StripMethodInstantiation(IRuntimeMethodInfo m return result; } + [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "RuntimeMethodHandle_GetParallelMethodWithUserIL")] + private static partial RuntimeMethodHandleInternal GetParallelMethodWithUserIL(RuntimeMethodHandleInternal method); + [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool IsConstructor(RuntimeMethodHandleInternal method); diff --git a/src/coreclr/vm/qcallentrypoints.cpp b/src/coreclr/vm/qcallentrypoints.cpp index 3783b73e9ed465..c1fa3ec963b6a4 100644 --- a/src/coreclr/vm/qcallentrypoints.cpp +++ b/src/coreclr/vm/qcallentrypoints.cpp @@ -176,6 +176,7 @@ static const Entry s_QCall[] = DllImportEntry(RuntimeMethodHandle_Destroy) DllImportEntry(RuntimeMethodHandle_GetStubIfNeededSlow) DllImportEntry(RuntimeMethodHandle_GetMethodBody) + DllImportEntry(RuntimeMethodHandle_GetParallelMethodWithUserIL) DllImportEntry(RuntimeModule_GetScopeName) DllImportEntry(RuntimeModule_GetFullyQualifiedName) DllImportEntry(RuntimeModule_GetTypes) diff --git a/src/coreclr/vm/runtimehandles.cpp b/src/coreclr/vm/runtimehandles.cpp index 3cb83744e9e03b..7015bf8687d8f6 100644 --- a/src/coreclr/vm/runtimehandles.cpp +++ b/src/coreclr/vm/runtimehandles.cpp @@ -2137,6 +2137,32 @@ extern "C" void QCALLTYPE RuntimeMethodHandle_GetMethodBody(MethodDesc* pMethod, END_QCALL; } +extern "C" MethodDesc* QCALLTYPE RuntimeMethodHandle_GetParallelMethodWithUserIL(MethodDesc* pMethod) +{ + QCALL_CONTRACT; + + _ASSERTE(pMethod != NULL); + + MethodDesc* pResult = NULL; + + BEGIN_QCALL; + + GCX_COOP(); + + if (pMethod->IsAsyncThunkMethod()) + { + pResult = pMethod->GetAsyncVariant(); + } + else + { + pResult = pMethod; + } + + END_QCALL; + + return pResult; +} + FCIMPL1(FC_BOOL_RET, RuntimeMethodHandle::IsConstructor, MethodDesc *pMethod) { CONTRACTL { diff --git a/src/coreclr/vm/runtimehandles.h b/src/coreclr/vm/runtimehandles.h index fb3bbf2b475c41..db3499305af36b 100644 --- a/src/coreclr/vm/runtimehandles.h +++ b/src/coreclr/vm/runtimehandles.h @@ -246,6 +246,7 @@ extern "C" void QCALLTYPE RuntimeMethodHandle_StripMethodInstantiation(MethodDes extern "C" void QCALLTYPE RuntimeMethodHandle_Destroy(MethodDesc * pMethod); extern "C" MethodDesc* QCALLTYPE RuntimeMethodHandle_GetStubIfNeededSlow(MethodDesc* pMethod, QCall::TypeHandle declaringTypeHandle, QCall::ObjectHandleOnStack methodInstantiation); extern "C" void QCALLTYPE RuntimeMethodHandle_GetMethodBody(MethodDesc* pMethod, QCall::TypeHandle pDeclaringType, QCall::ObjectHandleOnStack result); +extern "C" MethodDesc* QCALLTYPE RuntimeMethodHandle_GetParallelMethodWithUserIL(MethodDesc* pMethod); class RuntimeFieldHandle {