问题描述
,似乎有一个 和已将该功能列为原型80%一段时间了。
Two years after does-the-jvm-prevent-tail-call-optimizations, there seems to be a prototype implementation and MLVM has listed the feature as "proto 80%" for some time now.
Sun的/ Oracle方面是否没有积极的兴趣来支持尾调用,或者只是尾部调用[...] 命中注定要在每个功能优先级列表中排在第二位 [...]如所述?
Is there no active interest from Sun's/Oracle's side in supporting tail calls or is it just that tail calls are "[...] fated to come in second place on every feature priority list [...]" as mentioned at the JVM Language Summit?
如果有人测试了MLVM构建并且可以共享s,我会非常感兴趣ome对其运作情况的印象(如果有的话)。
I would be really interested if someone has tested a MLVM build and could share some impressions of how well it works (if at all).
更新: 请注意一些像这样的虚拟机支持正确的尾调用,没有任何问题。
Update: Note that some VMs like Avian support proper tail-calls without any issues.
推荐答案
()解释了为什么JVM不支持尾调用优化。
Diagnosing Java Code: Improving the Performance of Your Java Code (alt) explains why the JVM does not support tail-call optimization.
然后给出一个不会转换的Java代码示例。
It then gives an example of Java code that won't transform.
因此,正如清单3中的示例所示,我们不能指望静态编译器在保留语言语义的同时对Java代码执行尾递归转换。相反,我们必须依靠JIT的动态编译。根据JVM,JIT可能会也可能不会这样做。
然后它会给出一个测试,你可以用来判断你的JIT就是这样做的。
Then it gives a test you can use to figure out if your JIT does this.
当然,由于这是一篇IBM论文,它包含一个插件:
Naturally, since this is an IBM paper, it includes a plug:
这篇关于为什么JVM仍然不支持尾调用优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!