1

at this link: http://www.artima.com/underthehood/leanmeanP.html i read: "The JVM has a program counter and three registers that manage the stack. It has few registers because the bytecode instructions of the JVM operate primarily on the stack. This stack-oriented design helps keep the JVM's instruction set and implementation small."

what does it mean by 'The JVM has a program counter and three registers '? i guess jvm is a software process and PC register belong to CPU's(hardware). Is it like JVM has some memory addresses which it uses it as a PC and other registers. and filling up with instructions and incrementing it, same as CPU does for their registers.

  • Yes and no. JVM is a thing written in C/C++, so no. But since the CPU is executing C/C++ code, yes it does. But not by design. You can't access `AH`/`AL` or `EAX` thru bytecode. – Shark Mar 02 '16 at 13:48
  • It means, the JVM state is made by three registers and the stack. Another way to see this is the JVM simulate a machine with three registers and a stack. – Margaret Bloom Mar 02 '16 at 13:52
  • The JVM has its own virtual registers that byte codes can affect and that are used for the JVM only. They may as you say be stored in memory or in real registers, it does not make a difference as long as the JVM can work with them as if they _were_ real registers. – Joachim Isaksson Mar 02 '16 at 13:54
  • @JoachimIsaksson Thanks for the comment. It answers my question. – shyam patil Mar 02 '16 at 14:13
  • In this question http://stackoverflow.com/questions/16264118/how-jvm-stack-heap-and-threads-are-mapped-to-physical-memory-or-operation-syste?rq=1 It says "the JVM's registers is the same as native registers which is what C+ uses" This again confused me. – shyam patil Mar 03 '16 at 10:02

0 Answers0