gpt4 book ai didi

java - Java 7 和 8 中方法的最大大小

转载 作者:IT老高 更新时间:2023-10-28 11:48:35 25 4
gpt4 key购买 nike

我知道使用 Java 的方法不能大于 64 KB。该限制导致我们从 JavaCC 生成的代码出现问题。语法。我们在使用 Java 6 时遇到了问题,并且能够通过更改语法来解决这个问题。 Java 7 的限制是否已更改,还是计划为 Java 8 更改?

只是为了说清楚。我自己不需要大于 64 KB 的方法。但是我写了一个语法,可以编译成一个非常大的方法。

最佳答案

根据JVMS7 :

The fact that end_pc is exclusive is a historical mistake in the design of the Java virtual machine: if the Java virtual machine code for a method is exactly 65535 bytes long and ends with an instruction that is 1 byte long, then that instruction cannot be protected by an exception handler. A compiler writer can work around this bug by limiting the maximum size of the generated Java virtual machine code for any method, instance initialization method, or static initializer (the size of any code array) to 65534 bytes.

但这是关于 Java 7 的。 Java 8 没有最终规范,因此没有人(除了它的开发人员)可以回答这个问题。

UPD (2015-04-06) 根据 JVM8 Java 8 也是如此。

关于java - Java 7 和 8 中方法的最大大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17422480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com