如何用 Java 编写 JVM

2022-01-16 00:00:00 jvm bootstrapping java

我正在简要阅读 Maxine 这是一个用 Java 编写的开源 JVM 实现.这对我来说听起来很循环.如果java需要虚拟机来运行,那么虚拟机本身如何用Java编写(VM代码不会需要在其中运行的VM,等等?).

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 in, how can the virtual machine itself be written in Java (won't the VM code require a VM in which to run, and so on?).

编辑:好的,所以我发现我忽略了 Java 不必在 VM 中运行的事实.那么如何解释如何用 LISP 编写 LISP 编译器呢?还是应该完全是一个新问题?

Edit: Ok, so I see I overlooked the fact that Java doesn't have to run in a VM. How then does one explain how a LISP compiler can be written in LISP? Or should this be a new question altogether?

推荐答案

您一开始就认为 Java 需要虚拟机是不正确的.查看项目 GCJ:GNU 编译器用于 Java 编程语言.

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.

相关文章