Move DispatchMap pointer to MethodTable (#85698)
Sending this for consideration. The old approach also had an advantage. Wouldn't be the end of the world if we keep that.
Before this PR, accessing dispatch map involved:
* Reading optional fields to find the field with the right tag
* The optional field contained an integer index into a table
* The index was used to index into a dispatch map table to find a pointer to the actual dispatch map
* We then followed the pointer to get to the dispatch map.
The advantage of this scheme is smaller working set (MethodTable is smaller), but this assumes the MethodTable has other optional fields (because we still need a pointer to the optional fields). Turns out most MethodTables only need optional fields pointer because of the dispatch map and if we move them to MethodTable, we no longer need an optional field pointer.
This PR simply moves the dispatch map pointer to MethodTable.
I'm seeing another 15 kB saving on BasicMinimalApi. Plus the code looks simpler.
13 files changed: