search

Home  >  Q&A  >  body text

字节码执行引擎 - Java PC寄存器中的数据在方法正常返回后是如何恢复的,不同的JVM实现会采用不同方法吗?

《深入理解Java虚拟机》中说:“一般来说,方法正常退出时,调用者的PC计数器的值可以作为返回地址,栈帧中很可能会保存这个计数器值。”。为什么是“可以作为”和“很可能”,有点模糊,具体是保存在栈帧的什么地方呢,有什么其他实现吗?

PHP中文网PHP中文网2783 days ago574

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 16:02:57

    Because the operation of registers is transparent to Java developers, that is to say, JVMs may not necessarily implement it according to the above method. As long as the results of the execution of Java code are consistent under any circumstances, it can be considered that JVM is reliable and does not necessarily operate the registers in the same way.

    reply
    0
  • Cancelreply