How can a JVM be written in Java

后端 未结 10 603
再見小時候
再見小時候 2020-12-13 09:10

I was briefly reading about Maxine which is an open source JVM implementation that written in Java. This sounds circular to me. If java requires a virtual machine to run i

相关标签:
10条回答
  • 2020-12-13 09:44

    You can have a look at the well-established method of bootstrapping compilers. I think it started in the 70s...

    0 讨论(0)
  • 2020-12-13 09:54

    The JVM that you need to bootstrap a JVM written in Java probably does not need a lot of features (such as garbage collection and JIT), could be very simple. All the more advanced features could then be implemented in Java (which seems to be exactly the point of Maxine, to experiment with new ideas in JVM technology).

    Also, Maxine does contain C code, which I guess makes up a minimal runtime environment that is used to get the rest of Maxine going. I take it that the interesting bits (JIT compiler, garbage collection) are then completely implemented in Java.

    0 讨论(0)
  • 2020-12-13 09:54

    See bootstrapping.

    0 讨论(0)
  • 2020-12-13 10:01

    Your assumption that Java requires a virtual machine is incorrect to begin with. Check out the project GCJ: The GNU Compiler for the Java Programming Language.

    0 讨论(0)
提交回复
热议问题