Is the output of JIT cached ?

C

chak

These may be a very basic question.

1) Is IL compiled to native code every time a application is invoked ?

2) If a process has multiple appdomains (i think each instance of an
application maps to an appdomain), if one application is closed will the
appdomain close ? If the same application is then re-invoked will it use the
JIT-ted code generated last time , or will it again JIT ?

Regards,

Chak.
 
N

Nick Hounsome

chak said:
These may be a very basic question.

1) Is IL compiled to native code every time a application is invoked ?

JIT = Just In Time so only those bits actaully called will be compiled.
2) If a process has multiple appdomains (i think each instance of an
application maps to an appdomain), if one application is closed will the
appdomain close ? If the same application is then re-invoked will it use
the
JIT-ted code generated last time , or will it again JIT ?

I don't know what it does but there is no need for it to generate code twice
for the same IL just because it is loaded into two different appdomains.
 
A

Alan J. McFarlane

These may be a very basic question.

1) Is IL compiled to native code every time a application is invoked ?

2) If a process has multiple appdomains (i think each instance of an
application maps to an appdomain), if one application is closed will
the appdomain close ? If the same application is then re-invoked will
it use the JIT-ted code generated last time , or will it again JIT ?
Have a read of this article,
http://msdn.microsoft.com/msdnmag/issues/05/04/NGen/default.aspx
 
C

chak

Thanks. The article referred to by you states :

"As you know, the just-in-time (JIT) compiler is used for compiling the
Microsoft intermediate language (MSIL) code in a .NET assembly into native
code for the local machine immediately before the code is executed. This is
temporary code; it is created and stored in the running processes's memory
space, which is reclaimed by the OS when the process dies. Thus, it will be
regenerated each time a new process needs it."

So i think it answers my question to the effect that even if two different
people accessed the same application seperately, from 2 different PC's, it
would create 2 instances of that application in 2 different application
domains of the respective local machines , by JIT compiling it twice (one
for each instance). Is my understanding right ?

Thanks.
 
N

Nick Hounsome

You are answering a different question to the one that you originaly posed:

Yes you are right that if 2 people access an app from 2 machines then it
will get JIT'd twice i.e. it's not like python - where it compiles to a .pyc
file in the same directory [actually that's not an exact analogy because
python is doing the equivalent of C# -> MSIL rather than MSIL -> obj but
hopefully you get the point]

What you originaly asked was whether it would compile twice if you loaded
the same assembly into 2 app domains in the same process (necessarily on the
same machine) and there is no reason for it to do so.


chak said:
Thanks. The article referred to by you states :

"As you know, the just-in-time (JIT) compiler is used for compiling the
Microsoft intermediate language (MSIL) code in a .NET assembly into native
code for the local machine immediately before the code is executed. This
is temporary code; it is created and stored in the running processes's
memory space, which is reclaimed by the OS when the process dies. Thus, it
will be regenerated each time a new process needs it."

So i think it answers my question to the effect that even if two different
people accessed the same application seperately, from 2 different PC's, it
would create 2 instances of that application in 2 different application
domains of the respective local machines , by JIT compiling it twice (one
for each instance). Is my understanding right ?

Thanks.
 

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