摘要:阅读程序源代码是了解程序构架的途径之一。本文介绍了Android中Dalvik虚拟机目录层次结构,并从一个Java虚拟机的角度对dalvik目录结构下的每个文件夹功能作了一定解释。
关键字:Android,Dalvik,代码结构
Dalvik source code structure
This article gives an introduction of Dalvik VM source code structure and components on Dalvik system
There are two core components in dalvik VM, one is libdex, which gives the specification of dex file format. The other is VM, which runs the program. Below is the structure of dalvik system source code.
Dalvik
--Core
--libdex: gives specification of dex file format
--VM: dalvik vm excution engine
--Others
--dalvikvm: only contains dalvik vm main function. (Make it easier for code reader to find main function?)
--dx: a class2dex tool
--dxopt: sounds like a static dx optimization tool
--dexdump: sounds like a dex file dumper(imagining Javap)
--dexlist: same as dexdump?
--dvz: (Don't know yet)
--hit: sounds like a tool which receive data from hprofile and produce profiles
--tools
--hprof: system profiler
--dexdeps: (Don't know yet)
--dmtrace: (Don't know yet)
--gdbjithelper: sounds like a interface which help using gdb via JIT interface
In the dalvik structure, the libdex is the key(interface) for most external tools(dx, dexdump), but the most complex component is still VM. Below is the structure of dalvik vm source code. I separate the folders in a Java virtual machine's perspective.
VM
--ClassLoader parts
--(there is no folder for this, perhaps in some separated files)
--JIT parts
--analysis: sounds like gives some code analysis
--interp: an interpreter
--compiler: an just in time compiler (these is only arm dictionary below compiler's codegen dictionary, is that means for x86 and other architectures
dalvik use only interpreter?)
--mterp: a very architecture-based component, but don't know the function yet, may be a instruction set for interpreter.
--Memory parts
--alloc: memory and GC components
--Object layout parts
--OO: object layout
--Thread parts
--(there is no folder for this, perhaps in some separated files)
--Debug UTIL parts
--jdwp: Java debug wire protocol
--hprofile: hprofile
--Others
--reflect: Java reflecting
--arch : (Don't know yet)
--native : (Don't know yet)
--other files
Next blog I will trace HelloWorld step by step and give the work-flow of entire dalvik system. And the blog after that will give the detail introduction of dex file format.