I'd like to understand how ubiquitous JIT inlining can be.
Suppose in my code I call some function from say System.IO
assembly and pass a callback reference to a function implemented in my code for being called from inside that System.IO
function. In my function there's GetCallingAssembly()
call. So if my callback gets inlined into System.IO
the call to GetCallingAssembly()
that originally was in my code and was intended to say the "current" method is called from inside System.IO
will say that it now is called from inside my code.
Is such inlining possible or are .NET runtime assemblies treated differently so that JIT inlining of user code into .NET runtime code is not allowed?
You can safely assume the callback will not be inlined. .NET Framework assemblies are always pre-jitted by ngen.exe at install time, there's no option to alter that code afterwards. Furthermore, callbacks through a delegate are never inlined even if the jitter optimizer could deduce what the delegate's target method might be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With