JIT 机器特定操作和静态二进制文件之间的区别
JIT 支持者列出的“优点”之一是它可以根据运行代码的机器的 CPU 生成特定于机器的汇编指令。
这与静态编译文件有何不同?如果静态编译的文件要在给定机器上运行,它必须在某个时刻为该机器的 CPU 生成/使用机器代码。为什么 JIT 版本更好或更快?
One of the "wins" listed by proponents of JIT is that it can generate machine-specific assembly instructions, based on the CPU of the machine on which the code is running.
How is this different than statically compiling a file? If a statically compiled file is going to run on a given machine, it must at some point generate/use machine code for the CPU of that machine. Why is the JIT version better or faster?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为每个系统的 JIT 生成的内容都不同。
如果我们提供静态编译的二进制文件,它将仅适用于与该系统兼容的系统。 Java 正在努力实现平台无关。
因此,您不必提供静态编译的二进制文件(仅适用于一个),而是提供可在任何 JVM 中工作的字节码,并允许 JIT 在需要时将其转换为编译代码。
Because what the JIT makes is different for each system.
If we provide a statically compiled binary, it will only work for systems compatible with that system. Java is trying to be platform independent.
So instead of you providing the statically compiled binary (which only works for one) you provide bytecode which will work in any JVM, and allow the JIT to turn it into compiled code if it feels the need to.