Title: Hashtable of types for R2R modules
authorFadi Hanna <fadim@microsoft.com>
Sat, 5 Mar 2016 01:26:07 +0000 (17:26 -0800)
committerFadi Hanna <fadim@microsoft.com>
Wed, 23 Mar 2016 20:04:51 +0000 (13:04 -0700)
commit30631742c9e4468264c39060cc9533bd9c3a6e3c
treeebcd3234153d3aa4cd067a75e36188676a67f79d
parent1a9eb1c5f4d9f257f3f96ef5205a0eb1a23395c3
Title: Hashtable of types for R2R modules
Description: This change replaces the hashtable of types that we dynamically build at module load time with a statically built hashtable at crossgen time, for R2R modules. Typedef tokens and exported type tokens are stored in that hashtable, hashed by their full type name.

Changes include:
- Adding support for NativeFormat hashtables (NativeFormat hashtable reader and writer + supporting functionalities)
- Changes to prevent the allocation and building of m_pAvailableClasses and m_pAvailableClassesCaseIns for a R2R module
- Logic in crossgen to build the hashtable of types, using the NativeFormat (table saved to a new section)
- Refactoring the type lookup functions to return results in a HashedTypeEntry data structure, which supports token based results, as well as EEClassHashEntry_t* based results
- Changes/Cleanup to the ClassLoader::GetClassValue to support the new lookup type
- Fixed small bugs in the std implementation
- Fallback to old hashtable lookup algorithm supported for:
1) Case insensitive type loading
2) R2R image built with older version of crossgen (not having static hashtable)

Tested following scenarios:
- Token based lookups
- Type name based lookups (Type.GetType API), including case insensitive scenarios
- Nested types
- Forwarded types (and forwarded nested types), up to 2 levels of forwarding
- Old R2R image created with previous version of crossgen
19 files changed:
src/inc/clr_std/algorithm
src/inc/clr_std/utility
src/inc/clr_std/vector
src/inc/readytorun.h
src/vm/assembly.cpp
src/vm/ceeload.cpp
src/vm/ceeload.h
src/vm/clrprivtypecachewinrt.cpp
src/vm/clsload.cpp
src/vm/clsload.hpp
src/vm/nativeformatreader.h
src/vm/readytoruninfo.cpp
src/vm/readytoruninfo.h
src/vm/typeparse.cpp
src/zap/nativeformatwriter.cpp
src/zap/nativeformatwriter.h
src/zap/zapimage.cpp
src/zap/zapimage.h
src/zap/zapreadytorun.cpp