Behind C# compilations

P

puzzlecracker

As I understand, initially we compile csharp code into intermediate
language called IL, and then during runtime, only used parts, are
compiled into the native code by CLR using JIT compiler, hence making
the code portable on different OS with small executables.

Question:

When we build .dll or an executable, prior to running the code, does
it only contain IL, and during the runtime it's parts compiled into
the native machine code -- will this make make exe, dll, etc., bigger
with introduction of native code? Where will native code reside?

please explain the process, from compile to the runtime.


Thanks
 
D

Duggi

As I understand,  initially we compile csharp code into intermediate
language called IL, and then during runtime, only used parts, are
compiled into the native code by CLR using JIT compiler, hence making
the code portable on different OS with small executables.

Question:

When we build .dll or an executable, prior to running the code, does
it only contain IL, and during the runtime it's parts   compiled into
the native machine code -- will this make  make exe, dll, etc., bigger
with introduction of native code? Where will native code reside?

please  explain the process, from compile to the runtime.

Thanks

Hi

IMO, your undersnading was correct.
and during the runtime it's parts compiled into
the native machine code -- will this make make exe, dll, etc., bigger
with introduction of native code? Where will native code reside?

the IL is converted / compiled to native code and it would be part of
executing proces... it(native code) would not get stored back to the
assembly. so there is no question of growing dll or exe.
Where will native code reside?

as far as my knowledge goes, its in volatile memory.

-Cnu
 
P

puzzlecracker

Hi

IMO, your undersnading was correct.


the IL is converted / compiled to native code and it would be part of
executing proces... it(native code) would not get stored back to the
assembly. so there is no question of growing dll or exe.


as far as my knowledge goes, its in volatile memory.

-Cnu

I see, how does manifest come into the picture?

How does executable know what IL has been or needs to be built? Does
build processes restarts upon application shutdown and restart? what
if a different instance of the same application starts up - would the
built parts be available?


Thanks
 
P

Pavel Minaev

How does executable know what IL has been or needs to be built? Does
build processes restarts upon application shutdown and restart? what
if a different instance of the same application starts up - would the
built parts be available?

To elaborate a bit on how JITting is actually done in present versions
of the CLR: vtable method entries point to stubs that invoke JIT, and
rewrite the corresponding entry to point to JITted code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top