Browse Source

Merge pull request #1969 from icsharpcode/fix-1889

Fix #1889: [ILSpy.ReadyToRun] Indexing the methods
pull/1972/head
Siegfried Pammer 5 years ago committed by GitHub
parent
commit
da038965e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      ILSpy.ReadyToRun/ReadyToRunLanguage.cs

19
ILSpy.ReadyToRun/ReadyToRunLanguage.cs

@ -20,6 +20,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Reflection.PortableExecutable; using System.Reflection.PortableExecutable;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -74,13 +75,16 @@ namespace ICSharpCode.ILSpy.ReadyToRun
Debug.Assert(reader.Machine == Machine.I386); Debug.Assert(reader.Machine == Machine.I386);
bitness = 32; bitness = 32;
} }
foreach (List<ReadyToRunMethod> readyToRunMethodList in reader.Methods.Values) { if (cacheEntry.methodMap == null) {
foreach (ReadyToRunMethod readyToRunMethod in readyToRunMethodList) { cacheEntry.methodMap = reader.Methods.Values
if (readyToRunMethod.MethodHandle == method.MetadataToken) { .SelectMany(m => m)
// TODO: Indexing .GroupBy(m => m.MethodHandle)
foreach (RuntimeFunction runtimeFunction in readyToRunMethod.RuntimeFunctions) { .ToDictionary(g => g.Key, g => g.ToArray());
Disassemble(output, reader, readyToRunMethod, runtimeFunction, bitness, (ulong)runtimeFunction.StartAddress); }
} if (cacheEntry.methodMap.TryGetValue(method.MetadataToken, out var methods)) {
foreach (var readyToRunMethod in methods) {
foreach (RuntimeFunction runtimeFunction in readyToRunMethod.RuntimeFunctions) {
Disassemble(output, reader, readyToRunMethod, runtimeFunction, bitness, (ulong)runtimeFunction.StartAddress);
} }
} }
} }
@ -191,6 +195,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
{ {
public ReadyToRunReader readyToRunReader; public ReadyToRunReader readyToRunReader;
public string failureReason; public string failureReason;
public Dictionary<EntityHandle, ReadyToRunMethod[]> methodMap;
} }
} }
} }
Loading…
Cancel
Save