Does the .NET's Virtual Machine compiles the CIL bytecode (and then execute the code at the lowest level - CPU assembler), or it is an interpreter (that reads the following instructions and execute them) ?
+5
A:
Does the .NET's Virtual Machine compiles the CIL bytecode (and then execute the code at the lowest level - CPU assembler)
Yes, it's a component of the CLR called JIT (Just-In-Time compilation) that converts the Intermediary Language code (emitted by the compiler of the programming language) into a machine code.
There's no interpreter as there is in the dynamic languages such as Ruby, PHP, Python.
UPDATE:
As pointed out in the comments by @Nick Craver since the addition of the DLR in .Net 4 brings the possibility of using dynamic language concepts in the CLR.
Darin Dimitrov
2010-07-18 11:43:19
I'm not sure about the 2nd part of the answer, since the addition of the DLR in .Net 4, I could be wrong...but I think that statement needs a few caveats around it.
Nick Craver
2010-07-18 11:49:01
@Nick good point about the DLR.
Darin Dimitrov
2010-07-18 11:52:56
Both .NET framework and .NET Compact framework do JIT compilation. .NET Micro framework however uses an interpret (http://en.wikipedia.org/wiki/.NET_Micro_Framework).
Steven
2010-07-18 12:04:08