Fix caching EH clause type handle problem in a conservative fashion (#40493)
authorDavid Wrighton <davidwr@microsoft.com>
Fri, 7 Aug 2020 03:56:25 +0000 (20:56 -0700)
committerGitHub <noreply@github.com>
Fri, 7 Aug 2020 03:56:25 +0000 (20:56 -0700)
commit74611e5a2148a94b9854e6e38a956a94ace37b19
tree503964aeda6b7e5d61c7fae4795bdbd023221ee7
parenta81e48ffb17aa98adf6144eec4d52e10acf5e999
Fix caching EH clause type handle problem in a conservative fashion (#40493)

This caching was intended to improve performance of repeatedly catching exceptions. As it happens, the critical section that was being used to protect the cache could trigger a GC, and cause a failure under stress. However, some years ago, the eh clause as operated on by the ResolveEHClause method was changed to be a copy of the EHClause stored during the JIT operation, and thus the caching efforts done in this function did not provide value, and in fact are a minor source of multithread scaling concerns.

- Remove the dynamic caching. (Note, the TypeHandle member variable and the HasCachedTypeHandle function, are still used for LCG dynamic methods.)
- Rename the critical section used to protect the cache, as it is now only used to protect from loading multiple copies of the JIT.
src/coreclr/src/vm/codeman.cpp
src/coreclr/src/vm/codeman.h