Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable inlining P/Invokes into try blocks with no catch or filter clauses V2 #73661

Merged
merged 6 commits into from
Aug 23, 2022

Conversation

jkoritzinsky
Copy link
Member

Try 2 at enabling P/Invoke inlining into try blocks where we don't resume within the same method call.

The first commit is the last attempt. The second commit is the change to fix the break. In particular, we change the code to only check if the return address is non-null in the 64-bit-only branch, so the code for ARM32 stays exactly the same as in main.

I've run this test locally about 30 times and couldn't reproduce the crash with the fix, so I believe this fix works.

@danmoseley
Copy link
Member

Linking original #73032

@jkoritzinsky
Copy link
Member Author

Since this is fully green on CI with the original offending test re-enabled, I'd like to get this merged by end of week if possible

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JIT changes still look fine to me. I will trigger gcstress on this as we (the jit team) were seeing failures there.

@jakobbotsch
Copy link
Member

/azp run runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
Copy link
Member

Most of the gcstress failures are known: #69092, #73679, #73808.
However the DefaultInterfaces arm64 failure I don't recognize, can you take a look @jkoritzinsky?

@jkoritzinsky
Copy link
Member Author

/azp run runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky
Copy link
Member Author

@jakobbotsch I don't understand how the change I made could have caused AVs during SuperPMI replay. Are there any known current issues that this PR might be interacting with?

@jakobbotsch
Copy link
Member

@jakobbotsch I don't understand how the change I made could have caused AVs during SuperPMI replay. Are there any known current issues that this PR might be interacting with?

Indeed it is not related to your PR, it is being fixed by #74037.

if ((GetSP(pDispatcherContext->ContextRecord) < (TADDR)pICF)
&& ((UINT_PTR)pICF < uCallerSP)
&& InlinedCallFrame::FrameHasActiveCall(pICF))
&& ((UINT_PTR)pICF < uCallerSP))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't link the ICF frame for the whole stub on any platform in any case anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still link it for the whole stub on 32-bit platforms. This condition didn't change between main and this PR (the V1 version of the change added the IsActiveCall check, but the V2 version doesn't include it).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll get rid of the diff here since I'm not changing the logic any more

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@jkoritzinsky
Copy link
Member Author

@jakobbotsch looks like I'm still seeing SuperPMI failures even though that seems to have been fixed. Any ideas?

@jakobbotsch
Copy link
Member

@jakobbotsch looks like I'm still seeing SuperPMI failures even though that seems to have been fixed. Any ideas?

@dotnet/jit-contrib anyone can investigate? (I'm OOF)

@jkoritzinsky
Copy link
Member Author

Only failure is a build timeout that looks unrelated, so merging this in.

@jkoritzinsky jkoritzinsky merged commit affc0fc into dotnet:main Aug 23, 2022
@jkoritzinsky jkoritzinsky deleted the inline-pinvoke-v2-no-arm branch August 23, 2022 23:46
@AndyAyersMS
Copy link
Member

Possible improvements:

@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants