DVM和JVM有什么区别? [英] What is the difference between DVM and JVM?

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

问题描述

Java虚拟机和Dalvik虚拟机有什么区别?

What is difference between Java Virtual Machine and Dalvik Virtual Machine?

推荐答案

DVM 是基于寄存器的,设计用于在低内存上运行,使用自己的字节码并运行 .Dex 文件

DVM is Register based which is designed to run on low memory, uses its own byte code and runs .Dex file

JVM 是基于堆栈的,它使用 java 字节码并运行具有 JIT 的 .class 文件.

JVM is Stack based which uses java byte code and runs .class file having JIT.

Java 源代码由 Java 编译器编译成 .class 文件.然后 dx (dexer) 工具,Android SDK 的一部分,将 .class 文件处理成包含 Dalvik 字节码的称为 DEX 的文件格式.dx 工具消除了类中存在的所有冗余信息.在 DEX 中,应用程序的所有类都打包到一个文件中.DVM 的设计使设备可以高效地运行 VM 的多个实例.

Java source code is compiled by the Java compiler into .class files. Then the dx (dexer) tool, part of the Android SDK processes the .class files into a file format called DEX that contains Dalvik bytecode. The dx tool eliminate all the redundant information that is present in the classes. In DEX all the classes of the application are packed into one file. DVM has been designed so that a device can run multiple instances of the VM efficiently.

基于堆栈的机器必须使用指令将数据加载到堆栈上并操作该数据,因此需要比寄存器机器更多的指令来实现相同的高级代码,但寄存器机器中的指令必须对源代码进行编码和目标寄存器,因此往往更大.

stack-based machines must use instructions to load data on the stack and manipulate that data, and, thus, require more instructions than register machines to implement the same high level code, but the instructions in a register machine must encode the source and destination registers and, therefore, tend to be larger.

这篇关于DVM和JVM有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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