What does a just-in-time (JIT) compiler do?

后端 未结 18 1997
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 12:42

What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?

18条回答
  •  一个人的身影
    2020-11-22 13:14

    JIT-Just in time the word itself says when it's needed (on demand)

    Typical scenario:

    The source code is completely converted into machine code

    JIT scenario:

    The source code will be converted into assembly language like structure [for ex IL (intermediate language) for C#, ByteCode for java].

    The intermediate code is converted into machine language only when the application needs that is required codes are only converted to machine code.

    JIT vs Non-JIT comparison:

    • In JIT not all the code is converted into machine code first a part of the code that is necessary will be converted into machine code then if a method or functionality called is not in machine then that will be turned into machine code... it reduces burden on the CPU.

    • As the machine code will be generated on run time....the JIT compiler will produce machine code that is optimised for running machine's CPU architecture.

    JIT Examples:

    1. In Java JIT is in JVM (Java Virtual Machine)
    2. In C# it is in CLR (Common Language Runtime)
    3. In Android it is in DVM (Dalvik Virtual Machine), or ART (Android RunTime) in newer versions.

提交回复
热议问题