views:

76

answers:

1

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
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
@Nick good point about the DLR.
Darin Dimitrov
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