summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFilip Navara <filip.navara@gmail.com>2019-01-04 23:54:06 +0100
committerJan Kotas <jkotas@microsoft.com>2019-01-04 14:54:06 -0800
commit2ee2cb3a35fe1fa8d2d3b54c6839368ab8c89b73 (patch)
treea995135bcdd08fb7aced51bb75f2e8629140f3ef /src
parent509419356160fc419a6bbf1b70f5efb8e1dc4d10 (diff)
downloadcoreclr-2ee2cb3a35fe1fa8d2d3b54c6839368ab8c89b73.tar.gz
coreclr-2ee2cb3a35fe1fa8d2d3b54c6839368ab8c89b73.tar.bz2
coreclr-2ee2cb3a35fe1fa8d2d3b54c6839368ab8c89b73.zip
Avoid passing stack crawl mark unnecessarily deep in the call stack. (#21783)
* Avoid passing stack crawl mark unnecessarily deep in the call stack. * Move stack crawl from TypeName::GetTypeManaged to RuntimeTypeHandle::GetTypeByName.
Diffstat (limited to 'src')
-rw-r--r--src/vm/runtimehandles.cpp3
-rw-r--r--src/vm/typeparse.cpp45
-rw-r--r--src/vm/typeparse.h3
-rw-r--r--src/vm/typestring.h2
4 files changed, 21 insertions, 32 deletions
diff --git a/src/vm/runtimehandles.cpp b/src/vm/runtimehandles.cpp
index e25a1a3ddb..b41026facd 100644
--- a/src/vm/runtimehandles.cpp
+++ b/src/vm/runtimehandles.cpp
@@ -1416,7 +1416,8 @@ void QCALLTYPE RuntimeTypeHandle::GetTypeByName(LPCWSTR pwzClassName, BOOL bThro
COMPlusThrowArgumentNull(W("className"),W("ArgumentNull_String"));
{
- typeHandle = TypeName::GetTypeManaged(pwzClassName, NULL, bThrowOnError, bIgnoreCase, /*bProhibitAsmQualifiedName =*/ FALSE, pStackMark,
+ typeHandle = TypeName::GetTypeManaged(pwzClassName, NULL, bThrowOnError, bIgnoreCase, /*bProhibitAsmQualifiedName =*/ FALSE,
+ SystemDomain::GetCallersAssembly(pStackMark),
bLoadTypeFromPartialNameHack, (OBJECTREF*)keepAlive.m_ppObject,
pPrivHostBinder);
}
diff --git a/src/vm/typeparse.cpp b/src/vm/typeparse.cpp
index dd7ce535de..1fd867ad5e 100644
--- a/src/vm/typeparse.cpp
+++ b/src/vm/typeparse.cpp
@@ -1141,7 +1141,6 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
/*pAssemblyGetType =*/ NULL,
/*fEnableCASearchRules = */ TRUE,
/*fProhibitAsmQualifiedName = */ FALSE,
- NULL,
pRequestingAssembly,
nullptr,
FALSE,
@@ -1181,7 +1180,7 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
BOOL bThrowIfNotFound,
BOOL bIgnoreCase,
BOOL bProhibitAsmQualifiedName,
- StackCrawlMark* pStackMark,
+ Assembly* pRequestingAssembly,
BOOL bLoadTypeFromPartialNameHack,
OBJECTREF *pKeepAlive,
ICLRPrivBinder * pPrivHostBinder)
@@ -1225,16 +1224,15 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
BOOL bPeriodPrefix = szTypeName[0] == W('.');
TypeHandle result = pTypeName->GetTypeWorker(
- bPeriodPrefix ? FALSE : bThrowIfNotFound,
- bIgnoreCase,
- pAssemblyGetType ? pAssemblyGetType->GetAssembly() : NULL,
- /*fEnableCASearchRules = */TRUE,
- bProhibitAsmQualifiedName,
- pStackMark,
- NULL,
+ bPeriodPrefix ? FALSE : bThrowIfNotFound,
+ bIgnoreCase,
+ pAssemblyGetType ? pAssemblyGetType->GetAssembly() : NULL,
+ /*fEnableCASearchRules = */TRUE,
+ bProhibitAsmQualifiedName,
+ pRequestingAssembly,
pPrivHostBinder,
bLoadTypeFromPartialNameHack,
- pKeepAlive);
+ pKeepAlive);
if (bPeriodPrefix && result.IsNull())
{
@@ -1255,16 +1253,15 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
}
result = pTypeName->GetTypeWorker(
- bThrowIfNotFound,
- bIgnoreCase,
- pAssemblyGetType ? pAssemblyGetType->GetAssembly() : NULL,
- /*fEnableCASearchRules = */TRUE,
- bProhibitAsmQualifiedName,
- pStackMark,
- NULL,
+ bThrowIfNotFound,
+ bIgnoreCase,
+ pAssemblyGetType ? pAssemblyGetType->GetAssembly() : NULL,
+ /*fEnableCASearchRules = */TRUE,
+ bProhibitAsmQualifiedName,
+ pRequestingAssembly,
pPrivHostBinder,
bLoadTypeFromPartialNameHack,
- pKeepAlive);
+ pKeepAlive);
}
return result;
@@ -1320,7 +1317,7 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
COMPlusThrow(kArgumentException, IDS_EE_CANNOT_HAVE_ASSEMBLY_SPEC);
}
- return pTypeName->GetTypeWorker(bThrowIfNotFound, /*bIgnoreCase = */FALSE, pAssembly, /*fEnableCASearchRules = */FALSE, FALSE, NULL, NULL,
+ return pTypeName->GetTypeWorker(bThrowIfNotFound, /*bIgnoreCase = */FALSE, pAssembly, /*fEnableCASearchRules = */FALSE, FALSE, NULL,
nullptr, // pPrivHostBinder
FALSE, NULL /* cannot find a collectible type unless it is in assembly */);
}
@@ -1387,7 +1384,6 @@ TypeHandle TypeName::GetTypeFromAsm()
/*fEnableCASearchRules = */FALSE,
FALSE,
NULL,
- NULL,
nullptr, // pPrivHostBinder
FALSE,
NULL /* cannot find a collectible type */);
@@ -1409,7 +1405,6 @@ TypeHandle TypeName::GetTypeFromAsm()
BOOL fEnableCASearchRules,
BOOL bProhibitAsmQualifiedName,
- StackCrawlMark* pStackMark,
Assembly* pRequestingAssembly,
ICLRPrivBinder * pPrivHostBinder,
BOOL bLoadTypeFromPartialNameHack,
@@ -1464,9 +1459,6 @@ TypeHandle TypeName::GetTypeFromAsm()
}
}
- if (!pRequestingAssembly && pStackMark)
- pRequestingAssembly = SystemDomain::GetCallersAssembly(pStackMark);
-
SString * pssOuterTypeName = NULL;
if (GetNames().GetCount() > 0)
{
@@ -1513,9 +1505,6 @@ TypeHandle TypeName::GetTypeFromAsm()
// Otherwise look in the caller's assembly then the system assembly
else if (fEnableCASearchRules)
{
- if (!pRequestingAssembly && pStackMark)
- pRequestingAssembly = SystemDomain::GetCallersAssembly(pStackMark);
-
// Look for type in caller's assembly
if (pRequestingAssembly)
th = GetTypeHaveAssembly(pRequestingAssembly, bThrowIfNotFound, bIgnoreCase, pKeepAlive);
@@ -1584,7 +1573,7 @@ TypeHandle TypeName::GetTypeFromAsm()
{
TypeHandle thGenericArg = m_genericArguments[i]->GetTypeWorker(
bThrowIfNotFound, bIgnoreCase,
- pAssemblyGetType, fEnableCASearchRules, bProhibitAsmQualifiedName, pStackMark, pRequestingAssembly,
+ pAssemblyGetType, fEnableCASearchRules, bProhibitAsmQualifiedName, pRequestingAssembly,
pPrivHostBinder,
bLoadTypeFromPartialNameHack,
(pKeepAlive != NULL) ? &gc.keepAlive : NULL /* Only pass a keepalive parameter if we were passed a keepalive parameter */);
diff --git a/src/vm/typeparse.h b/src/vm/typeparse.h
index 7985527701..14cd8431b2 100644
--- a/src/vm/typeparse.h
+++ b/src/vm/typeparse.h
@@ -375,7 +375,7 @@ public:
BOOL bThrowIfNotFound,
BOOL bIgnoreCase,
BOOL bProhibitAssemblyQualifiedName,
- StackCrawlMark* pStackMark,
+ Assembly* pRequestingAssembly,
BOOL bLoadTypeFromPartialNameHack,
OBJECTREF *pKeepAlive,
ICLRPrivBinder * pPrivHostBinder = nullptr);
@@ -440,7 +440,6 @@ private:
BOOL bProhibitAssemblyQualifiedName,
- StackCrawlMark* pStackMark,
Assembly* pRequestingAssembly,
ICLRPrivBinder * pPrivHostBinder,
BOOL bLoadTypeFromPartialNameHack,
diff --git a/src/vm/typestring.h b/src/vm/typestring.h
index 88a218156e..0ddec87671 100644
--- a/src/vm/typestring.h
+++ b/src/vm/typestring.h
@@ -54,7 +54,7 @@ public:
private:
friend class TypeString;
friend SString* TypeName::ToString(SString*, BOOL, BOOL, BOOL);
- friend TypeHandle TypeName::GetTypeWorker(BOOL, BOOL, Assembly*, BOOL, BOOL, StackCrawlMark*, Assembly*,
+ friend TypeHandle TypeName::GetTypeWorker(BOOL, BOOL, Assembly*, BOOL, BOOL, Assembly*,
ICLRPrivBinder * pPrivHostBinder,
BOOL, OBJECTREF *);
HRESULT OpenGenericArguments();