当一个方法资格由CLR被内联?内联、资格、方法、CLR

由网友(愿有人陪你颠沛流离)分享简介:我在应用中,往往隐含依赖于它们所包含的方法观察到了大量的堆栈内省code的没有的内联为他们的正确性。这种方法通常包括来电:I've observed a lot of "stack-introspective" code in applications, which often implicitly rely on...

我在应用中,往往隐含依赖于它们所包含的方法观察到了大量的堆栈内省code的没有的内联为他们的正确性。这种方法通常包括来电:

I've observed a lot of "stack-introspective" code in applications, which often implicitly rely on their containing methods not being inlined for their correctness. Such methods commonly involve calls to:

MethodBase.GetCurrentMethod Assembly.GetCallingAssembly Assembly.GetExecutingAssembly MethodBase.GetCurrentMethod Assembly.GetCallingAssembly Assembly.GetExecutingAssembly

现在,我发现周围的这些方法中的信息是非常混乱。我听说在运行时不会内联调用GetCurrentMethod的方法,但我找不到任何文档的效果。我见过的StackOverflow的帖子在多个场合,如这一个,说明CLR不内联跨组件调用,但 GetCallingAssembly documentation强烈表明并非如此。

Now, I find the information surrounding these methods to be very confusing. I've heard that the run-time will not inline a method that calls GetCurrentMethod, but I can't find any documentation to that effect. I've seen posts on StackOverflow on several occasions, such as this one, indicating the CLR does not inline cross-assembly calls, but the GetCallingAssembly documentation strongly indicates otherwise.

还有饱受诟病的 [MethodImpl(MethodImplOptions.NoInlining)] ,但我不能确定,如果在CLR认为这是一个要求或命令。

There's also the much-maligned [MethodImpl(MethodImplOptions.NoInlining)], but I am unsure if the CLR considers this to be a "request" or a "command."

请注意,我问,从合同的角度看内联的资格的不可以什么时候的抖动下降当前实现考虑,因为执行困难的方法,或者约当抖动终于结束了的选择的评估权衡之后,内联一个合格的方法。我已阅读这和的

阅读全文

相关推荐

最新文章