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

Remove UMThunkStub for all non-x86 scenarios #33581

Closed
AaronRobinsonMSFT opened this issue Mar 14, 2020 · 2 comments · Fixed by #34251 or #34315
Closed

Remove UMThunkStub for all non-x86 scenarios #33581

AaronRobinsonMSFT opened this issue Mar 14, 2020 · 2 comments · Fixed by #34251 or #34315

Comments

@AaronRobinsonMSFT
Copy link
Member

AaronRobinsonMSFT commented Mar 14, 2020

With the completion of support for NativeCallableAttribute being public - #33005, there is some additional cleanup that can now occur. The UMThunkStub() calls written in assembly can now be replaced by the newly added JIT helpers for Reverse P/Invoke Enter/Exit.

EXTERN_C void JIT_ReversePInvokeEnter(ReversePInvokeFrame* frame)
{
_ASSERTE(frame != NULL);
Thread* thread = GetThreadNULLOk();
// If a thread instance exists and is in the
// correct GC mode attempt a quick transition.
if (thread != NULL
&& !thread->PreemptiveGCDisabled())
{
// Manually inline the fast path in Thread::DisablePreemptiveGC().
thread->m_fPreemptiveGCDisabled.StoreWithoutBarrier(1);
if (g_TrapReturningThreads.LoadWithoutBarrier() == 0)
{
frame->currentThread = thread;
return;
}
}
JIT_ReversePInvokeEnterRare(frame);
}
EXTERN_C void JIT_ReversePInvokeExit(ReversePInvokeFrame* frame)
{
_ASSERTE(frame != NULL);
_ASSERTE(frame->currentThread == GetThread());
// Manually inline the fast path in Thread::EnablePreemptiveGC().
// This is a trade off with GC suspend performance. We are opting
// to make this exit faster.
frame->currentThread->m_fPreemptiveGCDisabled.StoreWithoutBarrier(0);
}

The x86 case must still use the UMThunkStub(), but all other can now be removed.

/cc @jkoritzinsky @jkotas @janvorli

@AaronRobinsonMSFT AaronRobinsonMSFT added area-Interop-coreclr untriaged New issue has not been triaged by the area owner labels Mar 14, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't add an area label to this Issue.

Checkout this page to find out which area owner to ping, or please add exactly one area label to help train me in the future.

@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Remove UMThunkStub from non-Windows x86 scenarios Remove UMThunkStub for all non-x86 scenarios Mar 30, 2020
@AaronRobinsonMSFT AaronRobinsonMSFT removed the untriaged New issue has not been triaged by the area owner label Mar 30, 2020
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 5.0 milestone Mar 30, 2020
@safern
Copy link
Member

safern commented Mar 31, 2020

This was reverted in: #34306

@safern safern reopened this Mar 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants