Application updating method and device, computer device and storage medium

By executing patch files in a virtual runtime environment and directly calling code between the patch files and the target application, the problem of low application update efficiency is solved, enabling efficient application updates on operating platforms without execution permissions.

CN116088917BActive Publication Date: 2026-05-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-11-05
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing technologies have low application update efficiency, requiring users to download and install new versions again, resulting in a time-consuming and labor-intensive update process.

Method used

By running the target application on the operating platform, obtaining the patch file, executing the patch file in the virtual runtime environment, and using the patch file to directly call the code of the target application, dynamic updates of the application can be achieved.

Benefits of technology

It improves the efficiency of application updates, avoids complex code conversion on operating platforms without execution permissions, and directly calls the target application for updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116088917B_ABST
    Figure CN116088917B_ABST
Patent Text Reader

Abstract

The application relates to an application updating method and device, computer equipment and a storage medium. The method comprises the following steps: running a target application on an operation platform; when an updating condition of the target application is met, obtaining a patch file for the target application; the patch file has the capability of directly calling the code of the target application when the patch file is executed; when the patch file does not have the execution permission of the operation platform, creating a virtual running environment through the target application; when the patch file is executed in the virtual running environment, the target application is updated through the direct code calling of the target application. The application can improve the updating efficiency of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an application update method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the development of computer technology, the types and number of applications (APPs) on terminals are increasing, and they are occupying an increasingly important position in people's lives, work and entertainment. For example, there are applications in the fields of games, education, social networking, finance and so on. In the operation of various applications, it is necessary to continuously update the applications to meet the ever-growing needs of users.

[0003] Currently, updating various applications generally requires releasing a new version of the application, which users then download and install again to update the application. This process of downloading and installing the application results in low update efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide an application update method, apparatus, computer equipment, storage medium, and computer program product that can improve the efficiency of application updates, addressing the aforementioned technical problems.

[0005] An application update method, the method comprising:

[0006] Run the target application on the operating platform;

[0007] When the update conditions of the target application are met, obtain the patch file for the target application; the patch file has the ability to directly call the code of the target application at runtime;

[0008] When the patch file does not have execute permissions on the operating platform, a virtual runtime environment is created through the target application;

[0009] When executing patch files in a virtual runtime environment, the target application is updated by directly calling the target application's code.

[0010] An application update apparatus, the apparatus comprising:

[0011] The application runtime module is used to run the target application on the operating platform;

[0012] The patch file acquisition module is used to acquire patch files for the target application when the update conditions of the target application are met; the patch files have the ability to directly call the code of the target application at runtime;

[0013] The virtual runtime environment creation module is used to create a virtual runtime environment through the target application when the patch file does not have the execution permissions to be executed on the operating platform.

[0014] The patch file execution module is used to update the target application by directly calling the target application's code when executing patch files in a virtual runtime environment.

[0015] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:

[0016] Run the target application on the operating platform;

[0017] When the update conditions of the target application are met, obtain the patch file for the target application; the patch file has the ability to directly call the code of the target application at runtime;

[0018] When the patch file does not have execute permissions on the operating platform, a virtual runtime environment is created through the target application;

[0019] When executing patch files in a virtual runtime environment, the target application is updated by directly calling the target application's code.

[0020] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0021] Run the target application on the operating platform;

[0022] When the update conditions of the target application are met, obtain the patch file for the target application; the patch file has the ability to directly call the code of the target application at runtime;

[0023] When the patch file does not have execute permissions on the operating platform, a virtual runtime environment is created through the target application;

[0024] When executing patch files in a virtual runtime environment, the target application is updated by directly calling the target application's code.

[0025] A computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0026] Run the target application on the operating platform;

[0027] When the update conditions of the target application are met, obtain the patch file for the target application; the patch file has the ability to directly call the code of the target application at runtime;

[0028] When the patch file does not have execute permissions on the operating platform, a virtual runtime environment is created through the target application;

[0029] When executing patch files in a virtual runtime environment, the target application is updated by directly calling the target application's code.

[0030] The aforementioned application update method, apparatus, computer equipment, storage medium, and computer program product, when meeting the update conditions of the target application running on the operating platform, obtain a patch file capable of directly calling the target application's code during execution. If the patch file lacks execution permissions on the operating platform, it is executed within a virtual runtime environment created using the target application. During execution, the target application is updated through direct code calls with the target application. In the application update process, by creating a virtual runtime environment to execute a patch file that lacks execution permissions on the operating platform, and because the patch file possesses the ability to directly call the target application's code during execution, direct code calls are possible without code conversion. This allows for dynamic updates of applications on operating platforms lacking execution permissions, improving application update efficiency. Attached Figure Description

[0031] Figure 1 This is an application environment diagram of the update method in one embodiment;

[0032] Figure 2 This is a flowchart illustrating the application of the update method in one embodiment;

[0033] Figure 3 This is a schematic diagram of the process of updating the target application in one embodiment;

[0034] Figure 4 This is a schematic diagram of the process for updating the target application in another embodiment;

[0035] Figure 5 This is a schematic diagram illustrating the process of updating an application based on patch files in traditional technologies.

[0036] Figure 6 This is a schematic diagram of the process for generating patch files in one embodiment;

[0037] Figure 7 This is a schematic diagram of the process of loading patch files in one embodiment;

[0038] Figure 8 This is a schematic diagram illustrating the interface changes when updating the opening remarks interface in one embodiment.

[0039] Figure 9This is a schematic diagram illustrating the process of native code calling a virtual machine method in one embodiment;

[0040] Figure 10 This is a schematic diagram illustrating the process of a virtual machine calling native code in one embodiment;

[0041] Figure 11 This is a schematic diagram of the process of mutual calls between virtual machines in one embodiment;

[0042] Figure 12 This is a schematic diagram illustrating the process of a virtual machine replacing native code in one embodiment;

[0043] Figure 13 This is a structural block diagram of an application update device in one embodiment;

[0044] Figure 14 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0046] The application update method provided in this application can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on a cloud or other network server. Various applications can be installed on the operating platform of terminal 102, and each application can receive corresponding services from server 104. When a target application runs on the operating platform of terminal 102 and its update conditions are met, it indicates that the application on terminal 102 needs to be updated. Terminal 102 can then obtain a patch file for the target application from server 104. This patch file has the ability to directly call code with the target application during execution. If, after obtaining the patch file, the patch file does not have execution permissions on the operating platform of terminal 102, terminal 102 creates a virtual runtime environment using the target application. When the patch file is executed in the virtual runtime environment, it updates the target application by directly calling code with the target application, thus avoiding the need for terminal 102 to download and reinstall a complete new version of the application from server 104. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0047] In one embodiment, such as Figure 2 As shown, an application update method is provided, which is applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps:

[0048] Step 202: Run the target application on the operating platform.

[0049] The operating platform refers to the platform on which the application runs, specifically the operating system platform. An operating system (OS) is a computer program that manages computer hardware and software resources. The operating system handles basic tasks such as managing and allocating memory, determining the priority of system resource supply and demand, controlling input and output devices, operating the network, and managing the file system. The operating system also provides a user interface for interacting with the system. Specifically, the operating platform can include, but is not limited to, various platforms such as Android, MIUI, iOS, and Windows. The target application is the application that needs updating. The target application runs on the operating platform, and applications running on different operating platforms can be programmed using different programming languages. For example, applications running on the Android operating system platform can be programmed using Java, while applications running on the iOS operating system platform can be programmed using Objective-C.

[0050] Specifically, the terminal runs the target application on an operating platform. Different terminals can install corresponding operating platforms and run corresponding applications. For example, a terminal with the iOS operating platform installed can run applications developed using the Objective-C language; that is, the target application is an application developed using Objective-C. In practice, users can operate the terminal to launch and run the target application on the operating platform. For example, users can run the target application by touching or clicking its icon. Furthermore, the target application can also start automatically based on predetermined conditions; for example, the terminal can automatically run the target application according to pre-defined settings.

[0051] Step 204: When the update conditions of the target application are met, obtain the patch file for the target application; wherein, the patch file has the ability to directly call the code of the target application at execution.

[0052] The update conditions are the conditions for updating the target application. These conditions can be set according to actual needs, such as detecting an updated version of the target application on the server or user-triggered updates. Meeting the update conditions for the target application indicates that the terminal needs to update the target application. The patch file is the file used to update the target application. The patch file can update the application's functionality or fix vulnerabilities. For example, for application A, currently version 2.0, if an update adds new functionality to version 2.1, the patch file can be a file that adds functionality to version 2.0 of application A, creating version 2.1. Conversely, if application A has vulnerabilities, such as a certain interface not displaying correctly, the patch can fix those vulnerabilities to restore the normal display of the abnormal interface in application A.

[0053] Patch files possess the ability to directly call code with the target application at runtime. This direct code-call capability means that the patch file can directly call the code of the target application without complex code conversion, thus ensuring the execution efficiency of the patch file. In practical applications, to ensure that the patch file has this ability, it can be implemented from the perspective of the programming languages ​​of the patch file and the target application. That is, the code calls between the patch file and the target application at runtime are related to their respective programming languages. For example, if the patch file is written in a programming language with low differences from the target application's corresponding programming language, the code calls between the patch file and the target application at runtime can be made without complex code conversion. The closer the programming language of the patch file is to the corresponding programming language of the target application, the simpler the conversion processing during code calls between the two. When the programming language of the patch file is the same as that of the target application, for example, if application B on iOS is developed using Objective-C, and the patch file is also written in Objective-C, then when the patch file is executed, both the patch file and the target application are implemented based on Objective-C code, and the two can directly call each other's code. In this case, the patch file has the ability to directly call the code of the target application during execution.

