Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 0 additions & 5 deletions src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableRiscV64Zbs, W("EnableRiscV64
#endif

// Runtime-async
#if defined(TARGET_BROWSER)
// WASM-TODO: https://github.com/dotnet/runtime/issues/121064
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 0, "Enables runtime async method support")
#else
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 1, "Enables runtime async method support")
#endif // TARGET_BROWSER

///
/// Uncategorized
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/vm/comdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,11 @@ extern "C" BOOL QCALLTYPE Delegate_BindToMethodName(QCall::ObjectHandleOnStack d
if (pCurMethod->IsGenericMethodDefinition())
continue;

if ((pCurMethod != NULL) && (StrCompFunc(pszMethodName, pCurMethod->GetName()) == 0))
// We can't match async variants (since we have only name).
if (pCurMethod->IsAsyncVariantMethod())
continue;

if (StrCompFunc(pszMethodName, pCurMethod->GetName()) == 0)
{
// found a matching string, get an associated method desc if needed
// Use unboxing stubs for instance and virtual methods on value types.
Expand Down
77 changes: 47 additions & 30 deletions src/coreclr/vm/memberload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,9 @@ MemberLoader::FindMethod(
// For value classes, if it's a value class method, we want to return the duplicated MethodDesc, not the one in the vtable
// section. We'll find the one in the duplicate section before the one in the vtable section, so we're ok.

// Since we search backwards, we may find an async variant before the other variant. We simply skip over.
// This API is not supposed to return async variants. (add flags to FM_Flags, if such behavior is desired)

// Search non-vtable portion of this class first

MethodTable::MethodIterator it(pMT);
Expand All @@ -1117,6 +1120,11 @@ MemberLoader::FindMethod(
{
MethodDesc *pCurDeclMD = it.GetDeclMethodDesc();

if (pCurDeclMD->IsAsyncVariantMethod())
{
continue;
}

LOG((LF_LOADER, LL_INFO100000, "ML::FM Considering %s::%s, pMD:%p\n",
pCurDeclMD->m_pszDebugClassName, pCurDeclMD->m_pszDebugMethodName, pCurDeclMD));

Expand Down Expand Up @@ -1181,6 +1189,11 @@ MemberLoader::FindMethod(
{
MethodDesc* pCurDeclMD = itMethods.GetMethodDesc();

if (pCurDeclMD->IsAsyncVariantMethod())
{
continue;
}

#ifdef _DEBUG
MethodTable *pCurDeclMT = pCurDeclMD->GetMethodTable();
CONSISTENCY_CHECK(!pMT->IsInterface() || pCurDeclMT == pMT->GetCanonicalMethodTable());
Expand Down Expand Up @@ -1303,41 +1316,45 @@ MemberLoader::FindMethodByName(MethodTable * pMT, LPCUTF8 pszName, FM_Flags flag
{
MethodDesc *pCurMD = it.GetDeclMethodDesc();

if (pCurMD != NULL)
// Since we search backwards, we may find an async variant before the other variant. We simply skip over.
// This API is not supposed to return async variants. (add flags to FM_Flags, if such behavior is desired)
Comment thread
VSadov marked this conversation as resolved.
if (pCurMD->IsAsyncVariantMethod())
{
// If we're working from the end of the vtable, we'll cover all the non-virtuals
// first, and so if we're supposed to ignore virtuals (see setting of the flag
// below) then we can just break out of the loop and go to the parent.
if ((flags & FM_ExcludeVirtual) && pCurMD->IsVirtual())
{
break;
}
continue;
}

if (FM_PossibleToSkipMethod(flags) && FM_ShouldSkipMethod(pCurMD->GetAttrs(), flags))
{
continue;
}
// If we're working from the end of the vtable, we'll cover all the non-virtuals
// first, and so if we're supposed to ignore virtuals (see setting of the flag
// below) then we can just break out of the loop and go to the parent.
if ((flags & FM_ExcludeVirtual) && pCurMD->IsVirtual())
{
break;
}

if (StrCompFunc(pszName, pCurMD->GetNameOnNonArrayClass()) == 0)
if (FM_PossibleToSkipMethod(flags) && FM_ShouldSkipMethod(pCurMD->GetAttrs(), flags))
{
continue;
}

if (StrCompFunc(pszName, pCurMD->GetNameOnNonArrayClass()) == 0)
{
if (pRetMD != NULL)
{
if (pRetMD != NULL)
{
_ASSERTE(flags & FM_Unique);

// Found another method of this name but FM_Unique was given.
return NULL;
}

pRetMD = it.GetMethodDesc();
pRetMD->CheckRestore();

// Let's always finish iterating through this MT for FM_Unique to reveal overloads, i.e.
// methods with the same name. Returning the first/last method of the given name
// may in some cases work but it depends on the vtable order which is something we
// do not want. It can be easily broken by a seemingly unrelated change.
if (!(flags & FM_Unique))
return pRetMD;
_ASSERTE(flags & FM_Unique);

// Found another method of this name but FM_Unique was given.
return NULL;
}

pRetMD = it.GetMethodDesc();
pRetMD->CheckRestore();

// Let's always finish iterating through this MT for FM_Unique to reveal overloads, i.e.
// methods with the same name. Returning the first/last method of the given name
// may in some cases work but it depends on the vtable order which is something we
// do not want. It can be easily broken by a seemingly unrelated change.
if (!(flags & FM_Unique))
return pRetMD;
}
}

Expand Down
Loading