Java的实现...... JVM? [英] Java implementation of a... JVM?

查看:111
本文介绍了Java的实现...... JVM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前段时间我找到了 MJVM 项目。可悲的是,这个项目被作者遗弃了(我通过电子邮件问了 Igor )。

Some time ago I found the MJVM project. Sadly, this project has been abandoned by it author (I asked Igor via email).

我想知道是否有一个(继续的)开源项目,用Java完全实现Java的JVM。

I wonder if there is a (continued) open source project of a full implementation of a JVM in Java like this one.

By 完整,我的意思是,不仅要仿效移动设备。

By "full", I mean, not only to emulate mobile devices.

推荐答案

Jikes RVM 可能是用Java编写的最着名的JVM实现。但是,它的最低级实现只包含对魔术接口的静态方法调用,该接口由编译器专门处理并转换为本机代码。

The Jikes RVM is probably the most prominent JVM implementation written in Java. However, its lowest level implementation simply consists of static method calls to a "magic" interface which is treated specially by the compiler and translated into native code.

Maxine VM (最初由Sun Labs开发,现在是Oracle实验室)是真实的 metacircular VM,其中不仅所有内容都是用Java编写的,而且编译器中没有特殊的外壳。更重要的是:Maxine VM不仅用Java编写,甚至还在中运行!这可能听起来很疯狂,坦白说,我不知道它是如何工作的,但它是基于 Klein VM (由Sun Labs开发),它为Self编程语言做同样的事情。

The Maxine VM (developed originally by Sun Labs, now Oracle Labs) is a real metacircular VM, in which not only everything is written in Java, but there is no special-casing in the compiler going on. Even more: not only is the Maxine VM written in Java, it even runs in itself! This might sound crazy, and to be frank, I have no idea how that works, but it is based on the Klein VM (developed by Sun Labs) which does the same thing for the Self programming language.

这有一些非常有趣的属性:因为JVM本身是代码库的一部分JVM解释的是与用户代码所属的代码库相同的代码库,这意味着它可以进行优化,例如跨VM边界的内联。 IOW:它可以将VM代码内联到用户代码中,反之亦然。这也意味着VM本身需要进行相同的运行时分析和动态优化,并且 –在其他虚拟机上(甚至包括Jikes) –只有用户代码,这意味着VM本身不断被重新编译和重新优化,以适应不断变化的负载,正在加载的新类,更改配置文件,更改使用模式等等。

This has some very interesting properties: since the JVM itself is part of the codebase that the JVM interprets, the same codebase that the user code belongs to, this means that it can do optimizations such as inlining across the VM boundary. IOW: it can inline VM code into the user code and vice versa. It also means that the VM itself is subject to the same runtime profiling and dynamic optimizations that – on other VMs (even including Jikes) – only the user code is, which means that the VM itself constantly gets re-compiled and re-optimized to adapt to changing loads, new classes being loaded, changing profiles, changing usage patterns and so on.

在HotSpot,JRockit,J9等虚拟机上,这些优化是不可能的,原因很简单,JVM只知道如何优化JVML字节码,但VM不是用Java编写的。但即使在Jikes中,这也是不可能的,因为虽然VM是用Java编写的,但它在运行之前会被静态编译为本机代码,并且VM本身的代码不是代码的一部分VM看到。

On VMs like HotSpot, JRockit, J9 and others, these optimizations are impossible, for the simple reason that the JVM only knows how to optimize JVML bytecode, but the VM isn't written in Java. But even in Jikes, this is not possible because, while the VM is written in Java, it gets statically compiled to native code before it runs, and the code of the VM itself is not part of the code that the VM "sees".

Squawk VM 也是由Sun Labs(现为Oracle Labs)开发的JVM。与Maxine不同,Maxine与目标受众中的J9,HotSpot或JRockit大致相似,Squawk更类似于KVM(最初由Sun开发,现在是Oracle),即针对资源受限的嵌入式设备。 Squawk的灵感来自Klein。与Maxine不同,它有一个用C编写的小抽象层。但请记住,Maxine需要运行操作系统,而Squawk在没有操作系统的情况下运行。所以,从某种意义上说,Squawk甚至比Maxine更纯粹,因为很多部分不是Maxine的一部分,而是操作系统的一部分(它们通常用C,C ++或其他低级语言实现),实际上是Squawk的一部分本身。例如,设备驱动程序是用Java编写的。只有一个小的硬件抽象层和I / O库是用C语言编写的。

The Squawk VM is also a JVM developed by Sun Labs, now Oracle Labs. Unlike Maxine, which is roughly similar to J9, HotSpot or JRockit in its target audience, Squawk is more analogous to the KVM (originally developed by Sun, now Oracle), i.e. targeted at resource-constrained embedded devices. Squawk is also inspired by Klein. Unlike Maxine, it has a small abstraction layer written in C. But keep in mind, that Maxine requires an OS to run, whereas Squawk runs without an OS. So, in a sense, Squawk is even purer than Maxine, because many parts that are not part of Maxine but part of the OS (where they are often implemented in C, C++ or other low-level languages), are actually part of Squawk itself. Device drivers, for example, are written in Java. Only a small hardware abstraction layer and I/O libraries are written in C.

这篇关于Java的实现...... JVM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