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

x86: Deactivate P/Invoke frames after a native call. #8464

Merged
merged 2 commits into from
Dec 6, 2016

Conversation

pgavlin
Copy link

@pgavlin pgavlin commented Dec 5, 2016

Although this does not appear to be strictly necessary, this matches
JIT32's behavior. With this change, the stack walker will ignore the
P/Invoke frame even while it is still present on its thread's frame
list.

Fixes VSO 297109.

Although this does not appear to be strictly necessary, this matches
JIT32's behavior. With this change, the stack walker will ignore the
P/Invoke frame even while it is still present on its thread's frame
list.

Fixes VSO 297109.
@pgavlin
Copy link
Author

pgavlin commented Dec 5, 2016

@BruceForstall @dotnet/jit-contrib PTAL

@BruceForstall
Copy link
Member

:shipit:

@@ -2963,7 +2963,7 @@ void Lowering::InsertPInvokeCallEpilog(GenTreeCall* call)
BlockRange().InsertBefore(insertionPoint, LIR::SeqTree(comp, tree));

// Pop the frame if necessary. On 32-bit targets this only happens in the method epilog; on 64-bit targets thi

Choose a reason for hiding this comment

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

This conflict with what you added:

On 32-bit targets this only happens in the method epilog;

Copy link
Author

Choose a reason for hiding this comment

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

There is a difference between popping and deactivating a frame: the latter removes the frame from its thread's frame list, while the former leaves the frame on the list but marks it s.t. the stack walker ignores it.

#else
const CORINFO_EE_INFO::InlinedCallFrameInfo& callFrameInfo = comp->eeGetEEInfo()->inlinedCallFrameInfo;

GenTreeLclFld* const storeCallSiteTracker =
Copy link

@briansull briansull Dec 6, 2016

Choose a reason for hiding this comment

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

A comment similar to this one should be added:
(This is the comment that is used when we setup this value in InsertPInvokeCallProlog)

     // ----------------------------------------------------------------------------------
     // InlinedCallFrame.m_pCallerReturnAddress = &label (the address of the instruction immediately following the call)		     // InlinedCallFrame.m_pCallerReturnAddress = &label (the address of the instruction immediately following the call)

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@pgavlin pgavlin merged commit b19ac36 into dotnet:master Dec 6, 2016
@pgavlin pgavlin deleted the VSO297109 branch December 6, 2016 17:14
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
x86: Deactivate P/Invoke frames after a native call.

Commit migrated from dotnet/coreclr@b19ac36
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