[0054] Specifically, the terminal monitors whether the update conditions for the target application are met, such as whether there is an update task for the target application on the server. If so, the update conditions for the target application are considered met, and the terminal obtains the patch file for the target application. In practice, when the target application is running on the operating platform, the terminal can query the server to confirm whether an update is needed, i.e., monitor whether the update conditions for the target application are met. If so, the terminal obtains the patch file for the target application from the server, such as by downloading the corresponding patch file from the server.

[0055] Step 206: When the patch file does not have the execution permissions to be executed on the operating platform, a virtual runtime environment is created through the target application.

[0056] Execution permissions refer to the permissions granted to execute various files on the operating platform. These permissions are controlled by the operating platform and can also be configured by the user. Different operating platforms have different permission controls for different files; that is, different files have different execution permissions on different operating platforms. For example, in iOS, application files obtained through the App Store can be executed and installed, while patch files obtained through applications do not have execution permissions and cannot be executed. Similarly, in Android, executable files can be executed, meaning patch files obtained through applications can also be executed directly on the Android operating system platform. A virtual runtime environment is a virtual computer environment simulated by software, possessing complete hardware system functionality and running in a completely isolated environment. A virtual runtime environment can utilize the resources of a physical computer to create a virtual computer environment, such as creating a virtual machine, to execute computer tasks within the virtual machine. A virtual runtime environment can include a virtual operating platform, the type of which can be the same as the operating platform running the target application, thereby allowing the execution of patch files for the target application through this virtual operating platform.

[0057] Specifically, the terminal determines whether the patch file has execution permissions on the operating platform. If the patch file has execution permissions, it can be executed directly on the operating platform to update the target application. If the patch file does not have execution permissions, it means that the patch file cannot be executed directly on the operating platform. In this case, the terminal creates a virtual runtime environment through the target application. Specifically, the terminal's computing resources can be used as the computing resources of the virtual runtime environment to create it, allowing the patch file for the target application to be executed within the virtual runtime environment. In specific applications, the virtual runtime environment created through the target application can be created by the terminal on the operating platform using the target application, or it can be created directly by the terminal within the target application.

[0058] Step 208: When executing the patch file in the virtual runtime environment, the target application is updated by directly calling the code of the target application.

[0059] Specifically, after creating a virtual runtime environment, the terminal can execute patch files within that environment. During patch execution, the terminal can directly call code from the target application, such as directly calling code within the target application without code conversion, thereby updating the target application. Updates to the target application can include various forms of updates such as version updates, feature updates, and vulnerability fixes.

[0060] In practical applications, when executing a patch file, different interactions can occur with the target application depending on the content updated in the patch file. For example, if the patch file needs to utilize the corresponding code in the target application, it needs to call the target application's code; if the target application needs the code in the patch file for repair, it can directly call the patch file's code for repair and update. Furthermore, patch files executed in a virtual runtime environment can also self-call within the virtual runtime environment, or replace code in the target application. For instance, the code implementing function 1 in the target application can be replaced with code implemented through the patch file, and the virtual runtime environment returns the result of function 1 implemented by the patch file to the target application, thus achieving replacement of the target application. During target application updates, corresponding patch files are generated based on different update requirements. When executed in the virtual runtime environment, these patch files are implemented using different execution methods. When code calls with the target application are required, the virtual runtime environment can directly call the target application's code through the patch file to achieve the target application update.

[0061] In the above application update method, when the update conditions of the target application running on the operating platform are met, a patch file with the ability to directly call code with the target application at runtime is obtained. If the patch file does not have execution permissions on the operating platform, the patch file is executed in a virtual runtime environment created using the target application. During the execution of the patch file, the target application is updated by directly calling code with it. In the application update process, by creating a virtual runtime environment to execute a patch file that lacks execution permissions on the operating platform, and because the patch file has the ability to directly call code with the target application at runtime without code conversion, dynamic updates of applications on operating platforms without execution permissions are achieved using the patch file, improving application update efficiency.

[0062] In one embodiment, an application update method is provided, comprising: running a target application on an operating platform and obtaining update conditions for the target application; when the target application meets the update conditions, obtaining a patch file for the target application; wherein the patch file has the ability to directly call code with the target application during execution; obtaining platform execution permissions for the patch file; when the patch file does not have execution permissions on the operating platform, creating a virtual runtime environment for the target application; and updating the target application by directly calling code with the target application when executing the patch file in the virtual runtime environment.

[0063] The update conditions for the target application can be pre-set to determine whether to initiate an update process. These conditions could include whether an updated version of the target application is detected on the server, or whether the user actively triggered the update. The update conditions can be flexibly set according to actual needs. For example, multiple conditions can be set, and meeting any one of them is considered sufficient to satisfy the update requirements. Alternatively, a predetermined number of conditions can be met to satisfy the update requirements. Furthermore, weights can be assigned to each condition, and the overall result is used to determine whether the update conditions are met. Platform execution permissions refer to the permission for patch files to be directly executed on the operating platform. If a patch file has platform execution permissions, it can be directly executed on the operating platform to update the target application. Platform execution permissions are managed by the operating platform or configured by the user. For example, the operating platform can grant platform execution permissions to certain types of patch files or patch files for certain applications, or it can be configured so that no patch files have platform execution permissions. Alternatively, users can configure the execution permissions for various types of patch files or patch files for various applications. A virtual runtime environment is a virtual runtime environment built for the target application. Specifically, it can be a virtual machine created in the target application. That is, when the patch file has the platform execution permissions of the operating platform, a virtual machine can be created in the target application to provide a virtual runtime environment for the patch file.

[0064] Specifically, the target application is run on the terminal's operating platform, and its update conditions are obtained. This can be achieved by triggering the target application's execution on the operating platform, such as when a user clicks the target application's icon on the terminal's operating platform. The terminal then starts the target application and obtains the corresponding update conditions. Based on these conditions, the terminal makes a judgment, such as checking if an updated version exists on the server. If the target application meets the update conditions, and an updated version is confirmed, a patch file for the target application is obtained. Specifically, the terminal requests the corresponding patch file from the server. The patch file has the ability to directly call code from the target application during execution. For example, the patch file can be written in the target application's development language, ensuring that it can directly call code from the target application during execution. Further, the terminal obtains the platform execution permissions for the patch file. This can be done by querying the platform execution permission set configured on the operating platform. If the platform execution permission set contains the platform execution permission for the patch file, the terminal can obtain it; otherwise, the query fails. If the terminal does not obtain platform execution permissions for the patch file (meaning the patch file lacks execution permissions on the operating platform), the terminal creates a virtual runtime environment for the target application. Specifically, a virtual machine can be created within the target application to execute the patch file. Further, when executing the patch file in the virtual runtime environment, the terminal updates the target application by directly calling its code. Executing the patch file in the virtual runtime environment may require code interaction with the target application. Since the patch file has the ability to directly call the target application's code during execution, it can achieve direct code calls between the patch file and the target application without code conversion, thus updating the target application through the patch file.

[0065] In this embodiment, during the application update process on the terminal, a virtual runtime environment for the target application is created to execute a patch file that does not have execution permissions on the operating platform. The patch file has the ability to directly call the code of the target application during execution, and can directly call the code of the target application without code conversion. Thus, the patch file is used to realize the dynamic update of the application on the operating platform that does not have execution permissions, thereby improving the application update efficiency.

[0066] In one embodiment, such as Figure 3 As shown, the process of updating the target application involves updating the target application by directly calling the target application's code when executing the patch file in the virtual runtime environment. This includes:

[0067] Step 302: When a direct code call request for the target application is received through the virtual runtime environment, the target call parameters are determined.

[0068] The direct code invocation request is used to instruct the direct invocation of code. The patch file has the ability to directly invoke code with the target application at runtime. On one hand, the patch file can directly invoke the corresponding code in the target application during execution; on the other hand, the target application can also directly invoke the code in the patch file without complex code and parameter conversions. When the target application needs to invoke code in the patch file, such as when the patch file needs to fix an abnormal module in a certain interface, the target application can send a direct code invocation request to the virtual runtime environment (VM) to instruct the VM to invoke the corresponding code in the patch file to fix the abnormal module. The target invocation parameters are the invocation parameters corresponding to the code in the patch file invoked by the target application. The VM invokes the corresponding code according to these target invocation parameters, executes it, and returns the execution result to the target application to update it.

[0069] Specifically, when executing a patch file in a virtual runtime environment, if the virtual runtime environment receives a direct code invocation request from the target application, it indicates that the target application needs to invoke the patch file code during the patch file execution process. The terminal then determines the target invocation parameters. These parameters can be determined based on the target application's direct code invocation request, and can be extracted directly from the request. The target invocation parameters may include the invocation parameters corresponding to the code that needs to invoke the patch file, such as a function name and function parameters, so that the update of the target application can be achieved by invoking the method corresponding to the function name.

[0070] Step 304: In the virtual runtime environment, execute the patch file according to the target call parameters to obtain the target execution result.

[0071] The target execution result is the result obtained by executing the patch file according to the target call parameters in the virtual runtime environment. The target application can update itself using this target execution result. For example, in application A, interface M includes an activity display module. Before the update, the activity display module displayed information about the Mid-Autumn Festival activities. After the Mid-Autumn Festival, application A launched information about National Day activities, which also needs to be displayed in the activity display module. The target application can then execute the patch file according to the target call parameters. The resulting target execution result includes the National Day activity information. The target application can then replace the display of the target execution result in the activity display module of interface M, thereby updating interface M.

