Android (Java) Learning Note 159:DALIVK The initialization process of a virtual machine

Source: Internet
Author: User

1. Initialize the following system functions ( call the Dvmstartup function to initialize all related functions )

Start learning the initialization process of the virtual machine, starting with the Dvmstartup function , which implements all the start-up of the virtual machine :

The Dvmalloctrackerstartup function initializes the tracking display system , and the tracking system mainly uses the data packet to generate the debug system .

The Dvmgcstartup function is used to initialize the garbage collector.

The Dvmthreadstartup function is the initialization of the thread list and the main thread environment parameters .

The Dvminlinenativestartup function is the table memory that allocates the internal action method .

The Dvmverificationstartup function is the initialization of the virtual machine's script-related content in order to check whether the instructions are correct .

The Dvmregistermapstartup function is the memory that allocates the state of the instruction register .

The Dvminstanceofstartup function is the cache used by the allocation virtual machine .

The Dvmclassstartup function is the most basic Java library for initializing virtual machines .

The Dvmthreadobjstartup function is the Java Class Library threading class that initializes the virtual machine for further use .

The Dvmexceptionstartup function is the exception Java class library that initializes the virtual machine to use .

The Dvmstringinternstartup function is a string hash table that initializes the use of the virtual machine interpreter .

The Dvmnativestartup function is a table that initializes the local method library .

The Dvminternalnativestartup function is to initialize the internal local method and establish a hash table to facilitate quick lookups .

The Dvmjnistartup function initializes the JNI call table to quickly locate the entry for the local method call .

The Dvmreflectstartup function is a reflection class in the Cache Java class Library .

2. After the above initialization function is processed, The following classes are then initialized first, as follows:

Staticconst char*earlyclasses[] = {

"Ljava/lang/internalerror;",

"Ljava/lang/stackoverflowerror;",

"Ljava/lang/unsatisfiedlinkerror;",

"Ljava/lang/noclassdeffounderror;",

Null

};

The initialization of these classes is called the function Dvmfindsystemclassnoinit .

3. Then call the dvmvalidateboxclasses function to initialize the Java base Type library , as follows:

Staticconstchar*classes[] = {

"Ljava/lang/boolean;",

"Ljava/lang/character;",

"Ljava/lang/float;",

"Ljava/lang/double;",

"Ljava/lang/byte;",

"Ljava/lang/short;",

"Ljava/lang/integer;",

"Ljava/lang/long;",

Null

};

Note: These classes call functions ( dvmfindsystemclassnoinit,dvmvalidateboxclasses , and so on)that are just used. Instead of using a system function to initialize it, call Dvmfindclassnoinit to initialize it.

4. Call the Dvmprepmainforjni class call function prepare the main line thread the interpretation stack can invoke the method of JNI;

Call the Registersystemnatives class call function to register the JNI method in the Java library;

Call the Dvmcreatestockexceptions class to call the function to allocate memory for abnormal errors;

Call the Dvmprepmainthread class Call function to complete the initialization of the main thread of the interpreter;

Call the Dvmdebuggerstartup class Call function to initialize the debugger;

Finally call the Dvminitzygote class Call function or the Dvminitafterzygote class Call function to initialize the threading pattern. Call the Dvmcheckexception function to check if an exception occurs.

6. Complete the initialization process of the virtual machine.

Android (Java) Learning Note 159:DALIVK The initialization process of a virtual machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.