When is a method eligible to be inlined by the CLR?

前端 未结 5 1319
盖世英雄少女心
盖世英雄少女心 2020-11-30 03:23

I\'ve observed a lot of \"stack-introspective\" code in applications, which often implicitly rely on their containing methods not being inlined for their correctnes

5条回答
  •  无人及你
    2020-11-30 03:41

    There's more information on inlining of MethodBase.GetCurrentMethod on this thread http://prdlxvm0001.codify.net/pipermail/ozdotnet/2011-March/009085.html

    Paraphrasing heavily, it states that the RefCrawlMark does NOT stop the calling method being inlined. However, RequireSecObject does have the side affect of stopping the caller being inlined.

    In addition, the Assembly.GetCallingAssembly and Assembly.GetExecutingAssembly methods do NOT have this attribute.

提交回复
热议问题