Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Adjust IL scanner for generic inlining #7618

Merged
merged 1 commit into from
Jul 15, 2019

Conversation

MichalStrehovsky
Copy link
Member

When we turned on generic inlining in RyuJIT, we started inlining things potentially across multiple shared method bodies. There is a pathological case when we may end up inlining a shared instance method on a type that otherwise wasn't allocated in the program - RyuJIT would end up asking questions about things we didn't scan.

This is because scanning happens on canonical method bodies, and dictionary dependencies are only investigated when a specific dictionary is added to the graph. If a type wasn't allocated, there's no generic dictionary to look at.

This is a conservative fix and comes with a small size on disk regression - about 16 kB on Hello World (0 kB for the "minimal Hello World with reflection disabled"), and about 80 kB for ASP.NET.

I investigated preventing RyuJIT from inlining these methods, but RyuJIT is rather uncooperative when it comes to generic inlining. I think this is why UTC operates on runtime determined types directly rather than __Canon.

When we turned on generic inlining in RyuJIT, we started inlining things potentially across multiple shared method bodies. There is a pathological case when we may end up inlining a shared instance method on a type that otherwise wasn't allocated in the program - RyuJIT would end up asking questions about things we didn't scan.

This is because scanning happens on canonical method bodies, and dictionary dependencies are only investigated when a specific dictionary is added to the graph. If a type wasn't allocated, there's no generic dictionary to look at.

This is a conservative fix and comes with a small size on disk regression - about 16 kB on Hello World (0 kB for the "minimal Hello World with reflection disabled"), and about 80 kB for ASP.NET.
@jkotas jkotas merged commit ede6ac3 into dotnet:master Jul 15, 2019
@MichalStrehovsky MichalStrehovsky deleted the genericInlineScanner branch July 15, 2019 15:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants