How to see JIT-Compilated code in .NET VM (CLR)

情到浓时终转凉″ 提交于 2019-11-26 17:40:41

问题


How can I have a trace of native code generated by the JIT-Compiler ?

Thanks


回答1:


In Visual Studio place a breakpoint in the code and start debugging. When it breaks, open the Disassembly window (Debug > Windows > Disassembly or Alt+Ctrl+D).




回答2:


If you just use Debug->Windows->Disassembly on a standard Debug or Release exe, without modifying Visual Studio Debugging options, you will just see a version of non optimized .NET code.

Have a look at this article "How to see the Assembly code generated by the JIT using Visual Studio". It explains how to inspect generated JIT optimized code.

One relevant quote from the article:

  1. Configure the Debugging Options in Visual Studio to allow the JIT to generate optimized code and to allow you to debug the optimized code.

Go to Tools => Options => Debugging => General · Make sure that box labeled ‘Suppress JIT optimization on module load’ is Unchecked.

· Make sure that the box labeled ‘Enable Just My Code’ is Unchecked.




回答3:


You should look for the files output from the NGen tool. NGen compiles and stores pre-jitted versions of assemblies in the Global Assembly Cache.



来源:https://stackoverflow.com/questions/2410181/how-to-see-jit-compilated-code-in-net-vm-clr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!