NEWBIE: Dump question about why using CIL

  • Thread starter Thread starter webncliff
  • Start date Start date
W

webncliff

All,

I am just starting to learn .NET/C#, I notice there is a new
intermedia binary CIL, which needs to be jited to native binary at
runtime ( same thing with java ), but if my code will always run under
X86/Windows platform ( indeed there are not other commercial .NET VM
anyway ). why should I bother to use CIL? Will that be possible to
write code with the help of .NET Framework Class Library, and compile
everything into native managed code running under .NET VM? Is there
any reason not to do this?

Thanks for any reponse,


webcliff
 
Robert Jacobson said:
Currently, there's no way to compile to native X86 code. The .Net languages
(including C#) compile only to the intermediate language, and the JIT
compiler then compiles the IL to X86 code. The JIT compiler is a central
element of the .Net Framework -- it's responsible for memory management and
garbage collection.

Well, the JIT creates code that interfaces with the memory management
and garbage collector, but it's really the CLR in general which is
responsible for garbage collection.
However, unlike Java, the JIT'ed code isn't running on a virtual machine --
it's native X86 code, and the JIT compiler can do some very tight
optimizations.

Um, the Java JITted code is native code as well. If it weren't native
code, it would be interpreted rather than JITted.
 
Good points. Thanks for the corrections.

Jon Skeet said:
Well, the JIT creates code that interfaces with the memory management
and garbage collector, but it's really the CLR in general which is
responsible for garbage collection.


Um, the Java JITted code is native code as well. If it weren't native
code, it would be interpreted rather than JITted.
 
Back
Top