Question

I understand the difference between a decompiler and a dissassembler (A .net disassembler/decompiler) i.e. a dissassembler allows you to convert machine code to assembly language (which you can see in the Dissassembly window in Visual Studio) and the decompiler converts assembly language to a high level language e.g. C#.

Is it possible to see the assembly code (from the Dissassembly window) generated by the Jitter in a text file? I suspect not because of the fact that it is optimized to be Just In Time.

Also, is MSIL an assembly language or a high level language in the context of my first question? i.e. in .NET there appear to be two assembly languages i.e. MSIL and the assembly language generated by the JITTER, though I suspect the answer is that JITTER generates machine code, which is formatted as assembly language in the Dissassembly window.

I have spent time reading other questions on here, but I have not found an answer.

Was it helpful?

Solution

I think it's important to understand definitions here (it looks like you mostly do, this is just to make sure).

First, assembly language: that's simply any human-readable language where each statement is compiled directly to an instruction in some machine code (which could be for example x86 machine code or .Net bytecode).

Based on this, disassembler is a program that reverses that compilation: it converts machine code to the corresponding assembly language.

And decompiler converts machine code to another language.

Maybe an image of all the options (including de-/compiling C/C++ and assuming x86 computer) would help:

compiling and decompiling graph

Now, to your specific questions:

Is it possible to see the assembly code (from the Dissassembly window) generated by the Jitter in a text file?

Theoretically, there is no reason why that shouldn't be possible (especially considering NGEN). Practically, I don't know about any such tool.

Is MSIL an assembly language or a high level language in the context of my first question?

I would say that it's a high-level assembly language. It's certainly an assembly language and it's also higher-level than normal assembly languages.

OTHER TIPS

IL/MSIL is an assembly language targeted to the .NET virtual machine :-) The Disassembly window shows the assembly language of the program after it's jitted, so the assembly language of the "real" CPU (normally an Intel).

By using ngen you can compile your .NET app to "native" machine code. From there you can probably use a "standard" disassembler to watch inside it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top