Click here to Skip to main content
16,004,686 members
Please Sign up or sign in to vote.
1.40/5 (2 votes)
See more:
hello, I have one query, can you please tell me what is a difference between Binary code /Machine code and MSIL code. Someone told me that they both are same but I saw MSIL code and it looks like some kind of Assembly code to me then how can an assembly code is Machine code or Binary code and if it is then why JIT is converting MSIL to native code/machine code.


What I have tried:

I asked my teacher and she said, MSIL is binary code and JIT just converts required code to MACHINE code.
I think Binary code and machine code is similar, so why to convert it again. I MSIL is binary code then why to convert binary code to binary code.
Posted
Updated 1-Oct-17 21:40pm

 
Share this answer
 
v2
"Machine code" usually refers to the language/binary codes for physical processors i.e. x86, x64, arm, risc etc.

MSIL is the language/binary code for a virtual machine created by Microsoft which is run on physical processors, and the "runtime virtual machine" created for that physical processor converts the MSIL to "native" machine code for execution.

MSIL is an abstraction so you don't need to recompile for your target processors which you want to run on and future processors if they come along, all the actual conversions happen for you by the makers of the virtual machine runtime maker.
 
Share this answer
 
You can find answer to your question here. Here native code is binary code.

Try to google your query first. There's a good chance you'll find the answer.

Good luck learning.
 
Share this answer
 
MSIL is binary code, but it's an intermediate language which is not tied to any specific processor - it targets a "virtual machine" processor that doesn't exist. The various .NET compilers create the MSIL assembly, and the JIT compiler converts that to run on your specific processor at run time as needed. "Machine code" (also called "Native Code") is tied to a specific processor family and cannot be run elsewhere.

.NET was designed to be multi-platform, so Assemblies needed to be processor independent: there was no guarantee that it would be a x86 type processor running under Windows that the Assembly would be running on! Generating an Intermediate Language - which is what the "IL" part of "MSIL" stands for - lets you ship the same Assembly file to any device that runs .NET (or Mono) and it should "just work" regardless of the process or operating system.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900