一个即时(JIT)编译器是什么? [英] What does a just-in-time (JIT) compiler do?

查看:373
本文介绍了一个即时(JIT)编译器是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JIT编译器特别做了什么,而不是非JIT编译器?

解决方案

JIT编译器在之后运行已经开始并且将代码(通常是字节代码或某种类型的VM指令)在运行中(或者准时,因为它被调用)编译成通常更快的形式,通常是主机CPU的本地指令集。 JIT可以访问动态运行时信息,而标准编译器不能并且可以进行更好的优化,例如频繁使用的内联函数。



这与传统的在程序第一次运行之前编译全部的代码到机器语言。



为了解释,常规编译器在第一次运行它之前,将整个程序构建为EXE文件。对于较新的样式程序,使用伪代码(p代码)生成程序集。只有在您在操作系统上执行程序(例如,通过双击其图标),(JIT)编译器才会启动并生成基于Intel的处理器或任何理解的机器码(m码) p>

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

解决方案

A JIT compiler runs after the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-in-time, as it's called) into a form that's usually faster, typically the host CPU's native instruction set. A JIT has access to dynamic runtime information whereas a standard compiler doesn't and can make better optimizations like inlining functions that are used frequently.

This is in contrast to a traditional compiler that compiles all the code to machine language before the program is first run.

To paraphrase, conventional compilers build the whole program as an EXE file BEFORE the first time you run it. For newer style programs, an assembly is generated with pseudocode (p-code). Only AFTER you execute the program on the OS (e.g., by double-clicking on its icon) will the (JIT) compiler kick in and generate machine code (m-code) that the Intel-based processor or whatever will understand.

这篇关于一个即时(JIT)编译器是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