Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-03-08 21:39:43 +0300
committerGitHub <noreply@github.com>2018-03-08 21:39:43 +0300
commitcc58f38be5965e0fedf62882440a6bf6811e3a6c (patch)
tree0620c87175a2ce85bc178ba7891d9048046b41b3 /src
parent9e176fb2564a9149a24f7ae8e196d0b41f3c3730 (diff)
Fix up handling of Delegate.Invoke in the scanner (#5515)
We special case the method to avoid unnecessarily creating the body (it's pretty big). The codegen might ask questions about the vtable before realizing it's this special method. If the delegate type is not allocated, (not a ConstructedEEType) we wouldn't have vtable information for it from the scanner. Fixing that.
Diffstat (limited to 'src')
-rw-r--r--src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs b/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs
index 009dc068b..17bfecd2a 100644
--- a/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs
+++ b/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs
@@ -354,10 +354,14 @@ namespace Internal.IL
}
}
- if (method.OwningType.IsDelegate && method.Name == "Invoke")
+ if (method.OwningType.IsDelegate && method.Name == "Invoke" &&
+ opcode != ILOpcode.ldftn && opcode != ILOpcode.ldvirtftn)
{
- // TODO: might not want to do this if scanning for reflection.
- // This is expanded as an intrinsic, not a function call.
+ // This call is expanded as an intrinsic; it's not an actual function call.
+ // Before codegen realizes this is an intrinsic, it might still ask questions about
+ // the vtable of this virtual method, so let's make sure it's marked in the scanner's
+ // dependency graph.
+ _dependencies.Add(_factory.VTable(method.OwningType), reason);
return;
}