Method A calls method B, how is the JVM called step by step

 

First, the method A calls the byte code of the method B, and the PC records the execution position of the current stack frame byte code. When the method B is called, the B stack frame is returned when the B stack frame is constructed. The address is assigned to the position of the bytecode execution in order to return to the call, and then store the parameters in the local variable table of the corresponding method B, set method B to the current stack frame, and set the setting pc to the method to be called The opcode of the first instruction of the method will continue to execute from the first instruction of the method. After the execution is completed (normal return or abnormal return), it will return to the position where the method was called. To the current stack frame, the PC returns to the original bytecode execution position of A and continues to execute.

 

JVM specification screenshot:

 

 

 

In-depth understanding of JAVA virtual machine-Zhou Zhiming screenshot

 

 

Guess you like

Origin www.cnblogs.com/feibazhf/p/12749205.html