Download dalvik vm source code




















A: array size and argument word count 4 bits B: type index 16 bits C.. G: argument registers 4 bits each. Construct an array of the given type and size, filling it with the supplied contents. A: array reference 8 bits B: signed "branch" offset to table data pseudo-instruction 32 bits. Fill the given array with the indicated data.

Unconditionally jump to the indicated instruction. A: register to test B: signed "branch" offset to table data pseudo-instruction 32 bits. Jump to a new instruction based on the value in the given register, using a table of offsets corresponding to each value in a particular integral range, or fall through to the next instruction if there is no match. Jump to a new instruction based on the value in the given register, using an ordered table of value-offset pairs, or fall through to the next instruction if there is no match.

A: destination register 8 bits B: first source register or pair C: second source register or pair. A: first register to test 4 bits B: second register to test 4 bits C: signed branch offset 16 bits. Branch to the given destination if the given two registers' values compare as specified. A: register to test 8 bits B: signed branch offset 16 bits. Branch to the given destination if the given register's value compares with 0 as specified. A: value register or pair; may be source or dest 8 bits B: array register 8 bits C: index register 8 bits.

Perform the identified array operation at the identified index of the given array, loading or storing into the value register. A: value register or pair; may be source or dest 4 bits B: object register 4 bits C: instance field reference index 16 bits. Perform the identified object instance field operation with the identified field, loading or storing into the value register.

A: value register or pair; may be source or dest 8 bits B: static field reference index 16 bits. Perform the identified object static field operation with the identified static field, loading or storing into the value register. A: argument word count 4 bits B: method reference index 16 bits C.. Call the indicated method. A: destination register or pair 4 bits B: source register or pair 4 bits. Perform the identified unary operation on the source register, storing the result in the destination register.

A: destination register or pair 8 bits B: first source register or pair 8 bits C: second source register or pair 8 bits. Perform the identified binary operation on the two source registers, storing the result in the destination register. A: destination and first source register or pair 4 bits B: second source register or pair 4 bits. Perform the identified binary operation on the two source registers, storing the result in the first source register.

A: destination register 4 bits B: source register 4 bits C: signed int constant 16 bits. Perform the indicated binary op on the indicated register first argument and literal value second argument , storing the result in the destination register. A: destination register 8 bits B: source register 8 bits C: signed int constant 8 bits. A: argument word count 4 bits B: method reference index 16 bits C: receiver 4 bits D.. G: argument registers 4 bits each H: prototype reference index 16 bits.

Invoke the indicated signature polymorphic method. Invoke the indicated method handle. A: argument word count 4 bits B: call site reference index 16 bits C.. Resolves and invokes the indicated call site. Resolve and invoke a call site. A: destination register 8 bits B: method handle index 16 bits. Move a reference to the method handle specified by the given index into the specified register.

A: destination register 8 bits B: method prototype reference 16 bits. Move a reference to the method prototype specified by the given index into the specified register. Sign extension of int32 into int Conversion of int32 to float , using round-to-nearest.

Conversion of int32 to double. Truncation of int64 into int Conversion of int64 to float , using round-to-nearest. Conversion of int64 to double , using round-to-nearest. Conversion of float to int32 , using round-toward-zero. Conversion of float to int64 , using round-toward-zero. Conversion of float to double , preserving the value exactly.

Conversion of double to int32 , using round-toward-zero. Conversion of double to int64 , using round-toward-zero. Conversion of double to float , using round-to-nearest. Truncation of int32 to int8 , sign extending the result. Truncation of int32 to uint16 , without sign extension.

Truncation of int32 to int16 , sign extending the result. Twos-complement division, rounded towards zero that is, truncated to integer. From eLinux. Jump to: navigation , search. Category : Android. Navigation menu Personal tools Log in Request account. Namespaces Page Discussion. Views Read View source View history. Where else to find us Twitter elinux elinux on Libera. Chat Facebook elinux. This page was last edited on 15 September , at The Dalvik virtual machine is intended to run on a variety of platforms.

Little-endian CPUs have been exercised the most heavily, but big-endian systems are explicitly supported. There are two general categories of work: porting to a Linux system with a previously unseen CPU architecture, and porting to a different operating system. This document covers the former.

Much of the code comes directly from the Apache Harmony project. These will also need to be ported before the VM can be used. Most of the Dalvik VM runtime is written in portable C. The one non-portable component of the runtime is the JNI call bridge. Simply put, this converts an array of integers into function arguments of various types, and calls a function.

This must be done according to the C calling conventions for the platform. The task could be as simple as pushing all of the arguments onto the stack, or involve complex rules for register assignment and stack alignment.

To ease porting to new platforms, the open-source FFI library Foreign Function Interface is used when a custom bridge is unavailable. FFI is not as fast as a native implementation, and the optional performance improvements it does offer are not used, so writing a replacement is a good first step.

There are two source files for each architecture. One defines the call bridge itself:. The role of dvmPlatformInvoke is to convert the values in argv into C-style calling conventions, call the method, and then place the return type into pReturn a union that holds all of the basic JNI types.

The code may use the method signature a DEX "shorty" signature, with one character for the return type and one per argument to determine how to handle the values. The other source file involved here defines a bit "hint". The hint is computed when the method's class is loaded, and passed in as the "argInfo" argument. The hint can be used to avoid scanning the ASCII method signature for things like the return value, total argument size, or inter-argument bit alignment restrictions.

The Dalvik runtime includes two interpreters, labeled "portable" and "fast". The portable interpreter is largely contained within a single C function, and should compile on any system that supports gcc. The fast interpreter uses hand-coded assembly fragments. If none are available for the current architecture, the build system will create an interpreter out of C "stubs". The resulting "all stubs" interpreter is quite a bit slower than the portable interpreter, making "fast" something of a misnomer.

The fast interpreter is enabled by default. On platforms without native support, you may want to switch to the portable interpreter. Improve this answer. Thanks, fadden. You're right. Their documentations are kept inside the source codes. I should probably start with reading the three cpp files you mentioned first. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog.



0コメント

  • 1000 / 1000