You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reverse P/Invokes should notify profiler when transitioning between unmanaged and managed #46177
Thanks for reporting this, if you have any other context could we capture that? Do you know why we only notify on x86 for reverse pinvokes? Is it due to IL stubs not being on x86?
On x86 we use a dynamically emitted assembly stub that wraps the IL stub. That assembly stub is what emits the profiler notifications. On other platforms we just use the IL stubs, so nothing is calling the profiler.
Activity
AaronRobinsonMSFT commentedon Dec 17, 2020
/cc @tommcdon @davmason
davmason commentedon Dec 17, 2020
Thanks for reporting this, if you have any other context could we capture that? Do you know why we only notify on x86 for reverse pinvokes? Is it due to IL stubs not being on x86?
jkoritzinsky commentedon Dec 17, 2020
On x86 we use a dynamically emitted assembly stub that wraps the IL stub. That assembly stub is what emits the profiler notifications. On other platforms we just use the IL stubs, so nothing is calling the profiler.
jkotas commentedon Dec 17, 2020
I assume that you mean
UnmanagedCallersOnlymethods. Is that right?Marshaled delegates that are sometimes also called reverse PInvoke should be fine.
jkoritzinsky commentedon Dec 17, 2020
From what I could tell both delegate reverse pinvoke and UnmanagedCallersOnly reverse pinvoke are the same for this case.
jkotas commentedon Dec 17, 2020
FWIW,
DirectStubLinker::EmitProfilerBeginTransitionCallbackis supposed to handle the delegate reverse pinvoke case.Add SEH hookup and profiler/debugger hooks to Reverse P/Invoke entry …
Remove extra UnmanagedCallersOnly overhead on x86 (dotnet#46238)
jkoritzinsky commentedon Apr 27, 2021
Fixed by #46238