Reputation: 3495
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) ?
Upvotes: 7
Views: 5845
Reputation: 5618
Is .NET VM a compiler or an interpreter?
There isn't any VM in .Net ecosystem like Java ecosystem, but which .Net? .Net SDK, .Net Runtime, or .Net Framework?
.Net Framework components:
And you can't see any VM here...
.Net Runtime components:
Still you can't see any VM here...
.Net Runtime CONTAINS a Just-in-time(JIT) compiler while .Net SDK CONTAINS both JIT and IL compilers.
So they are NOT a VM while both CONTAIN compiler.
So IMO, you could say that IL + CLR + JIT together are MAYBE a virtual machine.
Is .NET VM a compiler or an interpreter?
Neither.
Upvotes: -1
Reputation: 1038710
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.
Upvotes: 8