[0072] Specifically, after determining the target call parameters, the terminal executes the patch file in the virtual environment according to the target call parameters. For example, it can execute the corresponding code in the patch file according to the parameters specified by the target call parameters to obtain the target execution result.

[0073] Step 306: Return the target execution result to the target application through the virtual runtime environment to update the target application.

[0074] Specifically, after executing the patch file through the virtual runtime environment and obtaining the target execution result, the terminal returns the target execution result to the target application through the virtual runtime environment. The target application then updates itself based on the target execution result. For example, the target application can update its functionality based on the target execution result, thereby achieving the update of the target application.

[0075] In this embodiment, the target application can directly call the patch file for updates through a virtual runtime environment. Specifically, when the virtual runtime environment receives a direct code call request from the target application, it executes the patch file according to the target call parameters and returns the obtained target execution result to the target application through the virtual runtime environment. The target application then updates based on the target execution result. The patch file has the ability to directly call the code of the target application during execution. When the target application directly calls the code of the patch file, there is no need to perform code and parameter conversion, which effectively improves the efficiency of application update processing.

[0076] In one embodiment, the target call parameters include a function name and function parameters; in the virtual runtime environment, the patch file is executed according to the target call parameters to obtain the target execution result, including: determining the method address mapping relationship associated with the patch file based on the patch association data in the patch file through the virtual runtime environment; obtaining the method and address corresponding to the function name from the patch file according to the method address mapping relationship; and executing the instruction corresponding to the method according to the function parameters and address in the virtual runtime environment to obtain the target execution result.

[0077] The target call parameters include the function name and function parameters. The function name is the name of the function that the target application needs to call, and the function parameters serve as the input to the function corresponding to the function name. That is, the function corresponding to the function name needs to be called to execute the function parameters and obtain the corresponding execution result. The patch file can include a patch instruction file and patch-related data. The patch instruction file is the instruction code file for updating the target application, and the patch-related data is data that assists the patch instruction file in updating the target application. This data may include information describing the size of the patch instruction file, constant data within the patch instruction file, architecture data supported by the patch file, function tables, and other various data. The method address mapping records the relationship between various methods defined in the patch file and their corresponding addresses. A method refers to a way to complete a task or implement a function; specifically, it can be a code block that can be called repeatedly. The address is the location of the code corresponding to the method; the address allows the corresponding method to be found and executed.

[0078] Specifically, the determined target call parameters include function names and function parameters. The target application needs to call the function corresponding to the function name and execute it using the function parameters to directly call the patch file. The terminal, through a virtual runtime environment, obtains patch association data from the patch file. This data may include, but is not limited to, data describing the size of the patch instruction file, constant data within the patch instruction file, supported architecture data, function tables, and other data. Specifically, patch association data can be directly extracted from the patch file. Further, the method address mapping relationship associated with the patch file is determined based on this data. The method address mapping relationship records the relationship between various methods defined in the patch file and their corresponding addresses. After obtaining the method address mapping relationship, the terminal retrieves the method and address corresponding to the function name from the patch file based on this mapping relationship. For example, the terminal can use the virtual runtime environment to match the function name in the target call parameters against the method address mapping relationship, and determine the method and address corresponding to the function name in the patch file based on the matching result. In the virtual runtime environment, the terminal executes the instructions corresponding to the method according to the function parameters and address to obtain the target execution result. Specifically, the terminal can import function parameters into the operation stack and execute the corresponding instructions based on the address of the method. These instructions can be assembly instructions, which can then be used by the target application to call and execute the code in the patch file to obtain the target execution result.

[0079] In this embodiment, based on the method address mapping relationship corresponding to the patch file, the method and address corresponding to the function name included in the target call parameters are determined, and the instruction corresponding to the method is executed in the virtual runtime environment according to the function parameters and address in the target call parameters to obtain the target execution result. This enables the target application to directly call the code of the patch file, improving the efficiency of application updates.

[0080] In one embodiment, such as Figure 4 As shown, the process of updating the target application involves updating the target application by directly calling the target application's code when executing the patch file in the virtual runtime environment. This includes:

[0081] Step 402: Send a direct code invocation request to the target application through the virtual runtime environment; the direct code invocation request is used to instruct the target application to execute the corresponding instruction of the direct code invocation request.

[0082] The direct code invocation request is used to instruct the target application to execute the corresponding instructions, thereby enabling direct code invocation of the target application when the patch file is executed in the virtual runtime environment. The patch file has the ability to directly invoke code with the target application during execution; it can directly call the corresponding code in the target application without complex code and parameter conversions. When executing the patch file, if it is necessary to call the target application's code, a direct code invocation request can be sent to the target application through the virtual runtime environment to instruct the target application to execute the corresponding instructions, such as executing the instructions for the corresponding method, thereby achieving direct code invocation of the target application.

[0083] Specifically, when the virtual runtime environment on the terminal executes a patch file, if it needs to call code from the target application—for example, if the patch file only includes updates to the active modules in interface B—then when displaying the entire interface B in the virtual runtime environment, it's necessary to call other code from interface B within the target application to display the complete updated interface B in the virtual runtime environment. In this case, the terminal needs to send a direct code call request to the target application through the virtual runtime environment.

[0084] Step 404: Obtain the target execution result obtained by directly calling the corresponding instruction of the target application's execution code.

[0085] The target execution result is the result obtained by the target application's executable code directly calling the corresponding instruction. The target application can use this target execution result for updates. Specifically, the target application's executable code can directly call the corresponding instruction and return the obtained target execution result to the virtual runtime environment to update the target application.

[0086] Specifically, the terminal obtains the target execution result by directly invoking the target application's execution code through a virtual runtime environment. In practice, after the terminal sends a direct code invocation request to the target application through the virtual runtime environment, the target application can determine the invocation parameters. These parameters are the parameters corresponding to the code of the target application that the virtual runtime environment needs to invoke during the execution of the patch file. The target application invokes the corresponding code according to these parameters and returns the execution result to the virtual runtime environment to update the target application.

[0087] Step 406: In the virtual runtime environment, execute the patch file based on the target execution result to update the target application.

[0088] Specifically, after obtaining the target execution result returned by the target application, the terminal executes the patch file based on the target execution result in the virtual runtime environment, thereby updating the target application. For example, if the patch file is used to update sub-function k2 in function K of target application A, the target application can execute other functions in function K except for function k2 and return the execution result K' to the virtual runtime environment. The virtual runtime environment executes the patch file based on K', thereby adding sub-function k2 from the patch file to the execution result K', obtaining the updated K, and returning the updated K to the target application for function display. Alternatively, the function can be displayed directly in the virtual runtime environment, thus realizing the update processing of the target application.

[0089] In this embodiment, when executing a patch file, the virtual runtime environment can directly call the target application's code for updating. Specifically, when the virtual runtime environment needs to call the target application's code, it sends a direct code invocation request to the target application, obtains the target execution result obtained from the corresponding instructions of the direct code invocation request returned by the target application, and executes the patch file based on the target execution result to update the target application. The patch file has the ability to directly call the target application's code during execution. When executing the patch file, the virtual runtime environment directly calls the target application's code without needing to perform code and parameter conversion, effectively improving the application update processing efficiency.

[0090] In one embodiment, before sending a direct code invocation request to the target application through the virtual runtime environment, the application update method further includes: determining the method address mapping relationship associated with the patch file based on the patch association data in the patch file through the virtual runtime environment; when the method address mapping relationship does not include the currently invoked method, determining the function name and function parameters corresponding to the currently invoked method; generating a direct code invocation request based on the function name and function parameters; the direct code invocation request is used to instruct the target application to execute the instruction corresponding to the currently invoked method according to the function name and function parameters.

[0091] The patch file can include a patch instruction file and patch-related data. The patch instruction file is a code file containing instructions for updating the target application. The patch-related data is data that assists the patch instruction file in updating the target application, and may include data describing the size of the patch instruction file, constant data within the patch instruction file, supported architecture data, function tables, and other data. The method address mapping records the relationship between various methods defined in the patch file and their corresponding addresses. A method refers to a way to solve a problem or implement a function; specifically, it can be a code block that can be called repeatedly. An address is the location of the code corresponding to the method; the address allows you to find the corresponding method and execute it.

[0092] The currently invoked method is the method that needs to be called when executing the patch file. If the method address mapping does not include the currently invoked method, it means that the method to be called cannot be implemented by the virtual runtime environment through executing the patch file, and needs to be executed by the target application. The function name is the name of the function that the target application needs to call, and the function parameters are the input of the function corresponding to the function name. That is, the function corresponding to the function name needs to be called to execute the function parameters and obtain the corresponding execution result.

[0093] Specifically, the terminal obtains patch association data from the patch file through a virtual runtime environment. This patch association data may include, but is not limited to, data describing the size of the patch instruction file, constant data within the patch instruction file, supported architecture data, function tables, and other various data. Specifically, the patch association data can be directly extracted from the patch file. Further, based on this data, the terminal determines the method address mapping relationship associated with the patch file. This method address mapping relationship records the relationship between various methods defined in the patch file and their corresponding addresses. After obtaining the method address mapping relationship, the terminal determines whether the currently called method can be implemented with the patch file, i.e., whether the currently called method is within the method address mapping relationship. If the method address mapping relationship does not include the currently called method, the terminal determines the function name and function parameters corresponding to the currently called method, which can be obtained through analysis of the currently called method. After obtaining the function name and function parameters corresponding to the currently called method, the terminal generates a direct code invocation request based on the function name and function parameters. This request is then sent to the target application, instructing the target application to execute the instructions corresponding to the currently called method according to the function name and function parameters, thereby obtaining the target execution result.

