Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

java - JVM instruction set CPU cycles & byte size

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...