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. 15
      ILSpy.ReadyToRun/ReadyToRunLanguage.cs

15
ILSpy.ReadyToRun/ReadyToRunLanguage.cs

@ -20,6 +20,7 @@ using System; @@ -20,6 +20,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Runtime.CompilerServices;
@ -74,10 +75,14 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -74,10 +75,14 @@ namespace ICSharpCode.ILSpy.ReadyToRun
Debug.Assert(reader.Machine == Machine.I386);
bitness = 32;
}
foreach (List<ReadyToRunMethod> readyToRunMethodList in reader.Methods.Values) {
foreach (ReadyToRunMethod readyToRunMethod in readyToRunMethodList) {
if (readyToRunMethod.MethodHandle == method.MetadataToken) {
// TODO: Indexing
if (cacheEntry.methodMap == null) {
cacheEntry.methodMap = reader.Methods.Values
.SelectMany(m => m)
.GroupBy(m => m.MethodHandle)
.ToDictionary(g => g.Key, g => g.ToArray());
}
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);
}
@ -85,7 +90,6 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -85,7 +90,6 @@ namespace ICSharpCode.ILSpy.ReadyToRun
}
}
}
}
public override void WriteCommentLine(ITextOutput output, string comment)
{
@ -191,6 +195,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -191,6 +195,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
{
public ReadyToRunReader readyToRunReader;
public string failureReason;
public Dictionary<EntityHandle, ReadyToRunMethod[]> methodMap;
}
}
}
Loading…
Cancel
Save