[0094] In this embodiment, when executing a patch file and directly calling the target application's code for updating via a virtual runtime environment, the method address mapping relationship corresponding to the patch file is used. If the method address mapping relationship does not include the currently called method, the function name and function parameters corresponding to the currently called method are determined. A direct code call request is then generated based on the function name and function parameters and sent to the target application. This enables direct code calling of the target application's code during patch file execution and allows for updating of the target application. The patch file has the ability to directly call the target application's code during execution, improving the efficiency of application updates.

[0095] In one embodiment, the application update method further includes: when executing a patch file in a virtual runtime environment and the method address mapping relationship associated with the patch file includes the currently called method, determining the function name and function parameters corresponding to the currently called method; obtaining the method and address corresponding to the function name from the patch file according to the method address mapping relationship; and executing the instructions corresponding to the method according to the function parameters and address in the virtual runtime environment to update the target application.

[0096] The method address mapping records the relationship between various methods defined in the patch file and their corresponding addresses. A method refers to a way to solve a problem or implement a function; specifically, it can be a repeatedly invoked code block. The address is the location of the code corresponding to the method; the address allows locating the corresponding method for execution. The method address mapping can be determined based on patch association data included in the patch file. This patch association data consists of patch instruction files in the auxiliary patch file used to update the target application. The currently invoked method is the method that needs to be called when executing the patch file. If the method address mapping does not include the currently invoked method, it indicates that the method to be called cannot be implemented by the virtual runtime environment through executing the patch file and needs to be executed by the target application. The function name is the name of the function that the currently invoked method needs to call. The function parameters serve as the input to the function corresponding to the function name; that is, the function corresponding to the function name needs to be called to execute the function parameters and obtain the corresponding execution result.

[0097] Specifically, when executing a patch file in a virtual runtime environment, the terminal determines whether the method address mapping associated with the patch file includes the currently called method. This can be done by the terminal obtaining the method address mapping associated with the patch file and matching the currently called method against it. If a match is found, it indicates that the currently called method exists in the method address mapping, meaning the patch file's associated method address mapping includes the currently called method, and the application can be updated by executing the patch file in the virtual runtime environment. The terminal then determines the function name and function parameters corresponding to the currently called method, which can be obtained through function analysis of the currently called method. Based on the method address mapping, the terminal retrieves the method and address corresponding to the function name from the patch file. After obtaining the method and address, the terminal executes the instructions corresponding to the method in the virtual runtime environment based on the function parameters and address, thereby updating the target application.

[0098] In this embodiment, when the currently called method exists in the method address mapping relationship, in the virtual runtime environment, according to the function parameters determined based on the currently called method, the instruction corresponding to the method determined based on the method address mapping relationship is executed, thereby realizing the direct execution of the patch file through the virtual runtime environment to update the target application.

[0099] In one embodiment, the application update method further includes: when executing a patch file in a virtual runtime environment and the method address mapping relationship associated with the patch file includes a target replacement call method, determining the replacement function name and function parameters corresponding to the target replacement call method; obtaining the replacement method and replacement address corresponding to the replacement function name from the patch file according to the method address mapping relationship; executing the instruction corresponding to the replacement method according to the function parameters and replacement address in the virtual runtime environment to obtain the replacement execution result; and returning the replacement execution result to the replacement request end corresponding to the target replacement call method to update the target application.

[0100] The method address mapping records the relationship between various methods defined in the patch file and their corresponding addresses. A method refers to a way to solve a problem or implement a function; specifically, it can be a code block that can be called repeatedly. The address is the location of the code corresponding to the method; the address allows locating the corresponding method for execution. The method address mapping can be determined based on patch association data included in the patch file, which is the data from the patch instruction file in the auxiliary patch file used to update the target application. The target replacement call method is the call method that needs to be replaced when the patch file is executed; that is, the method that needs to be replaced through the virtual runtime environment. The replaced method can be a method of the target application or a method of the patch file executed in the virtual runtime environment. The replacement function name is the name of the function that the target replacement call method needs to call. The function parameters serve as the input to the function corresponding to the replacement function name; that is, the function corresponding to the replacement function name needs to be called to execute the function parameters and obtain the corresponding execution result. The replacement method and replacement address correspond to the replacement function name. The function corresponding to the replacement function name is executed through the replacement method and replacement address to replace the call method. The replacement execution result is the result obtained by replacing the replaced call method with the target replacement call method. The replacement requester is the entity that owns the method being replaced, such as the target application or a patch file. By returning the replacement execution result to the replacement requester corresponding to the target replacement method, the target application is updated via the patch file.

[0101] Specifically, when executing a patch file in a virtual runtime environment, if it is necessary to replace a called method (i.e., replace other called methods with methods in the patch file), the terminal can determine whether the method address mapping associated with the patch file includes the target replacement called method. Specifically, the terminal can obtain the method address mapping associated with the patch file and match the target replacement called method against it. If a match is successful, it indicates that the target replacement called method exists in the method address mapping, meaning the method address mapping associated with the patch file includes the target replacement called method. The application can then be updated by executing the patch file in the virtual runtime environment. In practice, when executing the patch file in the virtual runtime environment, if a request to replace a called method is received (either from the target application or obtained by the virtual runtime environment during patch execution), it is determined that the called method needs to be replaced. The terminal can then determine the corresponding called method to be replaced and the corresponding target replacement called method based on the request, and execute the replacement using the target replacement called method.

[0102] When the method address mapping associated with the patch file includes a target replacement call method, the terminal determines the replacement function name and function parameters corresponding to the target replacement call method. This can be obtained through function analysis of the target replacement call method. Based on the method address mapping, the terminal retrieves the replacement method and replacement address corresponding to the replacement function name from the patch file. After obtaining the replacement method and address, the terminal executes the instructions corresponding to the method in the virtual runtime environment according to the function parameters and replacement address, obtaining the replacement execution result. The terminal returns the obtained replacement execution result to the replacement requesting end corresponding to the target replacement call method, such as returning to the target application or the virtual runtime environment executing the patch file, to update the target application based on the replacement execution result.

[0103] In this embodiment, when the target replacement calling method exists in the method address mapping relationship, in the virtual runtime environment, according to the function parameters determined based on the target replacement calling method, the instruction corresponding to the replacement method determined based on the method address mapping relationship is executed, thereby realizing the replacement execution of the calling method through the patch file in the virtual runtime environment to update the target application.

[0104] In one embodiment, after creating a virtual runtime environment through the target application, the application update method further includes: loading the patch instruction file in the patch file into the virtual runtime environment; determining the architecture parameters corresponding to the patch file; and when the architecture parameters match the platform architecture parameters corresponding to the operating platform, loading the patch association data in the patch file into the virtual runtime environment.

[0105] The patch file includes a patch instruction file and patch association data. The patch instruction file is the instruction code file that updates the target application. The patch association data is data that assists the patch instruction file in updating the target application, and may include data describing the size of the patch instruction file, constant data within the patch instruction file, supported architecture data, function tables, and other data. Architecture parameters indicate the architecture type matched by the patch file; specifically, it can be the architecture type matched by the instruction set. Different architecture types support different instruction sets, meaning different architecture types can correspond to different patch files. The architecture parameters corresponding to a patch file can be determined based on the patch association data within the patch file. Platform architecture parameters are the architecture parameters corresponding to the operating platform running the target application.

[0106] Specifically, after creating a virtual runtime environment (MRU) through the target application, the terminal loads the patch file into the MRU to execute it. The patch file includes a patch instruction file and patch association data. The terminal can load the patch instruction file from the patch file into the MRU, specifically mapping it into the MRU's memory. The terminal determines the architecture parameters corresponding to the patch file, which can be determined based on the patch association data within the patch file. The terminal determines the platform architecture parameters corresponding to the operating platform running the target application, comparing the patch file's architecture parameters with the platform architecture parameters. If the patch file's architecture parameters match the platform architecture parameters, it indicates that the patch file matches the operating platform. The terminal then loads the patch association data from the patch file into the MRU so that the patch instruction file can be executed within the MRU based on the patch association data, thereby updating the application through the patch file.

[0107] In this embodiment, before executing the patch file in the virtual runtime environment, the patch instruction file and patch association data in the patch file are loaded into the virtual runtime environment so that the patch instruction file can be executed in the virtual runtime environment based on the patch association data, thereby realizing the application update process through the patch file.

[0108] In one embodiment, the patch file is obtained through a patch compilation step, which includes: obtaining patch code for the target application compiled in the target programming language; the code compiled in the target programming language having the ability to directly call code with the target application during execution; compiling the patch code based on the instruction set to obtain a patch instruction file; and generating a patch file for the target application based on the patch instruction file.

[0109] In this context, the programming language refers to the language used to write program code, and the target programming language is the language used to write the code corresponding to the patch file. The code written in the target programming language has the ability to directly call code from the target application at runtime, thus ensuring that the patch code written in the target programming language can directly call code from the target application at runtime. The patch code is a code file written in the target programming language specifically for the target application. For example, if the target programming language is Objective-C, the patch code could be an Objective-C code file written in Objective-C to update the target application.

