为什么JVM不缓存JIT编译的代码? [英] Why doesn't the JVM cache JIT compiled code?

查看:221
本文介绍了为什么JVM不缓存JIT编译的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sun的规范JVM实现将一些非常复杂的优化应用于字节码,以便在代码运行几次后获得接近本机的执行速度。问题是,为什么不将这个编译代码缓存到磁盘,以便在后续使用相同的函数/类时使用。因为它是,每次一个程序执行时,JIT编译器重新启动,而不是使用预编译版本的代码。

The canonical JVM implementation from Sun applies some pretty sophisticated optimization to bytecode to obtain near-native execution speeds after the code has been run a few times. The question is, why isn't this compiled code cached to disk for use during subsequent uses of the same function/class. As it stands, every time a program is executed, the JIT compiler kicks in afresh, rather than using a pre-compiled version of the code. Wouldn't adding this feature add a significant boost to the initial run time of the program, when the bytecode is essentially being interpreted?

推荐答案

因此,您需要一个机制来确定是否保存优化仍然是最佳的,在这一点,你可能只是重新优化在飞行。

So you'd need a mechanism to establish whether than saved optimisations were still optimal, at which point you might as well just re-optimise on the fly.

这篇关于为什么JVM不缓存JIT编译的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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