Why doesn't the JVM cache JIT compiled code?

前端 未结 5 1309
时光说笑
时光说笑 2020-11-28 19:30

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

5条回答
  •  伪装坚强ぢ
    2020-11-28 20:16

    Without resorting to cut'n'paste of the link that @MYYN posted, I suspect this is because the optimisations that the JVM performs are not static, but rather dynamic, based on the data patterns as well as code patterns. It's likely that these data patterns will change during the application's lifetime, rendering the cached optimisations less than optimal.

    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.

提交回复
热议问题