[0110] An instruction is a command that instructs computer hardware to perform a certain operation or processing function. An instruction set is a collection of instructions used by the central processing unit (CPU) of a computer to calculate and control the computer system. Different hardware has different instruction set architectures, and matching the instruction set with the hardware can effectively ensure the processing efficiency of the instructions. In specific implementation, the instruction set needs to provide sufficient functional support so that patch code can be compiled to generate the corresponding assembly instruction combination, ensuring that the patch code can achieve the required functions. The core idea of ​​instruction set design is to enable the virtual runtime environment to run as quickly as possible, so each instruction should be as short as possible. This not only reduces the size of the program but also allows the virtual runtime environment to fetch instructions faster. Instructions in the instruction set can be constructed from various types of instructions, such as immediate value instructions, movement instructions, addition and subtraction instructions, jump instructions, bitwise operation instructions, call instructions, null instructions, and program termination instructions.

[0111] Specifically, patch files are obtained through a patch compilation process, which can be executed on the compilation terminal to distribute the resulting patch files to the terminal via a server. During patch file generation, the compilation terminal can obtain patch code for the target application, written in the target programming language. The patch compiler can then use the target programming language on the compilation terminal to compile the patch code for the target application. The code written in the target programming language has the ability to directly call code from the target application at runtime. Specifically, the compilation terminal can determine the programming language corresponding to the target application and write the patch code in that matching language, ensuring that the patch file has the ability to directly call code from the target application at runtime. For example, the target programming language can be the same as the programming language corresponding to the target application; that is, writing the patch code in the target application's corresponding programming language ensures that the patch file has the ability to directly call code from the target application at runtime.

[0112] The terminal determines a pre-defined instruction set and compiles the patch code using this set to obtain a patch instruction file. This file contains instruction code for updating the target application. Compiling the patch code allows the generation of corresponding instruction combinations, such as assembly instruction combinations. The terminal then generates a patch file for the target application based on the patch instruction file. Specifically, it determines the patch association data corresponding to the patch instruction file and generates the patch file for the target application based on the patch instruction file and the corresponding patch association data. In practice, after obtaining the patch association data corresponding to the patch instruction file, the patch instruction file and the corresponding patch association data can be packaged together to obtain the patch file for the target application.

[0113] In this embodiment, the compilation terminal that performs the patch compilation steps compiles the patch code written in the target programming language based on the instruction set, and generates a patch file for the target application according to the patch instruction file, thereby obtaining a patch file that has the ability to directly call the code of the target application during execution. Updating the target application through this patch file can improve the update efficiency of the target application.

[0114] In one embodiment, compiling the patch code based on an instruction set to obtain a patch instruction file includes: precompiling the patch code to obtain a precompilation result; performing lexical analysis and syntax analysis sequentially based on the precompilation result; obtaining the analysis result; and when the analysis result is satisfactory, compiling the precompilation result using the instruction set to obtain the patch instruction file.

[0115] The pre-compilation process involves processing the patch code before compilation, including but not limited to header file imports and macro substitutions. The pre-compilation result is the result of this pre-processing. Lexical analysis converts the input code into lexical units conforming to the corresponding programming language, which can include keywords, operators, variables, etc. The input code is marked and segmented into different symbols, along with the corresponding positions of each code segment. Syntax analysis transforms the lexically analyzed code into a syntax tree. After transformation, static analysis is performed to identify non-syntactic errors to ensure code accuracy. The analysis result is the result of sequentially performing lexical and syntax analysis on the pre-compiled result. If the analysis result is successful, it indicates that the patch code contains no lexical or syntax errors and can be compiled.

[0116] Specifically, the development terminal performs pre-compilation processing on the patch code, such as macro substitution and header file substitution, to obtain a pre-compiled result. The development terminal then performs lexical and syntactic analysis on the pre-compiled result to ensure the accuracy of the patch code, obtaining the analysis results. If the analysis result is satisfactory, it indicates that there are no lexical or syntactic errors in the patch code. The development terminal then compiles the pre-compiled result using a preset instruction set, converting each code in the pre-compiled result into corresponding instructions in the preset instruction set, resulting in a patch instruction file. The patch instruction file includes the corresponding instructions in the preset instruction set for each code in the patch code.

[0117] In this embodiment, the patch code is pre-compiled, and the pre-compiled result is sequentially subjected to lexical analysis and syntax analysis. When the analysis result is satisfactory, the pre-compiled result is compiled using a preset instruction set to obtain a patch instruction file. This ensures that the patch code is compiled into an accurate instruction set for updating the target application.

[0118] In one embodiment, generating a patch file for a target application based on a patch instruction file includes: determining patch association data corresponding to the patch instruction file; and generating a patch file for the target application based on the patch instruction file and the patch association data.

[0119] The patch association data is data that assists the patch instruction file in updating the target application. It may include data describing the size of the patch instruction file, constant data within the patch instruction file, supported architecture data, function tables, and other various data. Specifically, after compiling the patch instruction file, the development terminal can determine the patch association data corresponding to the patch instruction file. This can be done by parsing the patch instruction file to determine the corresponding patch association data, such as data determining the size of the patch instruction file, constant data within the patch instruction file, supported architecture data, function tables, and other various data. After obtaining the patch association data corresponding to the patch instruction file, the development terminal generates a patch file for the target application based on the patch instruction file and the patch association data. Specifically, the patch instruction file and the patch association data can be packaged together to obtain the patch file for the target application.

[0120] In this embodiment, a patch file for the target application is generated based on the patch instruction file and the corresponding associated patch association data. This allows the patch instruction file to be executed in a virtual runtime environment based on the patch association data, thereby enabling the update of the target application through the patch file.

[0121] In one embodiment, when the update conditions for the target application are met, obtaining a patch file for the target application includes: when an update task for the target application is detected, obtaining a patch file for the target application that matches the platform architecture parameters of the operating platform from the server.

[0122] Meeting the update conditions for the target application means detecting an update task for that application. In practice, after running the target application on the operating platform, the terminal can check if a patch file exists on the server. It then determines if the patch file is compatible with the current operating platform version and the target application version, and whether the patch file has expired. If all checks pass, an update task for the target application is detected, and the application needs to be updated. Specifically, the terminal monitors whether the update conditions for the target application are met, specifically checking for the existence of an update task. This includes checking if a patch file exists on the server, whether the existing patch file is compatible with the current operating platform version and the target application version, and whether the patch file is valid. If all checks pass, an update task for the target application is confirmed. The terminal retrieves a patch file from the server that matches the platform architecture parameters of the operating platform and is compatible with the target application. This can be done by downloading the patch file from the server; the patch file matches the platform architecture parameters, allowing the target application to be updated using this patch file. In practice, when the terminal obtains the patch file from the server, the server can determine the platform architecture parameters of the operating platform on the terminal, determine the architecture type of the operating platform on the terminal based on the platform architecture parameters, and then send the patch file that matches the architecture type of the operating platform on the terminal to the terminal for application update.

[0123] Furthermore, when executing the patch file in the virtual runtime environment, before updating the target application by directly calling the target application's code, the application update method also includes: verifying the patch file; and when the verification result is successful, executing the step of updating the target application by directly calling the target application's code when executing the patch file in the virtual runtime environment.

[0124] Specifically, after obtaining the patch file from the server, the terminal can verify the obtained patch file, such as through a hash algorithm. If the verification result is successful, it indicates that the obtained patch file is a normal file and can be used for application updates. When the terminal executes the patch file in the virtual runtime environment, it updates the target application by directly calling the target application's code, thus updating the target application using the patch file. In practice, if the patch file verification result is unsuccessful, the terminal can re-obtain the patch file from the server until verification is successful, and then execute the corresponding patch file to update the target application.

[0125] In this embodiment, when an update task for the target application is detected, a patch file is obtained from the server and verified. If the verification is successful, the patch file is executed in the virtual runtime environment to update the target application by directly calling the code of the target application.

[0126] This application also provides an application scenario in which the above-described application update method is applied. Specifically, the application update method is applied in this scenario as follows:

[0127] In app operation, continuous updates are necessary to meet the ever-growing needs of users. On iOS, once an app is released, it cannot be modified by distributing new code. Any modifications must be reviewed and approved by the App Store before a new version can be released and updated on users' devices. Therefore, when an app encounters serious problems, the time cost of updating and fixing these issues is very high, resulting in low update efficiency.

[0128] Application dynamics refers to bypassing the application release and review stages by distributing executable files from a server, allowing executable code to run directly within the application to implement new requirements or fix urgent issues. Dynamics enable application updates without requiring re-downloading. On iOS, dynamics are currently achieved using the built-in JavaScriptCore engine and the runtime features of Objective-C Runtime. Patch files are written in JavaScript, and after the server distributes the patch files, the application loads them and adds or replaces Objective-C methods, thus updating the application. Objective-C is the programming language used for iOS development. OC-Runtime refers to the runtime features provided by Objective-C, meaning that Objective-C method calls are not determined at compile time but at runtime. This feature enables operations such as message forwarding, redirection, and dynamic method resolution. JavaScript is a scripting language.

[0129] Specifically, after the application reads the patch file, it passes the class name and function name to be called from the JS code to Objective-C, and then uses the dynamically invoked methods in Objective-C to call the corresponding code, thereby realizing the ability to meet dynamic requirements. For example... Figure 5 As shown, in the process of updating the application based on the patch file, it is necessary to sequentially convert the metafunction, convert the JS parameters, convert the string to a class, call the method, convert the obtained OC parameters to JS parameters, call the JS method, obtain and convert the OC return value, and process the return value through JS. In other words, it is necessary to continuously communicate back and forth between JS and OC and continuously convert parameters. Calling a method requires 8 steps to be successfully called, which is inefficient.

