Questions tagged [jit]

Just-In-Time compilation (JIT) is a technique used to improve the performance of interpreted code by translating it to machine code.

Introduction

From Wikipedia:

In computing, just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance of computer programs based on bytecode.

JIT compilers represent a hybrid approach, with translation occurring continuously, as with interpreters, but with caching of translated code to minimize performance degradation. They also offer handling of late-bound data types and the ability to enforce security guarantees.

In a bytecode-compiled system, source code is translated to an intermediate representation known as bytecode. The JIT compiler reads the bytecode and compiles it dynamically into machine language so the program can run faster.

Tag usage

Use the tag for questions about JIT compilers. Be sure to include other relevant tags as well. For example, if your JIT question is Java-specific, include the tag.

Further reading

1936 questions
30
votes
2 answers

How do generics get compiled by the JIT compiler?

I know that generics are compiled by JIT (like everything else), in contrast to templates that are generated when you compile the code. The thing is that new generic types can be created in runtime by using reflection. Which can of course affect the…
Yochai Timmer
  • 48,127
  • 24
  • 147
  • 185
29
votes
5 answers

Disassemble Java JIT compiled native bytecode

Is there any way to do an assembly dump of the native code generated by the Java just-in-time compiler? And a related question: Is there any way to use the JIT compiler without running the JVM to compile my code into native machine code?
tskuzzy
  • 35,812
  • 14
  • 73
  • 140
29
votes
2 answers

Does android system include JVM?

I know android system include the Dalvik virtual machine(DVM) But i didn't understand if android system include JVM also Or DVM is a replacement for JVM? Thanks
user1019872
  • 649
  • 2
  • 9
  • 14
29
votes
5 answers

Could the JIT collapse two volatile reads as one in certain expressions?

Suppose we have a volatile int a. One thread does while (true) { a = 1; a = 0; } and another thread does while (true) { System.out.println(a+a); } Now, would it be illegal for a JIT compiler to emit assembly corresponding to 2*a…
aioobe
  • 413,195
  • 112
  • 811
  • 826
27
votes
1 answer

MethodImplOptions.AggressiveInlining vs TargetedPatchingOptOut

What is the difference between the MethodImplAttribute with the option MethodImplOptions.AggressiveInlining and the TargetedPatchingOptOut? When I searched on Google everybody seems to says that both (might) inline the method but without giving the…
Yann Lebel
  • 675
  • 1
  • 7
  • 17
27
votes
4 answers

Does the .NET CLR JIT compile every method, every time?

I know that Java's HotSpot JIT will sometimes skip JIT compiling a method if it expects the overhead of compilation to be lower than the overhead of running the method in interpreted mode. Does the .NET CLR work based upon a similar heuristic?
jsight
  • 27,819
  • 25
  • 107
  • 140
26
votes
1 answer

JavaScript Just In Time compilation

I have a quite big JavaScript for HTML page for a device. But it's a bit slow. I tried compressing JavaScript files but it's still not satisfactory. So I was thinking, is it possible to make it as a Just in Time that is compiled converted to machine…
hari
  • 1,419
  • 4
  • 19
  • 30
26
votes
2 answers

numba - TypingError: cannot determine Numba type of

I have a simple function to rank poker hands (the hands are strings). I call it with rA,rB = rank(a),rank(b) and here is my implementation. Works well without @jit(nopython=True), but with it, it fails: File "...poker.py", line 190, in
CIsForCookies
  • 12,097
  • 11
  • 59
  • 124
26
votes
2 answers

Writing a JIT compiler in assembly

I've written a virtual machine in C which has decent performance for a non-JIT VM, but I want to learn something new, and improve performance. My current implementation simply uses a switch to translate from VM bytecode to instructions, which is…
jakogut
  • 4,409
  • 6
  • 29
  • 41
26
votes
7 answers

What exactly is Parrot?

I understand that Parrot is a virtual machine, but I feel like I'm not completely grasping the idea behind it. As I understand, it's a virtual machine that's being made to handle multiple languages. Is this correct? What are the advantages of…
user20805
  • 1,347
  • 1
  • 11
  • 10
25
votes
3 answers

is it prohibited using of JIT(just-in-time) compiled code in iOS app for AppStore?

I heard that JIT compiled code is not allowed in iOS AppStore because placing executable code in heap is prohibited. It that right? Or just a rumor?
eonil
  • 83,476
  • 81
  • 317
  • 516
25
votes
3 answers

Can I bind an existing method to a LLVM Function* and use it from JIT-compiled code?

I'm toying around with the LLVM C++ API. I'd like to JIT compile code and run it. However, I need to call a C++ method from said JIT-compiled code. Normally, LLVM treats method calls as function calls with the object pointer passed as the first…
zneak
  • 134,922
  • 42
  • 253
  • 328
25
votes
7 answers

I've found a bug in the JIT/CLR - now how do I debug or reproduce it?

I have a computationally-expensive multi-threaded C# app that seems to crash consistently after 30-90 minutes of running. The error it gives is The runtime has encountered a fatal error. The address of the error was at 0xec37ebae, on thread 0xbcc.…
BlueRaja - Danny Pflughoeft
  • 84,206
  • 33
  • 197
  • 283
24
votes
6 answers

Why does .net use a JIT compiler instead of just compiling the code once on the target machine?

The title pretty much sums it up but I was wondering why systems like .net compile code every time it is run instead of just compiling it once on the target machine?
Atli
  • 243
  • 2
  • 4
24
votes
4 answers

Why does Math.sin() delegate to StrictMath.sin()?

I was wondering, why does Math.sin(double) delegate to StrictMath.sin(double) when I've found the problem in a Reddit thread. The mentioned code fragment looks like this (JDK 7u25): Math.java : public static double sin(double a) { return…
emesx
  • 12,555
  • 10
  • 58
  • 91