This is the U.S. national stage application which claims priority under 35 U.S.C. ยง371 to International Patent Application No. PCT/CN2011/071142, filed Feb. 21, 2011, which claims priority to Chinese Patent Application No. 201010504978.3, filed Oct. 9, 2010, the disclosures of which are incorporated by reference herein their entireties.
The present disclosure relates to the field of communication, in particular to a bootup method and a bootup device for an application program in a mobile equipment.
With the arrival of 3G and smart phone era, there are more and more application programs on a mobile equipment such as a mobile phone. The pattern in which a user uses application programs on a mobile equipment such as a mobile phone is characterized of frequent bootup and short-time usage, which poses stringent requirements on bootup speed of application programs. If the bootup speed of application programs is too low, the time that a user spends on waiting for an application program to boot up may be comparable with or even more than the time that a user spends actually using the application program, which significantly decreases the user experience of a mobile equipment such as a mobile phone.
For example, application programs currently used on common mobile equipments and developed with Java language. Which may be called Java application programs, have the advantages of high portability, one-time compilation running, low development difficulty, high development efficiency, low development cost, and the like. As Java language is an interpreted language with low execution efficiency, Java application programs will encounter a serious problem of low bootup speed.
At present, there are many methods for increasing the bootup speed of Java application programs, wherein one method is that a Java application program is optimized according to its own processing logic, where measures such as lazy load and lazy initialization are taken to accelerate the bootup speed, the effectiveness of such a method is only applicable to a single Java application program itself, and the measures taken are closely related to the features of the Java application program; Another method is that, in the mobile phone software platform, the bootup speed of a Java application program is accelerated with measures such as pre-bootup, pre-load, pre-initialization, Copy-On-Write (COW), caching of application programs on exit, etc; such a method can accelerate bootup speed of all Java application programs without the need to make any modification on the activities.
As the bottleneck of the bootup speed of Java application programs is that Java application programs are interpretively executed, existing methods do not produce satisfactory results in increasing the bootup speed of Java application programs. JIT (Just in Time) is a just-in-time compilation mechanism which compiles Java codes into a local language before execution to avoid interpretive execution, so that the bootup speed of Java application programs is significantly increased. However, the existing JIT will compile codes in Java application programs into a local language before execution only when the codes are executed for a certain number of times; in addition, the results of a JIT compilation are abandoned as a Java application program exits, and no JIT compilation result is available on rerun of a Java application program, which then has to be recompiled during the rerun. As the bootup process of an application is executed once only on bootup of the application program, the bootup process of a Java application program cannot be accelerated by JIT. Because JIT will not compile codes that are executed only once, and while the bootup of a Java application program is the initial stage of rerun of a Java application program, no JIT compilation result will be available for execution either. Therefore, JIT in state of the art is unable to increase the bootup speed of a Java application program. Similarly, application programs on a mobile equipment that are developed with other interpretive languages with the JIT compilation mechanism will also encounter the same problem.
Therefore, the question of how to utilize JIT to increase the bootup speed of a application program has become one of the problems in state of the art that are pressing for answers.
Therefore, the disclosure discloses a bootup method and a bootup device for an application program on a mobile equipment, which can increase the bootup speed of an application program on a mobile equipment.
To realize the above purpose, the technical solution of the disclosure is implemented as follows:
the disclosure provides a bootup device for an application program in a mobile equipment, including: an application management module, a virtual machine module, and a storage management module; wherein
the application management module is configured to boot up a virtual machine module to run based on an application program to be run, and control the virtual machine module to execute codes of the application program;
the virtual machine module is configured to call the storage management module to respectively load the codes of the application program and Just in Time (JIT) compilation results of a bootup process of the application program into a memory, and search for, in the JIT compilation results, local JIT compiled codes corresponding to the code segment of the bootup process to be executed and execute the found local JIT compiled codes in execution of a code segment of the bootup process of the application program;
the storage management module is configured to store and read the codes of the application program and the JIT compilation results obtained from JIT compilation of the bootup process of the application program, wherein the JIT compilation results include JIT compiled codes corresponding to a JIT compiled code segment of the bootup process.
The disclosure further provides a bootup method for an application program on a mobile equipment, including:
booting up, by an application management module, a virtual machine module based on the application program to be run and controlling the virtual machine module to execute codes of the application program;
calling, by the virtual machine module, a storage management module to respectively load the codes of the application program and Just in Time (JIT) compilation results of a bootup process of the application program into a memory, and searching for, in the JIT compilation results, local JIT compiled codes corresponding to a code segment of the bootup process to be executed and executing the found local JIT compiled codes in execution of the code segment of the bootup process of the application program.
According to the bootup device and method for an application program in a mobile equipment provided by embodiments of the disclosure, during the bootup of an application program, the application management module boots up a virtual machine module according to an application program to be run; the virtual machine module calls the storage management module to respectively load the application program codes and a JIT compilation results of the bootup process of the application program into a memory, searches in the JIT compilation results for local JIT compiled codes corresponding to the bootup process code segment to be executed, and executes the found local JIT compiled codes during execution of each bootup process code segment of the application program; Thus, on bootup of an application program, as the JIT compilation results of the bootup process code segment, which is to be executed currently, of the bootup process of the application program is saved, it only requires to directly execute corresponding JIT local compilation results instead of without the need to interpretively execute the bootup process code segment to be executed, therefore increasing the bootup speed of the application program.
The basic conception of the disclosure is that: an application management module is configured to boot up a virtual machine module based on an application program to be run; the virtual machine module is configured to load the application program codes and JIT compilation results of the bootup process of the application program into a memory, search in the JIT compilation results for local JIT compiled codes corresponding to the bootup process code segment to be executed, and execute the found local JIT compiled codes in execution of each bootup process code segment of the application program; a storage management module is configured to store and read application program codes and the JIT compilation results obtained from the JIT compilation of the bootup process of the application program.
In order to increase the bootup speed of an application program on a mobile equipment, the embodiments of the disclosure provide a bootup device and method for an application program on a mobile equipment.
The preferred embodiments of the disclosure will be described below with reference to drawings in the specification. It should be understood that, the preferred embodiments described herein are only used for describing and explaining the disclosure but not for limiting the disclosure, and embodiments in the disclosure and features in the embodiments may be combined with each other as long as such combination does not lead to any conflict.
the application management module 101 is configured to boot up a virtual machine module 102 based on an application program to be run and control the virtual machine module 102 to execute the codes of the application program;
the virtual machine module 102 is configured to call the storage management module 103 to respectively load application program codes and JIT compilation results of the bootup process of the application program into a memory, search in the JIT compilation results for local JIT compiled codes corresponding to the bootup process code segment to be executed, and execute the found local JIT compiled codes when executing each bootup process code segment of the application program;
the storage management module 103 is configured to store and read application program codes and JIT compilation results obtained from the JIT compilation of the bootup process of the application program, wherein the JIT compilation results include JIT compiled codes corresponding to each bootup process code segment that is JIT compiled.
During the specific implementation, the bootup device for the application program on a mobile equipment may further comprise a JIT compiler module 104, wherein:
the virtual machine module 102 is further configured to notify the JIT compiler module 104 to JIT compile a bootup process code segment to be executed, and interpretively execute the bootup process code segment to be executed when no local JIT compiled codes corresponding to the bootup process code segment to be executed are found in the JIT compilation results;
the JIT compiler module 104 is configured to JIT compile the bootup process code segment to be executed according to the notification of the virtual machine module 102, when confirming that there is free space in the memory space allocated on configuration of the virtual machine module 102.
Specifically, after receiving the notification of the virtual machine module, the JIT compiler module inquires whether there is still enough space to store the compiled codes of the bootup process code segment to be executed in the memory space allocated when the virtual machine module 102 is configured, if there is enough space, the JIT compiler module will JIT compile the bootup process code segment to be executed; otherwise, the bootup process code segment to be executed is abandoned.
Specifically, the application management module 101 is further configured to obtain the identification information of the application program to be run, transfer the obtained identification information of the application program to the virtual machine module 102 upon booting up the virtual machine module 102, and control, via the identification information of the application program, the virtual machine module to execute the application program codes; the virtual machine module 102 is further configured to call, according to the identification information of the application program, the storage management module 103 to respectively load the application program codes and the JIT compilation results of the bootup process of the application program into the memory; then obtain a first bootup process code segment of the application program; search in the JIT compilation results for local JIT compiled codes corresponding to the first bootup process code segment to be executed currently, execute the found local JIT compiled codes when the local JIT compiled codes corresponding to the code segment is found, notify the JIT compiler module to JIT compile the code segment, that is to be executed currently, of the application program when no local JIT compiled codes corresponding to the code segment is found, and execute the code segment interpretively; when the bootup process of the application program does not execute end, determine, according to the execution result of this code segment, a bootup process code segment, that is to be executed next, of the application program, and return to execute the last step until the bootup process of the application program executes end.
During the specific implementation, the bootup process code segment involved in the embodiments of the disclosure may include one segment of codes or a plurality of segments of codes specifically depending on the JIT compiler supported by the system executing the application program. Specifically, when the virtual machine module searches for the JIT compilation results in the JIT compilation result files and executes the JIT compiled codes corresponding to the code segment, after the execution of the JIT compiled codes completes, it means that a segment of codes beginning with the codes has been executed, the next segment of codes to be executed may be decided by the executed compilation results.
During the specific implementation, the identification information of the application program may include a software package name and a program name of the application program and the like.
During the specific implementation, the application management module 101 may be further configured to, after confirming that the execution of the bootup process of the application program ends, determine whether JIT compilation is performed during the execution of the bootup process of the application program, if so, obtain the JIT compiled codes corresponding to the bootup process of the application program from the JIT compiler module 104 and transfer the obtained JIT compiled codes to the storage management module 103, wherein the storage management module 103 may be configured to store the received JIT compiled codes of the bootup process of the application program in a specified external storage.
Specifically, after receiving the JIT compiled codes of the bootup process code segment in the bootup process of the application program, the storage management module 103 stores the JIT compiled codes in an external storage in a certain format.
Preferably, the application program involved in the embodiments of the disclosure may be a Java application program or another application program developed using other interpretive languages with the JIT compilation mechanism.
Particularly, due to various limitations of JIT implementation art such as limitation of memory capacity, codes involved in the bootup process of the application program may not be compiled entirely; instead, they are compiled only partially; the embodiments of the disclosure are also applicable to such a case.
Preferably, in the embodiments of the disclosure, the format of the JIT compilation results stored by the storage manager may be a table, as shown in Table 1; the keyword of the table is the position of the JIT compiled bootup process codes of the application program in the application program codes, and the content of the table is the storage position of the local JIT compiled codes obtained from the JIT compilation of the bootup process codes of the application program. When the involved code segment consists of a plurality of pieces of codes, the position of the first piece of codes of the compiled code segment in the application program codes is used as the keyword to inquire the storage position of the local JIT compiled codes. Therefore, the compilation results corresponding to the code address in the compilation result table may be not only the compilation results of this code, but also the compilation results of a segment of codes beginning with this code.
As shown in Table 1, when the keyword is 100, it means that the content is the storage position of the local JIT compiled codes obtained from the JIT compilation of the bootup process codes beginning with the position of 100 in the codes of the application program; similarly, when the keyword is 340, it means that the content is the storage position of the local JIT compiled codes obtained from the JIT compilation of the bootup process codes beginning with the position of 340 in the codes of the application program; when the keyword is 800, it means that the content is the storage position of the local JIT compiled codes obtained from the JIT compilation of the bootup process codes beginning with the position of 800 in the codes of the application program.
During the specific implementation, the reason that the JIT compilation results are stored by way of a table is because that, in such a way, it is easier to search for the codes of the bootup process of the application program to be executed and the corresponding JIT compilation results, and it is easy to maintain in such a way, which is also a common way of storage.
During the specific implementation, the application management module 101 may be further configured to notify the virtual machine module 102 after confirming that the execution of the bootup process of the application program ends; the virtual machine module 102 is further configured to determine, after confirming that the execution of the bootup process of the application program ends, whether JIT compilation is performed during the execution of the bootup process of the application program, if so, obtain JIT compiled codes corresponding to the bootup process of the application program from the JIT compiler module 104 and transfer the obtained JIT compiled codes to the storage management module 103; and the storage management module 103 is specifically configured to store the received JIT compiled codes of the bootup process of an application program in a specified external storage.
During the specific implementation, the application management module 101 is further configured to notify the JIT compiler module 104 after confirming that the execution of the bootup process of an application program ends; the JIT compiler module 104 is further configured to determine, after learning that the execution of the bootup process of an application program ends, whether JIT compilation is performed during the execution of the bootup process of the application program, and if so, transfer the JIT compiled codes to a storage management module 103; and the storage management module 103 is further configured to store the received JIT compiled codes of the bootup process of the application program in a specified external storage.
Based on the above device, the embodiments of the disclosure further provide a bootup method for an application program on a mobile equipment, as the principle of solution of the method is similar to that of the bootup device for an application program, implementation of the method may refer to that of the device without further elaboration.
S201: An application management module boots up a virtual machine module based on an application program to be run and controls the virtual machine module to execute codes of the application program;
S202: The virtual machine module calls a storage management module to respectively load the application program codes and JIT compilation results of the bootup process of the application program into a memory, searches in the JIT compilation results for local JIT compiled codes corresponding to the bootup process code segment to be executed, and executes the found local JIT compiled codes in execution of each bootup process code segment of the application program.
During the specific implementation, the bootup method for an application program on a mobile equipment may further include:
the virtual machine module notifies the JIT compiler module to JIT compile the bootup process code segment to be executed when no local JIT compiled codes corresponding to the bootup process code segment to be executed are found in the JIT compilation results, and executes the bootup process code segment to be executed interpretively; and the JIT compiler module JIT compiles the bootup process code segment to be executed according to the notification of the virtual machine module, when confirming that there is free space in the memory space allocated on configuration of the virtual machine module.
Specifically, the application management module obtains the identification information of an application program to be run, wherein the identification information may include the program name of the application program and software package name; boots up the virtual machine module and simultaneously transfers the obtained identification information to the virtual machine module, and controls, with the identification information, the virtual machine module to execute the application program codes. The virtual machine module calls, according to the identification information of the application program transferred from the application management module, the storage management module to respectively load application program codes and JIT compilation results of the bootup process of the application program into the memory; the virtual machine module obtains the first bootup process code segment of the application program to be executed, and uses the obtained code segment as the code segment to be executed currently; the virtual machine module finds the local JIT compiled codes corresponding to the code segment and determines whether there is any JIT compilation result for the code segment to be executed currently, if there is, the virtual machine module executes the found local JIT compiled codes; otherwise the virtual machine module notifies the JIT compiler module to JIT compile the bootup process code segment to be executed currently, and simultaneously executes the code segment interpretively. The application management module determines whether the execution of the bootup process of the application program ends, if not, the virtual machine module determines, according to the execution result of the code segment, a bootup process code segment of an application program to be executed next, and uses it as the code segment to be executed currently, and returns to execute the above process of determining whether there is any JIT compilation result for the bootup process code segment to be executed currently, until the application management module confirms that the execution of the bootup process of the application program ends.
During the specific implementation, the application management module determines, after confirming that the execution of the bootup process of an application program ends, whether JIT compilation is performed during the execution of the bootup process of the application program, if so, obtains the JIT compiled codes corresponding to the bootup process of the application program from the JIT compiler module, and transfers the obtained JIT compiled codes to the storage management module; the storage management module stores the received JIT compiled codes of the bootup process of the application program in a specified external storage.
Specifically, the JIT compilation results may be stored in the same external storage, or in different external storages.
During the specific implementation, the application management module may also notify the virtual machine module after confirming that the execution of the bootup process of an application program ends; the virtual machine module determines, after confirming that the execution of the bootup process of the application program ends, whether JIT compilation is performed during the execution of the bootup process of the application program, if so, obtains from the JIT compiler module the JIT compiled codes corresponding to the bootup process of the application program, and transfers the obtained JIT compiled codes to the storage management module, which stores the received JIT compiled codes of the bootup process of the application program in the specified external storage.
During the specific implementation, the application management module may also notify the JIT compiler module after confirming that the execution of the bootup process of the application program ends; the JIT compiler module determines, after learning that the execution of the bootup process of an application program ends, whether JIT compilation is performed during the execution of the bootup process of the application program, if so, transfers the JIT compiled codes to the storage management module, which then stores the received JIT compiled codes of the bootup process of the application program in the specified external storage.
Preferably, the application program involved in the embodiments of the disclosure may be a Java application program.
Specifically, when the application program involved in the embodiments of the disclosure is a Java application program, the bootup method for a Java application program on a mobile equipment belongs to a performance improvement method of platform type, which does not require modification of any Java application program and is applicable to all application programs developed on basis of Java on a mobile equipment, wherein involved mobile equipments include Mobile Internet Devices (MID), MP4 (MPEG-4, Moving Picture Expert Group-4), Play Station Portable (PSP), mobile phone, and the like.
To understand the way of implementation of the embodiments of the disclosure better, the way of implementation of the disclosure will be described below with specific embodiments. The embodiment of the disclosure is described taking as an example a software platform of an Android mobile phone, the application programs of which are developed with Java language, and the virtual machine thereof has the JIT function.
In the embodiment of the disclosure, description will be given taking an activity in the Android mobile phone software platform as an example. In Android, an activity may be regarded as one Java application program, and the display of the first window of the activity indicates the completion of the bootup of the activity. In the embodiment of the disclosure, the JIT compilation results are stored as a table in the specific external storage.
As shown in
S401: The ActivityManagerService creates a new progress to run an activity.
S402: The new progress creates a Java virtual machine module.
S403: The Java virtual machine module executes codes of the ActivityThread.
S404: A communication connection is created between the ActivityThread and the ActivityManagerService.
S405: The ActivityManagerService sends to the ActivityThread the identification information of the bootup process of the activity to be booted up;
specifically, the indication information of the bootup process of the activity sent by the ActivityManagerService to the ActivityThread includes the name of the activity and the name of the software package, etc.
S406: The ActivityThread transfers the received identification information of the activity to the Java virtual machine module.
S407: The Java virtual machine module obtains from the PackageManager the codes of the activity to be run and the JIT compilation results of the bootup process of the activity.
S408: The Java virtual machine module opens the codes of the activity and the JIT compilation results of the bootup process of the activity, and read them into a memory;
Then the Java virtual machine module stores the codes of the activity and the JIT compilation results of the bootup process of the activity into the code storage area and the JIT-cache storage area (JIT cache) respectively;
Specifically, the PackageManager reads the JIT compilation results of the bootup process of the activity from the specified external storage, and the Java virtual machine module reads the JIT compilation results into the memory.
S409: Java virtual machine module obtains from the code storage area the first segment of codes as the code segment to be executed currently.
S410: The Java virtual machine module confirms whether there is any JIT compilation result corresponding to the code segment to be executed currently, if so, executes S412, and otherwise executes S411;
specifically, the Java virtual machine module uses the storage position of the code segment to be executed currently in the codes of the activity as the keyword to search for the JIT compilation results in the JIT-cache storage area, when the keyword has corresponding content, the content is a pointer pointing to the storage of the local JIT compiled codes obtained from the JIT compilation of codes to be executed currently; the local JIT compiled codes corresponding to the codes to be executed currently can be obtained according to the pointer.
S411: The Java virtual machine module interpretively executes the codes to be executed currently, notifies the JIT compiler module to compile the code segment to be executed currently, sets the identification of the JIT compiled bootup process to be TRUE, and sets the code segment to be executed next.
S412: The Java virtual machine module executes the local JIT compiled codes corresponding to the code segment to be executed currently and sets the code segment to be executed next.
S413: The ActivityManagerService confirms whether the identification of completion of bootup process of the activity is TRUE, if so, executes S415, and otherwise executes S414.
S414: execute the code segment to be executed next and return to execute S410;
as the code segment to be executed next will be set, which is guaranteed by the JIT compilation mechanism and the Java virtual machine mechanism, after the execution of codes to be executed currently is completed in S411 or S412, the set code segment to be executed next is taken as the code segment to be executed currently.
S415: The ActivityManagerService determines whether the identification of the bootup process of the JIT compiler module is TRUE, if so, executes S416, and otherwise executes S417.
S416: store the JIT compiled codes in this bootup process;
the ActivityManagerService obtains from the JIT compiler module the compiled codes that are JIT compiled in this bootup process of the activity and transfers the compiled codes to the PackageManager, which stores the compiled codes as a table under the installation directory of the activity.
S417: The activity bootup process ends.
In the embodiment of the disclosure, by improvement of the JIT mechanism, the code segment executed in the bootup process of a Java application program can be JIT compiled into local JIT compiled codes, and the JIT compilation results may be stored, breaking through the biggest performance bottleneck of the bootup process of the Java application program and increasing the bootup speed of the Java application program.
According to the bootup device and method for an application program on a mobile equipment provided in embodiments of the disclosure, during the bootup process of the application program, an application management module boots up, based on the application program to be run, a virtual machine module; and the virtual machine module calls a storage management module to respectively load codes of the application program and JIT compilation results of the bootup process of the application program into a memory, searches, in the JIT compilation results, for local JIT compiled codes corresponding to the bootup process code segment to be executed, and executes the found local JIT compiled codes when executing each bootup process code segment of the application program. Thus, when the application program is booted up, as the JIT compilation results of the bootup process code segment to be executed currently of the bootup process of the application program are saved, it only requires to directly execute the corresponding JIT local compilation results without the need to interpretively execute the bootup process code segment to be executed, so that the bootup speed of the application program is increased.
Obviously, persons skilled in the field may make various alterations and variations to the disclosure without departing from the spirit and scope of the disclosure. In this way, if these alterations and variations of the disclosure are within the scope of the claims and equivalent techniques thereof, the disclosure is also intended to encompass these alterations and variations.
Number | Date | Country | Kind |
---|---|---|---|
2010 1 0504978 | Oct 2010 | CN | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/CN2011/071142 | 2/21/2011 | WO | 00 | 7/26/2012 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2012/045238 | 4/12/2012 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
6779188 | Blandy | Aug 2004 | B1 |
20040210865 | Shimura | Oct 2004 | A1 |
20090055821 | Grcevski et al. | Feb 2009 | A1 |
20090222798 | Iguchi et al. | Sep 2009 | A1 |
Number | Date | Country |
---|---|---|
100354826 | Dec 2007 | CN |
101957770 | Jan 2011 | CN |
1445695 | Aug 2004 | EP |
2002073345 | Mar 2002 | JP |
2005284729 | Oct 2005 | JP |
Entry |
---|
International Search Report dated Jul. 7, 2011, as issued in corresponding to international application No. PCT/CN2011/071142, mailed on Jul. 7, 2011. |
English Translation of the Written Opinion of the International Search Authority in international application No. PCT/CN2011/071142, mailed on Jul. 7, 2011. |
Supplementary European Search Report in European application No. 11830194.4, mailed on Oct. 7, 2013. |
Number | Date | Country | |
---|---|---|---|
20120304166 A1 | Nov 2012 | US |