[0130] Meanwhile, when debugging patch code, the complex call process of each method can make debugging difficult when problems arise and need to be located. Furthermore, JavaScript uses Garbage Collection (GC), where the garbage collector periodically identifies unused variables and releases their memory. iOS, on the other hand, uses Automatic Reference Count (ARC), which releases an object when its reference count reaches zero. These different mechanisms can easily lead to memory not being released in a timely manner or being released prematurely, causing strange crashes that are difficult to locate and resolve. Additionally, iOS developers need to use JavaScript to write patch files, rather than Objective-C, the language commonly used for iOS application development. This presents a challenge during development, increasing the likelihood of programming problems and impacting application update efficiency.

[0131] Based on this, the application update method in this embodiment adopts the approach of directly writing patch files using Objective-C, compiling the files into specific patch files through a specific compilation module, specifically a custom Clang compiler, and then creating a virtual machine through the application to parse and execute the instructions in the patch files, thereby achieving dynamic updates of the application. The Clang compiler is a compiler front-end for programming languages ​​such as C, C++, Objective-C, and Objective-C++.

[0132] Specifically, on the development side, patch files need to be generated so that the server can send them to the terminal to update the application. For example... Figure 6 As shown, the patch file compilation process includes an input step, a preprocessing step, a compilation step, and a patch file generation step. In the input step, the patch file compiler obtains the code file, which is written in Objective-C. Specifically, after writing the Objective-C file, it is compiled. In the preprocessing step, macros in the Objective-C file are replaced, relevant header files are imported, and other preprocessor directives are processed to generate intermediate code. In the compilation step, the Objective-C file is compiled to generate intermediate code, and lexical and syntax analysis are performed. Lexical analysis converts the input code into a series of lexical units conforming to Objective-C. These lexical units include keywords, operators, variables, etc., and the code is marked and segmented into different symbols and their corresponding positions. Syntax analysis converts the lexical-analyzed code into a syntax tree. After the conversion, static analysis is performed to find non-syntactic errors. If no errors are found, assembly code is generated; otherwise, a compilation error occurs.

[0133] To ensure that Objective-C code can be successfully linked and executed in a virtual machine running on the client, a complete set of assembly instructions needs to be defined. This instruction set must provide sufficient functionality to allow Objective-C code to be compiled into the corresponding assembly instruction combinations, ensuring that the Objective-C code can achieve the required functions. The core idea behind the assembly instruction set design is to enable the virtual machine to run as quickly as possible; therefore, each instruction should be as short as possible. This not only reduces the program size but also allows the virtual machine to fetch instructions more quickly.

[0134] The specific instructions can be divided into six main categories: immediate instructions, movement instructions, addition and subtraction instructions, jump instructions, bitwise operation instructions, and call instructions. In addition, two special instructions can be set: a null instruction, which means doing nothing; and a program termination instruction, which means the virtual machine program terminates. The instruction set has a total of 180 instructions, including floating-point operations and stack instructions. For the assembly instruction set, further optimizations can be made, specifically by making the bytecode of these instructions more regular to avoid extra operations for reading and decoding. For example, a 1-byte opcode can also be stored as 1 byte by concatenating 4 bits each in two registers. Unlike the reduced instruction set, the instructions in the assembly instruction set are not fixed-length, but rather between 1 and 6 bytes. This saves a significant amount of space, as short instructions do not require extra space, and long instructions can be stored together with short instructions, thus reducing space waste.

[0135] Furthermore, iOS currently uses an armv7+arm64 architecture. Both armv7 and arm64 are based on the ARM architecture. ARM architectures are backward compatible; for example, arm64 is compatible with armv7. However, armv7 cannot utilize some arm64 features, preventing the full performance of the arm64 instruction set from being realized. Therefore, considering that performance is the most crucial element of a virtual machine, two instruction sets can be designed: one for arm64 and one for armv7. This ensures that all patch files can achieve maximum performance on their respective architectures. Alternatively, two virtual machines can be set up: one supporting armv7 and one supporting arm64. Theoretically, there is no practical difference between the two; the only difference lies in the design of the assembly instruction set. This is because armv7, representing a 32-bit architecture, can only process 32 bits (4 bytes) of data at a time, while arm64, representing a 64-bit architecture, can process 64 bits (8 bytes) of data.

[0136] When a component includes two architectures, it inevitably leads to an increase in package size. However, the XC Framework provided by Xcode for iOS can distribute different architecture packages according to the different architectures of the current device, thereby solving the problem of still holding an armv7 architecture virtual machine on arm64, which leads to an increase in package size.

[0137] In practical applications, arm64 instructions can include Push and Pop instructions for virtual machine stack operations. The specific operations are as follows:

[0138] push value 5

[0139] push value 7

[0140] add

[0141] The specific process involves pushing 5 and 7 onto the stack in sequence, then performing the add summation operation. The add summation operation involves popping the corresponding numbers off the stack, performing the addition calculation, and then pushing the result back onto the stack. Finally, the top of the stack will contain the final result, 12.

[0142] For example, the Jump instruction is used to implement flow control syntax such as if / else, which can jump to the corresponding instruction; addition, subtraction, multiplication, and division instructions are used to implement basic operations; logical operation instructions are used to implement basic operations; shift instructions are used to implement basic operations; and the Objective-C method call instruction is used to call Objective-C methods, which the virtual machine can use to implement the call using the Objective-C Rumtine.

[0143] Furthermore, after the Objective-C code is compiled, an assembler will be generated, which contains combinations of assembly instructions. In one embodiment, the content of the assembler is as follows:

[0144] address1: push value 1

[0145] address2: push value 2

[0146] address3:add

[0147] address4: jump address6

[0148] address6:call "someOCMethod"

[0149] ...

[0150] Address100:end

[0151] This assembler can be used to execute the code corresponding to the patch file.

[0152] Furthermore, after generating the patch assembly code, the associated patch data is written to a memory data segment, and the data in memory corresponding to the patch is converted into a binary file to obtain a binary patch file. Specifically, when generating the patch file, it is necessary to convert text instructions into binary instructions (code_data); a function table (a_map) is needed to record the relationship between methods defined in the patch code and their addresses; the size of the data segment (data_size) needs to be recorded; the size of the global area (zone_size) needs to be recorded; the architecture used (arch) needs to be recorded; and constant data (const) needs to be recorded to obtain the patch data. Each piece of data in the patch data is stored in the corresponding data segment in memory, and then the entire memory segment is converted into a binary file. This file is the final patch file, which can be uploaded to the deployment server and provided to clients for download to update applications based on the patch file.

[0153] When the client updates the application via patch files, such as Figure 7 As shown, when loading the patch file, after running the target application, the network connection is checked. If the network is connected, the patch file is retrieved from the server. After the patch file is successfully downloaded, the patch assembly code in the patch file is mapped into the virtual machine's memory to determine if the architecture is correct. If so, the patch-related data in the patch file is loaded into memory, thus loading the patch file into the virtual machine for execution. Specifically, after the target application runs, it checks if the server has the patch, whether the patch is applicable to the current system version and application version, and whether the patch has expired. If all checks pass, the patch is downloaded directly. After downloading, the patch is verified using a hash algorithm, such as MD5 (MD5 Message-Digest Algorithm). If the verification is successful, the patch is loaded.

[0154] A virtual machine is created within the application to provide a runtime environment for patch files. This virtual machine can be created directly within the application. Because code cannot be arbitrarily marked as executable on iOS, dynamically distributed code cannot run directly due to a lack of execution permissions. By building a virtual machine, a virtual environment is provided where Objective-C code can run. Once the patch file is loaded into the virtual machine, it gains execution permissions and can then execute the patch code to update the application. During loading, the application's built-in virtual machine first maps the patch assembly code from the patch file into memory. It then retrieves the `arch` field of the patch file and matches it against the current system architecture. If a match is found, loading continues. Next, it retrieves the `zone_size` field of the patch file and allocates a corresponding memory block to load various data segments into memory, including fields such as `const`, `a_map`, and `code_data`. This allows the virtual machine to execute operations on the patch file.

[0155] When a patch file needs to be executed, for example, if a module has an error (such as an array out-of-bounds error), the application might crash when accessing the relevant page for that module. In this case, a patch file needs to be issued to fix the issue (e.g., fixing the array out-of-bounds problem). After the application pulls and loads the patch file, it will function normally when accessing the relevant page for that module, without crashing. This addresses the application crash issue and enables hot-fixing capabilities. Similarly, when issuing urgent dynamic operational activities, a patch file can be used to add relevant requirement code. Users can then view the new dynamic operational requirements on the corresponding page without updating the application. Figure 8 As shown, for the opening screen of an application, the page layout and page resource content can be updated through patch files. Figure 8 In the previous version, the opening remarks settings interface included personal recording and assistant voice opening remarks functions; while the layout of the page has changed accordingly after the update, and the opening remarks settings interface now includes prominent opening remarks, personal recording, and other opening remarks functions.

[0156] Specifically, when executing the patch file, if it is necessary to call virtual machine methods through the original Objective-C code on the native side, such as... Figure 9As shown, Objective-C code passes the function name and parameters to the virtual machine through a virtual machine method. The virtual machine can then execute the function and return a result. Specifically, when the virtual machine receives the function name, it searches for the `a_map` (which records the methods and addresses defined in the patch code) in the patch file, finds the method and address corresponding to the function name, adds the data corresponding to the passed parameter address to the operand stack, and begins executing the assembly instructions for that method. After the virtual machine has executed all the assembly instructions for that method, it copies the return value from the operand stack to the caller's return value address, thus realizing the operation of Objective-C calling the virtual machine method. The native side is the operating platform side running the target application.

