JVM指令集CPU周期&字节大小

发布于 2024-08-04 03:48:05 字数 198 浏览 4 评论 0原文

Java虚拟机指令集页面提供了aaload、aastore等助记符的信息。 ..等等
然而,既没有提到这些助记符占用的CPU周期,也没有任何关于这些助记符的字节大小或字大小的信息。
知道在哪里可以找到这些信息吗?

The Java Virtual Machine Instruction Set page provides information about mnemonics such as aaload, aastore... etc.
However neither the cpu cycles that these mnemonics would take up is mentioned nor is there any info on the byte size or word size of these mnemonics.
Any idea where this information could be found?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江湖正好 2024-08-11 03:48:05

正如已经提到的,您寻求的信息不存在,因为它不存在。除了还提到的不同 JVM 可以不同地实现指令(或指令组合)这一事实之外,单个 JVM 也可以不同地实现它。

对于不同的指令组合(根据指令与其他指令一起使用的方式,以不同的方式实现指令可能会更有效)和不同的执行场合都是如此。由于 JVM 始终控制程序的执行,因此它可以(并且确实)监视程序的行为并决定重新优化经常运行的代码(或满足某些其他标准的代码)。例如,这可能会导致您的指令在执行函数的前一千次时被转换为一组特定的机器指令,并在其余执行中被转换为另一组机器指令。

这种高级优化能力(以及其他能力)就是为什么 Java 字节码的优化最好留给 JVM,也是为什么在某些情况下,Java 程序可以比同等的 C 或 C++ 程序快得多(C 和 C++ 通常只是静态优化,而 Java 动态优化)。

As already mentioned, the information you seek is not there because it does not exist. Apart from the also mentioned fact that different JVMs can implement instructions (or combinations of instructions) differently, a single JVM can also implement it differently.

This is true both for different combinations of intstructions (it might be more efficient to implement instructions in different ways depending on how they are used together with other instructions) and for different occasions of execution. As the JVM is always in control of the execution of your program, it can (and does) monitor the behavior of your program and decide to reoptimize code that is run often (or code meeting some other criteria for that matter). This can result in, for example, your instruction being translated into a certain set of machine instructions the first thousand times a function is executed, and being translated to another set the rest of the executions.

This advanced optimization ability (and others) is why optimization of Java byte code is best left to the JVM and also why, in some cases, a Java program can be significantly faster than the equivalent C or C++ program (C and C++ is normally only optimized statically whereas Java is optimized dynamically).

缱倦旧时光 2024-08-11 03:48:05

规范是 JVM 需要实现的内容,而不是它如何实现。 IBM 和 Sun 等供应商的不同平台和不同 JVM 将使用不同的实现,因此您不能假设有关字节大小和处理器周期的任何信息。如果您确实想查找更多信息,可以下载 Open JDK 源代码并查看它,但这只是一种实现,您不能假设其他实现将具有完全相同的性能特征。

The spec is what a JVM needs to implement not how it does so. Different platforms and different JVM's from venders such as IBM and Sun will use different implementations so you can’t assume anything about byte size and processor cycles. If you really want to find more info you can download the Open JDK source and look through it but this is only one implementation and you can’t assume other implementations will have the exact same performance characteristics.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文