When does JIT compilation occur and at what level?

  • Thread starter Thread starter Chromium
  • Start date Start date
AI Thread Summary
Just-in-time (JIT) compilation primarily occurs when translating an intermediate representation of a program into native code, rather than compiling line-by-line as suggested. Compiling each line individually would be inefficient due to the constant overhead of compilation and execution. Instead, JIT compilation typically processes entire modules or classes, allowing for better performance as these components remain loaded in memory for subsequent executions. This approach enables programs to "warm up," achieving speeds comparable to fully pre-compiled native executables. JIT compilation often operates at the subroutine level or higher, utilizing intermediate forms like syntax trees that encompass entire subroutines, facilitating efficient compilation and execution. In languages like .NET or Java, JIT involves converting intermediate language (IL) or bytecode into machine code, eliminating the original source code during this process.
Chromium
Messages
56
Reaction score
0
Does "JIT" only occur when translating some intermediate form of the program into native code? Or can it also occur in other ways? For example, say you have a compiler that kind of acts like an interpreter in that for each line it compiles that source code into native code and immediately after compiling that line it executes it.

So for each line, you go through these steps:
1) Compile
2) Execute

To me it seems that something like this would be slow because constantly compiling & executing seems like a pretty inefficient way of computing. But, it was the only example I could think of.

Thanks,

--Jonathan
 
Technology news on Phys.org
Chromium,

It would be very inefficient to "compile" one line of code at a time. Instead, entire modules or classes are just-in-time compiled before being used.

- Warren
 
Also, already-compiled classes and modules are kept loaded (in executable form) in memory (as long as enough memory is available) so that if they are called again, no compilation is needed. This causes programs to "warm up"--once most parts of a program have been JIT-compiled, it runs about as fast as a native executable that is entirely pre-compiled.
 
JITing usually occurs at the subroutine level or higher. Compilation (or interpretation) produces an intermediate form (a tree usually) that represents the source statements. It is common for these syntax trees to span entire subroutines, that way they can refer to each other. For example an 'if' statement will refer to the 'else' part. Therefore when compiling the whole tree is done at once. JITing (in the .NET or Java sense) refers to taking an intermediate form (IL or byte codes) and compiling them into machine code. At this level there is no source code as it has already been compiled away.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top