[0157] If you need to call Objective-C methods through the virtual machine, such as Figure 10 As shown, when the virtual machine receives a method call from a class, it first checks if the method is defined in a_map. If not, it searches for the class, executes the corresponding function in the class, passes the parameters, and starts executing the native Objective-C code on the native side. After the native Objective-C code finishes executing, it returns the result to the virtual machine and passes it to the corresponding code for execution.

[0158] If mutual calls between virtual machine methods are required, such as Figure 11 As shown, when called before the virtual machine, the function is first searched in `a_map` during the method call. Once found, it is executed, and the return result is obtained. If you need to replace the Objective-C method with the virtual machine, such as... Figure 12 As shown, if a method of a class needs to be replaced, it is essentially an Objective-C / virtual machine calling a virtual machine method. When a call is needed, the system first checks if the corresponding function exists in a_map. If it does, the call to that method is redirected using the runtime features of the Objective-C Runtime. The virtual machine retrieves the parameters and calls the corresponding virtual machine method. Finally, the return value is returned to the Objective-C Runtime, and the result is copied to the return result of the original method, thus realizing the process of replacing the method call.

[0159] In this embodiment, patch files are written directly in Objective-C. A custom Clang compiler compiles these files into specific patch files, and a virtual machine created within the application parses and executes the instructions in the patch files. Leveraging the runtime characteristics of Objective-C, the relevant patch code is executed, thereby achieving dynamic update and repair management on iOS. During application updates, frequent code conversion between JavaScript and Objective-C is avoided, allowing direct manipulation of memory addresses with extremely high efficiency, approaching native code calls. Furthermore, developers writing patch files in Objective-C improve patch file generation efficiency. In addition, the application update process reduces the patch call chain, enabling accurate problem location, and the use of ARC memory management, consistent with native memory management mechanisms, reduces crashes caused by memory issues.

[0160] It should be understood that, although Figure 2 , Figure 3 , Figure 4 , Figure 6 and Figure 7 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 , Figure 3 , Figure 4 , Figure 6 and Figure 7 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.

[0161] In one embodiment, such as Figure 13 As shown, an application update device 1300 is provided. This device can be a software module, a hardware module, or a combination of both, integrated into a computer device. Specifically, the device includes: an application execution module 1302, a patch file acquisition module 1304, a virtual runtime environment creation module 1306, and a patch file execution module 1308, wherein:

[0162] Application runtime module 1302 is used to run the target application on the operating platform;

[0163] The patch file acquisition module 1304 is used to acquire patch files for the target application when the update conditions of the target application are met; wherein, the patch file has the ability to directly call the code of the target application at runtime;

[0164] The virtual runtime environment creation module 1306 is used to create a virtual runtime environment through the target application when the patch file does not have the execution permissions to be executed on the operating platform.

[0165] The patch file execution module 1308 is used to update the target application by directly calling the target application's code when executing patch files in a virtual runtime environment.

[0166] The aforementioned application update device, when meeting the update conditions of the target application running on the operating platform, obtains a patch file capable of directly calling the target application's code during execution. If the patch file lacks execution permissions on the operating platform, it executes the patch file within a virtual runtime environment created using the target application. During execution, the target application is updated through direct code calls. In the application update process, by creating a virtual runtime environment to execute patch files that lack execution permissions on the operating platform, and by ensuring that these patch files can directly call the target application's code without code conversion, dynamic updates of applications on operating platforms lacking execution permissions are achieved using patch files, thus improving application update efficiency.

[0167] In one embodiment, the patch file execution module 1308 includes a target call parameter determination module, a target execution result acquisition module, and a target execution result processing module; wherein: the target call parameter determination module is used to determine the target call parameters when a direct code call request of the target application is received through the virtual runtime environment; the target execution result acquisition module is used to execute the patch file according to the target call parameters in the virtual runtime environment to obtain the target execution result; and the target execution result processing module is used to return the target execution result to the target application through the virtual runtime environment to update the target application.

[0168] In one embodiment, the target call parameters include a function name and function parameters; the target execution result acquisition module includes a method address mapping relationship determination module, a method address acquisition module, and a method instruction execution module; wherein: the method address mapping relationship determination module is used to determine the method address mapping relationship associated with the patch file based on the patch association data in the patch file through a virtual runtime environment; the method address acquisition module is used to obtain the method and address corresponding to the function name from the patch file according to the method address mapping relationship; the method instruction execution module is used to execute the instruction corresponding to the method according to the function parameters and address in the virtual runtime environment to obtain the target execution result.

[0169] In one embodiment, the patch file execution module 1308 includes a direct call request sending module, a target execution result acquisition module, and a target execution result execution module; wherein: the direct call request sending module is used to send a code direct call request to the target application through a virtual runtime environment; the code direct call request is used to instruct the target application to execute the corresponding instruction of the code direct call request; the target execution result acquisition module is used to acquire the target execution result obtained by the target application executing the corresponding instruction of the code direct call request; and the target execution result execution module is used to execute the patch file based on the target execution result in the virtual runtime environment to update the target application.

[0170] In one embodiment, the system further includes a patch association data processing module, a function determination module, and a request generation module; wherein: the patch association data processing module is used to determine the method address mapping relationship associated with the patch file based on the patch association data in the patch file through a virtual runtime environment; the function determination module is used to determine the function name and function parameters corresponding to the currently called method when the method address mapping relationship does not include the currently called method; the request generation module is used to generate a code direct call request based on the function name and function parameters; the code direct call request is used to instruct the target application to execute the instruction corresponding to the currently called method according to the function name and function parameters.

[0171] In one embodiment, the system further includes a method function determination module, a target method address acquisition module, and a target method address processing module; wherein: the method function determination module is used to determine the function name and function parameters corresponding to the currently called method when a patch file is executed in a virtual runtime environment and the method address mapping relationship associated with the patch file includes the currently called method; the target method address acquisition module is used to obtain the method and address corresponding to the function name from the patch file according to the method address mapping relationship; and the target method address processing module is used to execute the instructions corresponding to the method according to the function parameters and address in the virtual runtime environment to update the target application.

[0172] In one embodiment, the system further includes a replacement function determination module, a replacement method determination module, a replacement execution result acquisition module, and a replacement execution result processing module; wherein: the replacement function determination module is used to determine the replacement function name and function parameters corresponding to the target replacement call method when the patch file is executed in the virtual runtime environment and the method address mapping relationship associated with the patch file includes the target replacement call method; the replacement method determination module is used to obtain the replacement method and replacement address corresponding to the replacement function name from the patch file according to the method address mapping relationship; the replacement execution result acquisition module is used to execute the instruction corresponding to the replacement method according to the function parameters and replacement address in the virtual runtime environment to obtain the replacement execution result; and the replacement execution result processing module is used to return the replacement execution result to the replacement request end corresponding to the target replacement call method to update the target application.

[0173] In one embodiment, the system further includes an instruction file loading module, an architecture parameter determination module, and an associated data loading module; wherein: the instruction file loading module is used to load the patch instruction file in the patch file into the virtual runtime environment; the architecture parameter determination module is used to determine the architecture parameters corresponding to the patch file; and the associated data loading module is used to load the patch associated data in the patch file into the virtual runtime environment when the architecture parameters match the platform architecture parameters corresponding to the operating platform.

[0174] In one embodiment, the system further includes a patch code acquisition module, a compilation processing module, and a patch file generation module; wherein: the patch code acquisition module is used to acquire patch code for the target application written in the target programming language; the code written in the target programming language has the ability to directly call the code of the target application during execution; the compilation processing module is used to compile the patch code based on the instruction set to obtain a patch instruction file; and the patch file generation module is used to generate a patch file for the target application based on the patch instruction file.

[0175] In one embodiment, the compilation processing module includes a pre-compilation module, an analysis module, and an instruction set compilation module; wherein: the pre-compilation module is used to pre-compile the patch code to obtain a pre-compilation result; the analysis module is used to perform lexical analysis and syntax analysis sequentially based on the pre-compilation result to obtain the analysis result; the instruction set compilation module is used to compile the pre-compilation result using the instruction set when the analysis result is passable to obtain a patch instruction file.

[0176] In one embodiment, the patch file generation module includes an association data determination module and a data packaging module; wherein: the association data determination module is used to determine the patch association data corresponding to the patch instruction file; the data packaging module is used to generate a patch file for the target application based on the patch instruction file and the patch association data.

[0177] In one embodiment, the patch file acquisition module 1304 is further configured to acquire a patch file from the server that is for the target application and matches the platform architecture parameters of the operating platform when an update task for the target application is detected; it also includes a verification module, configured to verify the patch file, and when the verification result is that the verification passes, execute the patch file in the virtual runtime environment, and update the target application by directly calling the code of the target application.

[0178] Specific limitations regarding the application update device can be found in the limitations of the application update method described above, and will not be repeated here. Each module in the aforementioned application update device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.

[0179] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 14 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an application update method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0180] Those skilled in the art will understand that Figure 14 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0181] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0182] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0183] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0184] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0185] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0186] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. An application update method, characterized in that, The method includes: Run the target application on the operating platform; When the update conditions of the target application are met, a patch file for the target application is obtained; wherein, the patch file has the ability to directly call code with the target application at execution time; the patch file is obtained through a patch compilation step, which includes: obtaining patch code for the target application compiled in a target programming language; the code compiled in the target programming language has the ability to directly call code with the target application at execution time; compiling the patch code based on an instruction set to obtain a patch instruction file; and generating a patch file for the target application based on the patch instruction file. When the patch file does not have execution permissions on the operating platform, a virtual runtime environment is created through the target application; When the patch file is executed in the virtual runtime environment, the direct calls between the patch file and the target application will vary depending on the updated content in the patch file, including: When the target application directly calls the code in the patch file, upon receiving a direct code call request from the target application through the virtual runtime environment, target call parameters are determined; the patch file is executed according to the target call parameters in the virtual runtime environment to obtain the target execution result; the target execution result is returned to the target application through the virtual runtime environment to update the target application. When the patch file directly calls the target application's code, a direct code call request is sent to the target application through the virtual runtime environment; the direct code call request is used to instruct the target application to execute the corresponding instruction of the direct code call request; the target execution result obtained by the target application executing the corresponding instruction of the direct code call request is obtained; in the virtual runtime environment, the patch file is executed based on the target execution result to update the target application.

