diff options
author | Tomas Rylek <trylek@microsoft.com> | 2015-12-03 05:00:34 +0300 |
---|---|---|
committer | Tomas Rylek <trylek@microsoft.com> | 2015-12-03 05:00:34 +0300 |
commit | 8ceae3fd88a3c3ca9db381d22369a75359f31844 (patch) | |
tree | 72ea1b5799590c8788597289166247ac6ffe5abd /src/Native/Runtime/RuntimeInstance.cpp | |
parent | ecaf9c332abf189efb3f1d62fe72a6cc1ae74705 (diff) |
Fix module initialization to recreate the generic type hash table in MRT upon module registration
[tfs-changeset: 1553634]
Diffstat (limited to 'src/Native/Runtime/RuntimeInstance.cpp')
-rw-r--r-- | src/Native/Runtime/RuntimeInstance.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Native/Runtime/RuntimeInstance.cpp b/src/Native/Runtime/RuntimeInstance.cpp index e24abd5f5..91f38176c 100644 --- a/src/Native/Runtime/RuntimeInstance.cpp +++ b/src/Native/Runtime/RuntimeInstance.cpp @@ -436,6 +436,25 @@ bool RuntimeInstance::RegisterModule(ModuleHeader *pModuleHeader) InitProfiling(pModuleHeader); #endif // FEATURE_PROFILING + { + // Support for late-loaded modules: flush the generic hashtable to force its regeneration + // including the new module. + // @TODO: This is obviously not ideal, we would be better of by incrementally adding + // types in the new module to the existing hashtable. Unfortunately today implementation + // doesn't expect the table to be growable, BuildGenericTypeHashTable starts out + // by calculating the total number of elements to be put there. Additionally, we should + // revisit the if (m_genericInstHashtabCount == 0) statement in LookupGenericInstance, + // there seems to be a distinction being made between "single-module" and "multi-module" + // apps the boundaries of which might have shifted recently and are likely to continue + // shifting in the near future. + ReaderWriterLock::WriteHolder write(&m_GenericHashTableLock); + if (m_pGenericTypeHashTable != nullptr) + { + delete m_pGenericTypeHashTable; + m_pGenericTypeHashTable = nullptr; + } + } + pModule.SuppressRelease(); // This event must occur after the module is added to the enumeration DebugEventSource::SendModuleLoadEvent(pModule); |