Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Do not devirtualize indirect calls - #13561

Merged
MichalStrehovsky merged 4 commits into
dotnet:masterfrom
MichalStrehovsky:devirt
Aug 25, 2017
Merged

MichalStrehovsky merged 4 commits into
dotnet:masterfrom
MichalStrehovsky:devirt

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Not sure if this is the right fix but it makes my problem go away.

I'm seeing the affected code take the impDevirtualizeCall code path
with CT_INDIRECT calls. gtCallMethHnd is a GenTreePtr in that case
(it's a union) and passing that as as CORINFO_METHOD_HANDLE leads
to bad things.

Not sure if this is the right fix but it makes my problem go away.

I'm seeing the affected code take the `impDevirtualizeCall` code path
with CT_INDIRECT calls. `gtCallMethHnd` is a `GenTreePtr` in that case
(it's a union) and passing that as as `CORINFO_METHOD_HANDLE` leads
to bad things.
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

JitDump for the method that was failing for me (up to the point when bad things happened): devirt-fail.txt

@AndyAyersMS PTAL

@AndyAyersMS

Copy link
Copy Markdown
Member

The fix looks good. Can you add a test case?

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

I've added a regression test, but couldn't make this repro with CoreCLR - it only reproes with the CoreRT compiler. We do run CoreCLR regression tests in CoreRT though.

@AndyAyersMS

Copy link
Copy Markdown
Member

The fact that this repros only on CoreRT is actually good news... thanks for the test.

@MichalStrehovsky
MichalStrehovsky merged commit 06fc72a into dotnet:master Aug 25, 2017
@MichalStrehovsky
MichalStrehovsky deleted the devirt branch August 25, 2017 16:28
@karelz karelz modified the milestone: 2.1.0 Aug 28, 2017
MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this pull request Aug 28, 2017
MichalStrehovsky added a commit to dotnet/corert that referenced this pull request Aug 28, 2017
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.

4 participants