Improve the performance of the type loader (#24177)
authorDavid Wrighton <davidwr@microsoft.com>
Thu, 25 Apr 2019 17:57:09 +0000 (10:57 -0700)
committerGitHub <noreply@github.com>
Thu, 25 Apr 2019 17:57:09 +0000 (10:57 -0700)
commit713091f4e504b9a194dcb2cfda180baa21572c58
treeec53ab52a5747f018ce7b9832aa4b212fe72d976
parente3d7d212a4d5350227c1fcc6949e9a379e9162c5
Improve the performance of the type loader (#24177)

Improve the performance of the type loader
- Disable interface ambiguity checks in Corelib
- Improve StackingAllocator perf
  - Increase size of allocation blocks
  - Cleanup allocation blocks comletely on gc suspension
- Check for presence of generic parameters to methods in a more efficient manner
  - Querying the count of GenericParameter records requires a binary search in the GenericParams table
  - Checking the generic flag on the method signature is effectively free
- Skip unnecessary checks in EnumerateClassMethods for corelib
- Use Sanity check flag where appropriate
- Use slightly faster hashtable functions in StringLiteralMap
  - Remove pointless string literal entry hash table search
- Change stacking allocator to not be allocated for the lifetime of a thread, but instead its allocated/destroyed around the first frame on the thread that needs the allocator.
  - Allocate at most 1 stacking allocator per thread
  - The allocation is on the stack via _alloca (as managed by the ACQUIRE_STACKING_ALLOCATOR macro
  - This will put an 8KB buffer on the stack, and if there is need for a larger buffer it will allocate off of the heap.
  - Stacking allocator initial block is always present, so the allocation routine for the allocator can be somewhat simpler
  - More logic has been move the the cpp file, to reduce header bloat, and improve iteration when modifying StackingAllocator code
  - Avoid use of alloca for StackingAllocator when less than 512KB of stack is available
16 files changed:
src/vm/assemblyname.cpp
src/vm/assemblynative.cpp
src/vm/ceeload.cpp
src/vm/class.cpp
src/vm/classcompat.cpp
src/vm/classcompat.h
src/vm/eehash.h
src/vm/eehash.inl
src/vm/methodtable.cpp
src/vm/methodtablebuilder.cpp
src/vm/methodtablebuilder.h
src/vm/stackingallocator.cpp
src/vm/stackingallocator.h
src/vm/stringliteralmap.cpp
src/vm/threads.cpp
src/vm/threads.h