diff options
author | John Chen <jochen@microsoft.com> | 2016-06-01 18:36:23 -0700 |
---|---|---|
committer | John Chen <jochen@microsoft.com> | 2016-06-01 18:36:23 -0700 |
commit | 4b7c2f4e64380e8286b9edc85ff477417bd62c54 (patch) | |
tree | 462fb0dd2cce9c04cf9d75a0038d522da47609a9 | |
parent | 08786f20e89eb5f518d8d25f3e7f886f69d994ea (diff) | |
download | coreclr-4b7c2f4e64380e8286b9edc85ff477417bd62c54.tar.gz coreclr-4b7c2f4e64380e8286b9edc85ff477417bd62c54.tar.bz2 coreclr-4b7c2f4e64380e8286b9edc85ff477417bd62c54.zip |
Add limit to number of generics methods to compile by CrossGen (#5383)
Recursive generic definitions can easily make CrossGen take very
long time to complete. This is the cause of a failure in issue #5366.
This is fixed by limiting the number of methods to compile by CrossGen.
-rw-r--r-- | src/vm/compile.cpp | 6 | ||||
-rw-r--r-- | src/vm/compile.h | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index e3bdf34721..90607f7f80 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -4939,6 +4939,8 @@ CEEPreloader::CEEPreloader(Module *pModule, GetAppDomain()->ToCompilationDomain()->SetTargetImage(m_image, this); + m_methodCompileLimit = pModule->GetMDImport()->GetCountWithTokenKind(mdtMethodDef) * 10; + #ifdef FEATURE_FULL_NGEN m_fSpeculativeTriage = FALSE; m_fDictionariesPopulated = FALSE; @@ -5148,7 +5150,7 @@ void CEEPreloader::MethodReferencedByCompiledCode(CORINFO_METHOD_HANDLE handle) if (pEntry->fScheduled) return; - m_uncompiledMethods.Append(pMD); + AppendUncompiledMethod(pMD); } else { @@ -5358,7 +5360,7 @@ void CEEPreloader::AddToUncompiledMethods(MethodDesc *pMD, BOOL fForStubs) } // Add it to the set of uncompiled methods - m_uncompiledMethods.Append(pMD); + AppendUncompiledMethod(pMD); } // diff --git a/src/vm/compile.h b/src/vm/compile.h index 9a9cc144cc..97c6cc1465 100644 --- a/src/vm/compile.h +++ b/src/vm/compile.h @@ -527,6 +527,17 @@ class CEEPreloader : public ICorCompilePreloader // Array of methods that we need to compile. SArray<MethodDesc*> m_uncompiledMethods; + int m_methodCompileLimit; + + void AppendUncompiledMethod(MethodDesc *pMD) + { + if (m_methodCompileLimit > 0) + { + m_uncompiledMethods.Append(pMD); + m_methodCompileLimit--; + } + } + struct DuplicateMethodEntry { MethodDesc * pMD; |