private void SetExpandedVSlotMap(MethodTable entryTable, MethodDef entryDef, ref VirtualImpl impl) { if (!ExpandedVSlotMap.TryGetValue(entryTable, out var defMap)) { defMap = new Dictionary <MethodDef, VirtualImpl>(); ExpandedVSlotMap.Add(entryTable, defMap); } defMap[entryDef] = impl; }
public VirtualSlot(VirtualSlot other) { foreach (var kv in other.Entries) { Entries.Add(kv.Key, new HashSet <MethodDef>(kv.Value)); } if (other.Entries.Count > 0) { Impl = other.Impl; } }
// 导出方法表结构 public void DumpMethodTables(StringBuilder sb) { foreach (var kv in Context.TypeMgr.MethodTableMap) { sb.AppendFormat("[{0}]\n", kv.Key); bool flag = false; foreach (var kv2 in kv.Value.VSlotMap) { string expSigName = kv2.Key; var entries = kv2.Value.Entries; VirtualImpl impl = kv2.Value.Impl; // 跳过无覆盖的方法 if (entries.Count == 1 && impl.IsValid() && entries.TryGetValue(impl.ImplTable, out var defSet) && defSet.Count == 1 && defSet.First() == impl.ImplMethod) { continue; } sb.AppendFormat(" - {0}: {1}\n", expSigName, impl); foreach (var kv3 in entries) { foreach (var mdef in kv3.Value) { sb.AppendFormat(" - {0} -> {1}\n", kv3.Key, mdef); } } sb.Append('\n'); flag = true; } if (!flag) { sb.Append('\n'); } } }