Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

clr

jit

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

Thanks

like image 912
Thomas Avatar asked Mar 09 '10 15:03

Thomas


2 Answers

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).

like image 165
Guffa Avatar answered Sep 19 '22 17:09

Guffa


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.

like image 24
Alexandre Mutel Avatar answered Sep 19 '22 17:09

Alexandre Mutel