2. The method according to claim 1, characterized in that, The target invocation parameters include a function name and function parameters; the step of executing the patch file according to the target invocation parameters in the virtual runtime environment to obtain the target execution result includes: Using the virtual runtime environment, the method address mapping relationship associated with the patch file is determined based on the patch association data in the patch file; Based on the method address mapping relationship, obtain the method and address corresponding to the function name from the patch file; In the virtual runtime environment, the instructions corresponding to the method are executed according to the function parameters and the address to obtain the target execution result.

3. The method according to claim 1, characterized in that, Before sending a direct code invocation request to the target application through the virtual runtime environment, the method further includes: Using the virtual runtime environment, the method address mapping relationship associated with the patch file is determined based on the patch association data in the patch file; When the method address mapping does not include the currently called method, determine the function name and function parameters corresponding to the currently called method; A code direct call request is generated based on the function name and the function parameters; the code direct call request is used to instruct the target application to execute the instruction corresponding to the currently called method according to the function name and the function parameters.

4. The method according to claim 1, characterized in that, The method further includes: When the patch file is executed in the virtual runtime environment, and the method address mapping relationship associated with the patch file includes the currently called method, the function name and function parameters corresponding to the currently called method are determined. Based on the method address mapping relationship, obtain the method and address corresponding to the function name from the patch file; In the virtual runtime environment, the instructions corresponding to the method are executed according to the function parameters and the address to update the target application.

5. The method according to claim 1, characterized in that, The method further includes: When the patch file is executed in the virtual runtime environment, and the method address mapping relationship associated with the patch file includes the target replacement call method, the replacement function name and function parameters corresponding to the target replacement call method are determined; Based on the method address mapping relationship, the replacement method and replacement address corresponding to the replacement function name are obtained from the patch file; In the virtual runtime environment, the instructions corresponding to the replacement method are executed according to the function parameters and the replacement address to obtain the replacement execution result; The replacement execution result is returned to the replacement request end corresponding to the target replacement invocation method to update the target application.

6. The method according to claim 1, characterized in that, After creating the virtual runtime environment through the target application, the method further includes: Load the patch instruction file from the patch file into the virtual runtime environment; Determine the architecture parameters corresponding to the patch file; When the architecture parameters match the platform architecture parameters corresponding to the operating platform, the patch association data in the patch file is loaded into the virtual runtime environment.

7. The method according to claim 1, characterized in that, The patch code is compiled based on the instruction set to obtain a patch instruction file, including: The patch code is pre-compiled to obtain the pre-compiled result; Based on the pre-compiled results, lexical analysis and syntax analysis are performed sequentially to obtain the analysis results; When the analysis result is passed, the pre-compiled result is compiled using the instruction set to obtain the patch instruction file.

8. The method according to claim 1, characterized in that, The step of generating a patch file for the target application based on the patch instruction file includes: Determine the patch association data corresponding to the patch instruction file; Based on the patch instruction file and the patch association data, a patch file for the target application is generated.

9. The method according to any one of claims 1 to 8, characterized in that, When the update conditions for the target application are met, obtaining the patch file for the target application includes: When an update task for the target application is detected, a patch file for the target application that matches the platform architecture parameters of the operating platform is obtained from the server; When executing the patch file in the virtual runtime environment, before updating the target application by directly calling the target application's code, the method further includes: The patch file is verified. When the verification result is successful, the patch file is executed in the virtual runtime environment. The target application is updated by directly calling the code of the target application.

10. An application update device, characterized in that, The device includes: The patch code acquisition module is used to acquire patch code for the target application written in the target programming language; the code written in the target programming language has the ability to directly call the code of the target application at execution time; The compilation processing module is used to compile the patch code based on the instruction set to obtain a patch instruction file; A patch file generation module is used to generate a patch file for the target application based on the patch instruction file; The application runtime module is used to run the target application on the operating platform; The patch file acquisition module is used to acquire a patch file for the target application when the update conditions of the target application are met; wherein the patch file has the ability to directly call the code of the target application at runtime; A virtual runtime environment creation module is used to create a virtual runtime environment through the target application when the patch file does not have the execution permission to execute on the operating platform. The patch file execution module is used to, when executing the patch file in the virtual runtime environment, generate different direct call interactions with the target application based on the different updated content in the patch file. These interactions include: when the target application directly calls the code in the patch file, upon receiving a direct code call request from the target application through the virtual runtime environment, determining target call parameters; executing the patch file in the virtual runtime environment according to the target call parameters to obtain a target execution result; returning the target execution result to the target application through the virtual runtime environment to update the target application; when the patch file directly calls the code in the target application, sending a direct code call request to the target application through the virtual runtime environment; the direct code call request instructing the target application to execute the corresponding instruction of the direct code call request; obtaining the target execution result obtained by the target application executing the corresponding instruction of the direct code call request; and executing the patch file in the virtual runtime environment based on the target execution result to update the target application.

11. The application update device according to claim 10, characterized in that, The target call parameters include a function name and function parameters; the patch file execution module includes a method address mapping relationship determination module, a method address acquisition module, and a method instruction execution module; wherein: the method address mapping relationship determination module is used to determine the method address mapping relationship associated with the patch file based on the patch association data in the patch file through the virtual runtime environment; the method address acquisition module is used to obtain the method and address corresponding to the function name from the patch file according to the method address mapping relationship; the method instruction execution module is used to execute the instruction corresponding to the method according to the function parameters and the address in the virtual runtime environment to obtain the target execution result.

12. The application update device according to claim 10, characterized in that, The device further includes a patch association data processing module, a function determination module, and a request generation module; wherein: the patch association data processing module is used to determine the method address mapping relationship associated with the patch file based on the patch association data in the patch file through the virtual runtime environment; the function determination module is used to determine the function name and function parameters corresponding to the currently called method when the method address mapping relationship does not include the currently called method; the request generation module is used to generate a code direct call request based on the function name and the function parameters; the code direct call request is used to instruct the target application to execute the instruction corresponding to the currently called method according to the function name and the function parameters.

13. The application update device according to claim 10, characterized in that, The device further includes a method function determination module, a target method address acquisition module, and a target method address processing module; wherein: the method function determination module is used to determine the function name and function parameters corresponding to the currently called method when the patch file is executed in the virtual runtime environment and the method address mapping relationship associated with the patch file includes the currently called method; the target method address acquisition module is used to obtain the method and address corresponding to the function name from the patch file according to the method address mapping relationship; the target method address processing module is used to execute the instruction corresponding to the method according to the function parameters and the address in the virtual runtime environment to update the target application.

14. The application update device according to claim 10, characterized in that, The apparatus further includes a replacement function determination module, a replacement method determination module, a replacement execution result acquisition module, and a replacement execution result processing module; wherein: the replacement function determination module is used to determine the replacement function name and function parameters corresponding to the target replacement call method when the patch file is executed in the virtual runtime environment and the method address mapping relationship associated with the patch file includes the target replacement call method; the replacement method determination module is used to obtain the replacement method and replacement address corresponding to the replacement function name from the patch file according to the method address mapping relationship; the replacement execution result acquisition module is used to execute the instruction corresponding to the replacement method according to the function parameters and the replacement address in the virtual runtime environment to obtain the replacement execution result; the replacement execution result processing module is used to return the replacement execution result to the replacement request end corresponding to the target replacement call method to update the target application.

15. The application update device according to claim 10, characterized in that, The device further includes an instruction file loading module, an architecture parameter determination module, and an associated data loading module; wherein: the instruction file loading module is used to load the patch instruction file in the patch file into the virtual runtime environment; the architecture parameter determination module is used to determine the architecture parameters corresponding to the patch file; and the associated data loading module is used to load the patch associated data in the patch file into the virtual runtime environment when the architecture parameters match the platform architecture parameters corresponding to the operating platform.

16. The application update device according to claim 10, characterized in that, The compilation processing module includes a pre-compilation module, an analysis module, and an instruction set compilation module; wherein: the pre-compilation module is used to pre-compile the patch code to obtain a pre-compilation result; the analysis module is used to perform lexical analysis and syntax analysis sequentially based on the pre-compilation result to obtain the analysis result; the instruction set compilation module is used to compile the pre-compilation result using an instruction set when the analysis result is satisfactory to obtain a patch instruction file.

17. The application update device according to claim 10, characterized in that, The patch file generation module includes an association data determination module and a data packaging module; wherein: the association data determination module is used to determine the patch association data corresponding to the patch instruction file; the data packaging module is used to generate a patch file for the target application based on the patch instruction file and the patch association data.

18. The application update device according to any one of claims 10 to 17, characterized in that, The patch file acquisition module is further configured to acquire a patch file from the server that is for the target application and matches the platform architecture parameters of the operating platform when an update task for the target application is detected; the device also includes a verification module, configured to verify the patch file, and when the verification result is that the verification passes, when executing the patch file in the virtual runtime environment, the target application is updated by directly calling the code of the target application.

19. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 9.

20. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.

21. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.