Is the JVM doing byte codes out of order?

Some discussion threads mention out-of-order Java code execution, however, they do not explicitly state that the JVM is executing byte codes because of order. So I wonder if this is true; and if so, is there a (official) white paper on the topic?

thank.

Edit: I understand that the processor is executing instructions out of order, but I want to know that the JVM itself is executing byte codes due to order.

+3


source to share


1 answer


JVMS explains this topic. In general, the JVM is free to perform some kind of bytecode reordering, which can lead to unexpected behavior in multithreaded applications.



For a single-threaded application and each individual thread, the reordering does not affect the behavior, and the program / thread execution is the same as you would expect in the original code.

+5


source







All Articles