Data processing method and device, computer equipment and readable storage medium
By aggregating function calls and generating relocation functions in the first package of the application client, the memory consumption problem caused by too many placeholder functions in the first package is solved, thus improving the stability of the application client.
Patent Information
- Application Number
- CN202411192384.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2026-03-06
AI Technical Summary
The existing application client's initial package stores a large number of placeholder functions, resulting in excessive memory usage during compilation, which can easily lead to insufficient memory and crashes.
By obtaining function calls that meet the replacement conditions from function calls, aggregating them into aggregated function calls, generating relocation functions, and replacing function calls in the first package, the number of placeholder functions in the first package is reduced.
It reduces the compilation memory consumption of the application client, improves the stability of the application client, and avoids crashes caused by insufficient memory.
Smart Images

Figure CN121614201A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a data processing method, apparatus, computer equipment, and readable storage medium. Background Technology
[0002] Existing application client (e.g., mini-games) use a packet splitting technique to store placeholder functions called by function calls in the first packet, with one placeholder function corresponding to one function call. However, when there are many function calls in the first packet, a large number of placeholder functions need to be stored. When the application client runs to compile the first packet, it needs to be loaded into memory. Compiling the large number of placeholder functions in the first packet consumes a significant amount of memory, thus increasing the memory consumption of the application client during compilation (i.e., increasing the application client's compilation memory), and ultimately leading to insufficient memory and crashes. Summary of the Invention
[0003] This application provides a data processing method, apparatus, computer device, and readable storage medium, which can reduce the compilation memory of application clients and thus improve the stability of application clients.
[0004] One embodiment of this application provides a data processing method, including:
[0005] Obtain S function calls that satisfy the replacement conditions from the client program code of the application client; S is a positive integer, and the function signatures of the functions called by the S function calls are the signatures of the target functions; the client program code is used to divide into a first package program code and a sub-package program code, and the first package program code and the sub-package program code are used to run the application client. The first package program code is the program code loaded at startup, and the sub-package program code is the program code loaded lazily.
[0006] From S function calls, obtain N function calls that satisfy the aggregation condition and SN function calls that do not satisfy the aggregation condition. Aggregate the N function calls into an aggregate function call. Based on the aggregate function call and the SN function calls, generate the relocation function corresponding to the target function signature; N is a positive integer less than or equal to S; the aggregate function call is used to call the placeholder function in the relocation function, and the placeholder function in the relocation function is used to call the function called by each of the N function calls.
[0007] Replace each of the S function calls with a relocation function call to obtain the replaced first package program code and the replaced sub-package program code; the relocation function call is used to directly call the relocation function;
[0008] Write a relocation function into the replaced first package program code to obtain the target first package program code; the relocation function is used to call S functions in the target first package program code or the replaced sub-package program code during the running of the application client.
[0009] One embodiment of this application provides a data processing apparatus, including:
[0010] The call acquisition module is used to retrieve S function calls that meet the replacement conditions from the client program code of the application client; S is a positive integer, and the function signatures of the functions called by the S function calls are the signatures of the target functions; the client program code is divided into a first package program code and a sub-package program code, which are used to run the application client. The first package program code is the program code loaded at startup, and the sub-package program code is the program code loaded lazily.
[0011] The function generation module is used to obtain N function calls that satisfy the aggregation condition and SN function calls that do not satisfy the aggregation condition from S function calls. It aggregates the N function calls into an aggregate function call, and generates the relocation function corresponding to the target function signature based on the aggregate function call and the SN function calls. N is a positive integer less than or equal to S. The aggregate function call is used to call the placeholder function in the relocation function, and the placeholder function in the relocation function is used to call the function called by each of the N function calls.
[0012] The replacement module is invoked to replace S function calls with relocation function calls, resulting in the replaced first package program code and the replaced sub-package program code; the relocation function call is used to directly invoke the relocation function;
[0013] The function writing module is used to write relocation functions into the replaced first package program code to obtain the target first package program code; the relocation functions are used to call S functions in the target first package program code or the replaced sub-package program code during the running of the application client.
[0014] Specifically, the call acquisition module is used to obtain the indirect call corresponding to the target function signature from the client program code of the application client; the indirect call refers to the function call implemented through the function index table;
[0015] The module is invoked, which is specifically used to divide the client program code into packages to obtain the first package program code and the sub-package program code;
[0016] The call acquisition module is specifically used to retrieve direct calls that meet the replacement conditions from the code of the first package and the code of the sub-packages; direct calls refer to function calls implemented without using the function index table;
[0017] The call acquisition module is specifically used to identify the indirect calls corresponding to the target function signature and the direct calls that meet the replacement conditions as S function calls that meet the replacement conditions.
[0018] Specifically, the call acquisition module is used to obtain the first direct call from the first package program code to the sub-package program code;
[0019] The module is invoked to retrieve, specifically, the second direct call from the sub-package program code to the first package program code, and the third direct call from the sub-package program code to the sub-package program code.
[0020] The call to the acquisition module is specifically used to determine the direct call corresponding to the target function signature in the first direct call and the second direct call as the direct call that satisfies the replacement condition if the application client's runtime environment is the first runtime environment;
[0021] The module is invoked, specifically to determine the direct calls corresponding to the target function signatures in the first, second, and third direct calls as those that satisfy the replacement conditions if the application client's runtime environment is the second runtime environment.
[0022] Among them, the S function calls include the target function call, the S relocation function calls include the target relocation function call corresponding to the target function call, and the target function call is used to call the target function in the S functions;
[0023] The device also includes:
[0024] The function call module is used to compile the target first package program code during the running of the application client, and obtain the first package compilation result corresponding to the target first package program code;
[0025] The function call module is used to call the relocation function corresponding to the target function signature when the compilation result of the first package reaches the target relocation function call in the target first package program code, based on the target function signature of the target function associated with the target relocation function call.
[0026] The function call module is used to obtain the virtual function index table and the rearranged function index table corresponding to the application client. Based on the reference identifier of the target function, the virtual function index table, and the rearranged function index table, the module calls the target function in the target first package program code or the replaced sub-package program code in the relocation function.
[0027] The device also includes:
[0028] The index table generation module is used to supplement the function index table based on the target first package program code and the replaced sub-package program code, to obtain the supplemented function index table, and to obtain the indexed call function called by the function reference in the supplemented function index table;
[0029] The index table generation module is used to determine the first package marker of the indexed call function based on the target first package program code, and to merge the first package marker and the function identifier of the indexed call function to obtain the virtual parameters corresponding to the function references in the supplemented function index table;
[0030] The index table generation module is used to determine the order of virtual parameters corresponding to function references in the supplemented function index table based on the order of function references in the supplemented function index table, and thus obtain the virtual function index table.
[0031] The index table generation module is used to determine the order of function references in the target first package program code and the replaced sub-package program code based on the order of function identifiers of the indexed function calls, and to obtain the rearranged function index table.
[0032] The index table generation module is specifically used to perform function matching between functions in the target first package program code and indexed call functions to obtain matching results.
[0033] The index table generation module is specifically used to determine the first flag parameter as the first package flag of the index call function if the matching result indicates that the index call function belongs to the function in the target first package program code;
[0034] The index table generation module is specifically used to determine the second flag parameter as the first package flag of the index call function if the matching result indicates that the index call function does not belong to the function in the target first package program code.
[0035] Specifically, the index table generation module is used to obtain function references of functions in the target first package program code from the supplemented function index table, determine the order of function references in the target first package program code according to the order of function identifiers of the indexed functions, and obtain the first package function index table corresponding to the application client; the first package function index table is obtained after the target first package program code is compiled.
[0036] The index table generation module is specifically used to obtain function references of functions in the replaced subpackage program code from the supplemented function index table. Based on the order of function identifiers of the indexed functions, the order of function references in the replaced subpackage program code is determined, resulting in the subpackage function index table corresponding to the application client. The subpackage function index table is obtained after compiling the replaced subpackage program code.
[0037] The index table generation module is specifically used to determine the first package function index table and the sub-package function index table as the rearranged function index table.
[0038] Specifically, the function call module is used to obtain the virtual parameters corresponding to the reference identifier of the target function from the virtual function index table, and to obtain the first package marker and the function identifier of the target function from the virtual parameters corresponding to the reference identifier of the target function.
[0039] The function call module is specifically used to indirectly call the target function in the target first package program code in the relocation function, based on the first package compilation result, the function identifier of the target function, and the reordered function index table, if the first package of the target function is marked as the first marker parameter.
[0040] The function call module is specifically used to call the target function in the replaced sub-package program code in the relocation function if the second flag parameter of the first package flag of the target function is true, based on the function identifier of the target function and the rearranged function index table.
[0041] Specifically, the function call module is used to obtain the runtime environment of the application client. If the runtime environment of the application client is the first runtime environment, the replacement sub-package program code is compiled to obtain the sub-package compilation result corresponding to the replacement sub-package program code. Based on the sub-package compilation result, the function identifier of the target function and the rearranged function index table, the target function in the replacement sub-package program code is indirectly called in the relocation function.
[0042] The function call module is specifically used to directly call the target function in the replaced subpackage program code in the relocation function according to the function identifier of the target function if the application client's runtime environment is the second runtime environment.
[0043] Specifically, the function call module is used to call the placeholder function in the relocation function according to the function identifier of the target function; the placeholder function is determined by the aggregate function call.
[0044] The function call module is specifically used to retrieve the target function corresponding to the function identifier from the replaced subpackage program code through placeholder functions, and then execute the target function.
[0045] Specifically, the function call module is also used to retrieve the virtual parameters to be updated that are associated with the function identifier of the target function from the virtual function index table;
[0046] The function call module is also specifically used to merge the function identifier and the first marker parameter of the target function to obtain the updated virtual parameters;
[0047] The function call module is also specifically used to update virtual parameters to be updated by updating virtual parameters.
[0048] Specifically, the function call module is used to obtain the virtual function index table corresponding to the application client from the application client's index table file, and to obtain the reordered function index table corresponding to the application client from the target first package program code;
[0049] The function call module is also specifically used to write the virtual function index table into the virtual machine's memory stack;
[0050] The function call module is also specifically used to allocate client memory for the application client in the memory stack and write the virtual function index table into the engine heap in the client memory; the application client is used to manage the virtual function index table in the engine heap.
[0051] The call to the acquisition module is specifically used to perform stubbing on the client program code to obtain the stubbing client program code.
[0052] The module is invoked to process the client program code after the staking process and obtain the function call indication information corresponding to the client program code.
[0053] The module for obtaining information is called, specifically used to divide the client program code into the first package program code and the candidate sub-package program code based on the function call instruction information;
[0054] The module is called to obtain the runtime environment of the application client. If the runtime environment of the application client is the first runtime environment, the candidate sub-package program code is determined as the sub-package program code. Alternatively, the direct call of the candidate sub-package program code to the first package program code in the candidate sub-package program code is replaced with an indirect call to obtain the sub-package program code.
[0055] The module is called to obtain the modified conversion function if the application client's runtime environment is the second runtime environment. The modified conversion function is then identified as the sub-package program code. The modified conversion function is obtained by modifying the direct call in the conversion function, which is obtained by converting the format of the function in the client program code.
[0056] Specifically, the call acquisition module is also used to perform format conversion on functions in the client program code to obtain the conversion function;
[0057] The call to the acquisition module is also specifically used to modify the function called directly in the conversion function from the function in the calling client program code to the function called by the placeholder function, thus obtaining the modified conversion function; the placeholder function called directly in the modified conversion function is used to load the modified conversion function.
[0058] Specifically, the call acquisition module is used to obtain the first direct call from the first package program code to the sub-package program code;
[0059] The module for obtaining the function is called, specifically to determine the direct call corresponding to the target function signature in the first direct call as a direct call that satisfies the replacement condition.
[0060] Specifically, the function call module is used to obtain the target function corresponding to the function identifier from the replaced sub-package program code through placeholder functions;
[0061] The function call module is specifically used to replace the direct call of the target first package program code by the replaced sub-package program code to an indirect call if the target function contains a direct call of the target first package program code by the replaced sub-package program code, thus obtaining the replaced target function;
[0062] The function call module is specifically used to execute the target function after replacement.
[0063] One embodiment of this application provides a computer device, including: a processor and a memory;
[0064] The processor is connected to a memory, which stores a computer program. When the computer program is executed by the processor, it causes the computer device to perform the method provided in the embodiments of this application.
[0065] One aspect of this application provides a computer-readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having the processor performs the method provided in this application.
[0066] One embodiment of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in this application embodiment.
[0067] This application provides a technical solution to reduce the compilation memory of the first package by relocating functions. The solution can obtain S function calls that meet the replacement conditions from the client program code, obtain N function calls that meet the aggregation conditions and SN function calls that do not meet the aggregation conditions from the S function calls, aggregate the N function calls into aggregate function calls, and then implement the aggregate function calls and SN function calls through relocation functions, and replace the S function calls with calls to the relocation functions. Understandably, relocation functions are used to call S functions in the first or sub-packages of the application client during application client execution (i.e., the functions called by the S function calls). Among them, aggregate function calls are used to call placeholder functions in the relocation functions, and placeholder functions in the relocation functions are used to call the functions called by the N function calls. Thus, multiple functions are called through placeholder functions, that is, one placeholder function can correspond to multiple functions. Therefore, multiple placeholder functions are aggregated through relocation functions and written into the first package. This reduces the number of placeholder functions in the first package, thereby reducing the memory consumed by the application client during compilation (i.e., reducing the compilation memory of the application client), thus preventing the application client from crashing due to insufficient memory and improving the stability of the application client. Attached Figure Description
[0068] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 This is a schematic diagram of a network architecture provided in an embodiment of this application;
[0070] Figure 2 This is a schematic diagram of a data interaction scenario provided in an embodiment of this application;
[0071] Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0072] Figure 4 This is a schematic diagram of a table generation scenario provided in an embodiment of this application;
[0073] Figure 5 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0074] Figure 6 This is a flowchart illustrating a method for calling a relocation function, as provided in an embodiment of this application.
[0075] Figure 7 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0076] Figure 8 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0077] Figure 9 This is a schematic diagram of a runtime function modification process provided in an embodiment of this application;
[0078] Figure 10 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;
[0079] Figure 11 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0080] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0081] For details, please see Figure 1 , Figure 1 This is a schematic diagram of a network architecture provided in an embodiment of this application. Figure 1 As shown, this network architecture may include a server 2000 and a terminal device cluster. The terminal device cluster may specifically include one or more terminal devices; the number of terminal devices in the cluster is not limited here. Figure 1 As shown, the multiple terminal devices may specifically include terminal device 3000a, terminal device 3000b, terminal device 3000c, ..., terminal device 3000n; terminal device 3000a, terminal device 3000b, terminal device 3000c, ..., terminal device 3000n can be directly or indirectly connected to server 2000 via wired or wireless communication, so that each terminal device can interact with server 2000 through the network connection.
[0082] The terminal devices in the terminal device cluster can include: smartphones, tablets, laptops, desktop computers, intelligent voice interaction devices, smart home appliances (e.g., smart TVs), wearable devices, in-vehicle terminals, aircraft, and other intelligent terminals with data processing capabilities. In-vehicle terminals can be terminal devices used in intelligent transportation scenarios and assisted driving scenarios.
[0083] It should be understood that, such as Figure 1 Each terminal device in the terminal device cluster shown can be equipped with an application client that has data processing capabilities. When the application client runs on each terminal device, it can interact with the aforementioned... Figure 1 The servers 2000 shown interact with each other. Specifically, the application clients may include: in-vehicle clients, smart home clients, entertainment clients (e.g., game clients), multimedia clients (e.g., video clients), social clients, and information clients (e.g., news clients), etc.
[0084] In this embodiment, the application client can be integrated into a host application (e.g., a social client) or a standalone client (e.g., a game client). This embodiment does not limit the type of application client. It is understood that when an application client is integrated into a host application, the application client can be referred to as a subroutine integrated into the host application. The host application represents the application entity that provides the runtime environment for the subroutine, and can also represent the application client used to integrate the subroutine. For example, taking a social client as the host application, when a subroutine is integrated into the social client, the social client can have the ability to open and display the subroutine. In this embodiment, the subroutine (i.e., the application client) can be a mini-program (e.g., a mini-game) integrated into the host application, or it can be a video account, public account, etc., integrated into the host application. This embodiment does not limit the type of subroutine.
[0085] Among them, server 2000 can be the server corresponding to the application client. Server 2000 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0086] It should be understood that the above network framework can be applied to the WebAssembly (WASM, a binary instruction format) cross-platform packet splitting technology solution. This solution can obtain the first packet and sub-packets of the application client, run the application client using the first packet and sub-packets, load the first packet (i.e., the first packet is the program code loaded at startup) in the application client, and delay loading the sub-packets (i.e., the sub-packets are program code loaded late) in the application client. Specifically, the loading of the first packet precedes the loading of the sub-packets, and the loading of the sub-packets follows the loading of the first packet. Startup loading refers to loading when the application client starts, while delayed loading refers to loading after the application client starts.
[0087] For ease of understanding, this application can refer to the application client's initial package program code, the replaced initial package program code, and the target initial package program code collectively as the application client's initial package. The initial package program code, the replaced initial package program code, and the target initial package program code can be initial packages at different times. Similarly, this application can refer to the application client's sub-package program code and the replaced sub-package program code collectively as the application client's sub-package. The sub-package program code and the replaced sub-package program code can be sub-packages at different times. The replaced initial package program code and the target initial package program code are determined by the initial package program code, and the replaced sub-package program code is determined by the sub-package program code. The initial package program code and the sub-package program code are obtained by subpackaging the application client's client program code.
[0088] It is understandable that the client program code can be Wasm code (i.e., Wasm packages or Wasm code bundles). To address the issues of slow startup, lag, overheating, and crashes caused by excessively large client program code size, this application uses PGO (profile-guided optimization, a compiler optimization technique) to split the client program code into two parts (i.e., a first package and a sub-package). This means that when the Wasm code is executed on the terminal device (i.e., running the application client on the terminal device), it needs to implement package splitting (i.e., cross-platform package splitting). Here, the first package refers to the first Wasm package, and the sub-package refers to the second Wasm package; the first Wasm package represents the first package after the client program code is split, and the sub-package represents the second package after the client program code is split.
[0089] For easier understanding, please refer to Figure 2 , Figure 2 This is a schematic diagram illustrating a data interaction scenario provided in an embodiment of this application. For example... Figure 2 The server 20a shown can be the one described above. Figure 1 The server 2000 in the corresponding embodiment, such as Figure 2 The terminal device 20b shown can be the one described above. Figure 1Any terminal device in the terminal device cluster of the corresponding embodiment, for example, terminal device 20b can be terminal device 3000a in the terminal device cluster. For ease of understanding, the user can be referred to as an object in this embodiment, and the object corresponding to terminal device 20b can be object 20c.
[0090] like Figure 2 As shown, server 20a can obtain S function calls that satisfy the replacement conditions from the client program code of the application client. Here, S can be a positive integer; for example, S equals 4. The S function calls can include function call 21a, function call 21b, function call 21c, and function call 21d. Function call 21a can be used to call function 22a, function call 21b can be used to call function 22b, function call 21c can be used to call function 22c, and function call 21d can be used to call function 22d. The functions called by the S function calls (i.e., function calls 21a, 21b, 21c, and 21d) have the same function signature (i.e., the function signatures of functions 22a, 22b, 22c, and 22d are the same), and the function signatures of the functions called by the S function calls are the target function signature (i.e., the function signatures of functions 22a, 22b, 22c, and 22d are all the target function signature).
[0091] Furthermore, server 20a can obtain N function calls that satisfy the aggregation condition and SN function calls that do not satisfy the aggregation condition from S function calls. Here, N can be a positive integer less than or equal to S. Taking N equal to 3 as an example, the N function calls can include function call 21a, function call 21b, and function call 21c (that is, function call 21a, function call 21b, and function call 21c can be function calls that satisfy the aggregation condition from the S function calls), and the SN function calls can include function call 21d (that is, function call 21d can be function calls that do not satisfy the aggregation condition from the S function calls).
[0092] Furthermore, server 20a can aggregate N function calls (i.e., function calls 21a, 21b, and 21c) into an aggregate function call. Based on the aggregate function call and SN function calls (i.e., function call 21d), it generates a relocation function (i.e., RedirectFunction) corresponding to the target function signature. The relocation function can implement both the aggregate function call and the SN function calls. The aggregate function call is used to invoke the placeholder functions within the relocation function, and the placeholder functions within the relocation function are used to invoke the functions called by each of the N function calls (i.e., the placeholder functions within the relocation function are used to invoke N functions, where N functions refer to the functions called by each of the N function calls).
[0093] like Figure 2 As shown, server 20a can replace S function calls with relocated function calls, resulting in replaced first-package program code and replaced sub-package program code. The S function calls belong to the first-package program code or sub-package program code of the application client. The first-package program code and sub-package program code are obtained by subdividing the client program code. The replaced first-package program code is obtained by replacing the function calls belonging to the S function calls within the first-package program code, and the replaced sub-package program code is obtained by replacing the function calls belonging to the S function calls within the sub-package program code. In other words, server 20a can replace function call 21a with a relocated function call, function call 21b with a relocated function call, function call 21c with a relocated function call, and function call 21d with a relocated function call.
[0094] Furthermore, server 20a can write a relocation function into the replaced first packet program code to obtain the target first packet program code. For example... Figure 2 As shown, object 20c can start the application client in terminal device 20b. Terminal device 20b can send a client running request to server 20a. In this way, server 20a can respond to the client running request sent by terminal device 20b and return the target first package program code to terminal device 20b.
[0095] Furthermore, terminal device 20b can invoke a relocation function based on the relocation function call in the target first package program code. In the relocation function, it can call S functions in the target first package program code or the replaced sub-package program code. That is, terminal device 20b can call function 22a, function 22b, function 22c or function 22d in the relocation function.
[0096] Therefore, the embodiments of this application can aggregate N function calls that meet the aggregation conditions through the relocation function in the first package, and aggregate the N function calls that meet the aggregation conditions into an aggregate function call. The aggregate function call calls the placeholder functions in the relocation function, and then the placeholder functions call the functions called by the N function calls that meet the aggregation conditions. In this way, the placeholder functions called by the N function calls that meet the aggregation conditions are aggregated into the placeholder functions in the relocation function, reducing the number of placeholder functions in the first package, thereby reducing the compilation memory of the application client and the heat generated during the compilation of the first package, alleviating the problem of application client crashes due to insufficient memory, and improving the stability of the application client.
[0097] Further, please see Figure 3 , Figure 3This is a schematic flowchart illustrating a data processing method provided in an embodiment of this application. This data processing method can be executed by a computer device, which can be the aforementioned... Figure 2 The server 20a in the corresponding embodiment can also be the one described above. Figure 2 The terminal device 20b in the corresponding embodiment. The data processing method may include the following steps S101-S104:
[0098] Step S101: Obtain S function calls that meet the replacement conditions from the client program code of the application client;
[0099] Specifically, the computer device can obtain the indirect calls (i.e., indirect calls that satisfy the replacement conditions) corresponding to the target function signature from the client program code of the application client. Here, an indirect call refers to a function call implemented through a function index table; the client program code is used to divide into a first package program code and a sub-package program code, which are used to run the application client. Further, the computer device can further divide the client program code into first package program code and sub-package program code, and obtain the direct calls that satisfy the replacement conditions from the first package program code and sub-package program code. Here, a direct call refers to a function call implemented without using a function index table; the first package program code is the program code loaded at startup, and the sub-package program code is the program code loaded lazily. Further, the computer device can determine the indirect calls (i.e., indirect calls that satisfy the replacement conditions) corresponding to the target function signature and the direct calls that satisfy the replacement conditions as S function calls that satisfy the replacement conditions. Here, S can be a positive integer, and the function signatures of the functions called by the S function calls are all the target function signature.
[0100] Understandably, a computer device can obtain indirect calls (i.e., indirect calls from the client program code) from the application client. The number of indirect calls can be zero or one or more, and the function signatures of the functions called by multiple indirect calls can be the same or different. Furthermore, the computer device can obtain the indirect call corresponding to the target function signature from the indirect calls in the client program code; the function signature of the function called by the indirect call corresponding to the target function signature is the target function signature.
[0101] In this application, the specific process of subpackaging is not limited. The computer device can generate different or the same initial package program code for different operating environments (different operating environments can represent different systems). Similarly, the computer device can generate different or the same subpackage program code for different operating environments. For ease of understanding, this application uses the following examples: an operating environment including a first operating environment (e.g., Android, a free and open-source mobile operating system based on the Linux kernel) and a second operating environment (e.g., iOS, a mobile operating system developed by Apple Inc.). This application also uses examples where the first and second operating environments have the same initial package program code, and examples where the first and second operating environments have different subpackage program codes.
[0102] For example, the first package program code of the first runtime environment can be Wasm code, the sub-package program code of the first runtime environment can be Wasm code, the first package program code of the second runtime environment can be Wasm code, and the sub-package program code of the second runtime environment can be Wasm code or JS (JavaScript, a lightweight, interpreted or just-in-time compiled programming language with function priority) code. JS code is the format of the sub-package in the high-performance mode of the second runtime environment. For ease of understanding, this application uses JS code as an example for the sub-package program code of the second runtime environment. Here, Wasm code is compiled code for execution, and JS code is interpreted code for execution. Compiled execution means that Wasm code needs to be compiled (by a compiler) before execution, and interpreted execution means that JS code needs to be interpreted (by an interpreter) before execution.
[0103] Different runtime environments can execute different loading strategies during runtime. The first runtime environment can load the initial wasm package first, and then load wasm sub-packages as needed. The second runtime environment can load the initial wasm package first, then break down wasm sub-packages into JS functions at the function level, and load the JS functions on demand. Loading JS functions on demand avoids loading all functions in the sub-packages at once, thus saving memory in the second runtime environment.
[0104] The specific process by which the computer device obtains direct calls satisfying the replacement conditions from the first package program code and the sub-package program code can be described as follows: The computer device can obtain the first direct call from the first package program code to the sub-package program code, and the second and third direct calls from the sub-package program code to the first package program code. Specifically, the computer device can determine the direct call from the first package program code to the sub-package program code within the first package program code as the first direct call, the direct call from the sub-package program code to the first package program code within the sub-package program code as the second direct call, and the direct call from the sub-package program code to the sub-package program code within the sub-package program code as the third direct call. Optionally, the first package program code also includes direct calls from the first package program code to the first package program code, and the computer device does not need to obtain the direct calls from the first package program code to the first package program code within the first package program code. Furthermore, if the application client's runtime environment is the first runtime environment, the computer device can determine the direct calls corresponding to the target function signatures in the first and second direct calls as direct calls that satisfy the replacement conditions. Optionally, if the application client's runtime environment is the second runtime environment, the computer device can determine the direct calls corresponding to the target function signatures in the first, second, and third direct calls as direct calls that satisfy the replacement conditions. The number of first direct calls can be zero or one or more; the number of second direct calls can be zero or one or more; the number of third direct calls can be zero or one or more; the function signatures of the functions called by the first, second, and third direct calls can be the same or different; and the function signature of the function called by the direct call corresponding to the target function signature is the target function signature.
[0105] Optionally, the computer device can divide the client program code into packages to obtain a first package program code and a sub-package program code. Direct calls that meet the replacement conditions are obtained from the first package program code and the sub-package program code, and indirect calls that meet the replacement conditions are obtained from the first package program code and the sub-package program code. The direct calls and indirect calls that meet the replacement conditions are determined as S function calls that meet the replacement conditions.
[0106] It is understandable that indirect calls that satisfy the replacement conditions include indirect calls from the first package program code to the sub-package program code, indirect calls from the first package program code to the first package program code, indirect calls from the sub-package program code to the first package program code, and indirect calls from the sub-package program code to the sub-package program code; in the second runtime environment, direct calls that satisfy the replacement conditions include direct calls from the first package program code to the sub-package program code, direct calls from the sub-package program code to the first package program code, and direct calls from the sub-package program code to the sub-package program code; in the first runtime environment, direct calls that satisfy the replacement conditions include direct calls from the first package program code to the sub-package program code and direct calls from the sub-package program code to the first package program code.
[0107] Understandably, indirect calls that satisfy the substitution condition call the function whose signature is the target function's signature; indirect calls that do not satisfy the substitution condition call the function whose signature is not the target function's signature. In the second runtime environment, direct calls that satisfy the substitution condition call the function whose signature is the target function's signature, and direct calls that satisfy the substitution condition are either a direct call from the first package program code to the sub-package program code, a direct call from the sub-package program code to the first package program code, or a direct call from the sub-package program code to the sub-package program code. In the second runtime environment, direct calls that do not satisfy the substitution condition call the function whose signature is not the target function's signature, or do not satisfy the substitution condition. A direct call that satisfies the replacement condition is a direct call from the first package program code to the first package program code. In the first runtime environment, the function signature of the function called by a direct call that satisfies the replacement condition is the same as the target function signature, and the direct call that satisfies the replacement condition is a direct call from the first package program code to the sub-package program code or a direct call from the sub-package program code to the first package program code. In the first runtime environment, the function signature of the function called by a direct call that does not satisfy the replacement condition is not the same as the target function signature, or the direct call that does not satisfy the replacement condition is a direct call from the first package program code to the first package program code, or the direct call that does not satisfy the replacement condition is a direct call from the sub-package program code to the sub-package program code.
[0108] Therefore, in the second runtime environment, the substitution condition refers to the condition of an indirect call corresponding to the target function signature, a direct call from the first package program code to the sub-package program code corresponding to the target function signature, a direct call from the sub-package program code to the first package program code corresponding to the target function signature, or a direct call from the sub-package program code to the sub-package program code corresponding to the target function signature; in the first runtime environment, the substitution condition refers to the condition of an indirect call corresponding to the target function signature, a direct call from the first package program code to the sub-package program code corresponding to the target function signature, or a direct call from the sub-package program code to the first package program code corresponding to the target function signature.
[0109] Optionally, the specific process by which the computer device obtains direct calls that satisfy the replacement conditions from the first package program code and the sub-package program code can be described as follows: The computer device can obtain the first direct call from the first package program code to the sub-package program code, and determine the direct call corresponding to the target function signature in the first direct call as the direct call that satisfies the replacement conditions. It is understood that in both the first and second runtime environments, direct calls that satisfy the replacement conditions include direct calls from the first package program code to the sub-package program code; the function signature of the function called by a direct call that satisfies the replacement conditions is the target function signature, and the direct call that satisfies the replacement conditions is a direct call from the first package program code to the sub-package program code; the function signature of the function called by a direct call that does not satisfy the replacement conditions is not the target function signature, or the direct call that does not satisfy the replacement conditions is a direct call from the first package program code to the first package program code, or the direct call that does not satisfy the replacement conditions is a direct call from the sub-package program code to the sub-package program code, or the direct call that does not satisfy the replacement conditions is a direct call from the sub-package program code to the first package program code. Therefore, in both the first and second runtime environments, the substitution condition refers to the condition of an indirect call corresponding to the target function signature or a direct call from the first package program code to the sub-package program code corresponding to the target function signature.
[0110] Step S102: Obtain N function calls that satisfy the aggregation condition and SN function calls that do not satisfy the aggregation condition from S function calls; aggregate the N function calls into aggregate function calls; and generate the relocation function corresponding to the target function signature based on the aggregate function calls and the SN function calls.
[0111] Here, N can be a positive integer less than or equal to S. The relocation function (also called an aggregation function) can implement aggregate function calls and SN function calls. The aggregate function call is used to call the placeholder function in the relocation function. The placeholder function in the relocation function is used to call the function called by each of the N function calls, thus aggregating the placeholder functions called by the N function calls (i.e., N placeholder functions) into the placeholder function in the relocation function (one placeholder function in one relocation function). Aggregating N function calls into an aggregate function call means aggregating N function calls into one function call (i.e., aggregate function call), and the aggregate function call represents N function calls.
[0112] Similarly, this application can aggregate SN function calls into a single function call within a relocation function (i.e., an aggregated function call). The aggregated function call represents the SN function calls and is used to invoke the functions called by the SN function calls respectively. For ease of understanding, this application can refer to the aggregated function call formed by N function calls as the first aggregated function call, and the aggregated function call formed by SN function calls as the second aggregated function call.
[0113] Since the function signatures of the S function calls are all the same as the target function signature, the relocation functions are aggregated by function signature. The number of relocation functions is the same as the number of function signatures, and different function signatures can correspond to different relocation functions. Typically, the number of relocation functions is less than the number of functions in the subpackage.
[0114] Understandably, the N function calls that satisfy the aggregation condition are import calls (import calls are direct calls, which also include function calls other than import calls; import calls refer to calls implemented through placeholder functions, and can also be called import calls). Furthermore, these N function calls satisfying the aggregation condition are either function calls from the first package's code to the sub-package's code, or function calls from one sub-package's code to another. The S function calls that do not satisfy the aggregation condition are the S function calls excluding the N function calls that satisfy the aggregation condition. In other words, the N function calls satisfying the aggregation condition are either import calls from the first package's code to the sub-package's code, or import calls from one sub-package's code to another, thus reducing the number of imported functions (i.e., placeholder functions called by import calls). Therefore, the aggregation condition refers to the condition of either import calls from the first package's code to the sub-package's code, or import calls from one sub-package's code to another.
[0115] Optionally, when the S function calls do not include direct calls from subpackage code to subpackage code, the N function calls that satisfy the aggregation condition are import calls, and these N function calls are function calls from the first package code to the subpackage code. In other words, the N function calls that satisfy the aggregation condition are import calls from the first package code to the subpackage code, where the aggregation condition refers to the conditions for import calls from the first package code to the subpackage code.
[0116] Optionally, the client program code may also contain import calls in addition to the N function calls. These import calls are used to call JS functions to implement the application client's functionality (e.g., network functionality). The JS functions called by these import calls are not JS functions in the sub-package. These import calls are not function calls that satisfy the aggregation condition, nor are they function calls that satisfy the replacement condition.
[0117] Step S103: Replace the S function calls with relocation function calls respectively to obtain the replaced first package program code and the replaced sub-package program code;
[0118] In this application, S function calls can be replaced (or modified) to directly call the relocation function. The relocation function call is used to directly call (i.e., invoke) the relocation function. All S relocation function calls are used to directly invoke the relocation function. The S function calls include the target function call, and the S relocation function calls include the target relocation function call corresponding to the target function call. The target function call is used to call the target function in the S functions, and the target relocation function call is used to directly invoke the relocation function.
[0119] At this point, neither the replaced first package program code nor the replaced sub-package program code includes function calls from the S function calls; however, both the replaced first package program code and the replaced sub-package program code include relocation function calls from the S relocation function calls. Correspondingly, the first package program code and the sub-package program code include function calls from the S function calls.
[0120] Step S104: Write a relocation function into the replaced first package program code to obtain the target first package program code.
[0121] The relocation function is used to call S functions within the target primary package program code or the replaced sub-package program code during the execution of the application client. These S functions may include the target function (i.e., the target function can be any one of the S functions), and the target function can belong to either the target primary package program code or the replaced sub-package program code. The relocation function is used to call the target function within the target primary package program code or the replaced sub-package program code based on the target function's function reference, thereby determining which function to call during the execution of the application client. It should be understood that the specific process by which the computer device calls the target function within the target primary package program code or the replaced sub-package program code in the relocation function can be found below. Figure 5 Description of the corresponding embodiments.
[0122] At this point, the target first package program code includes relocation functions, while the replaced first package program code does not. In other words, the target first package program code is a first package that includes relocation functions, while the replaced first package program code is a first package that does not include relocation functions. Optionally, the target first package program code includes relocation functions and a rearrangement function index table, while the replaced first package program code does not include relocation functions and the rearrangement function index table.
[0123] It should be understood that computer equipment can supplement the function index table (also known as the original function index table) based on the target first package program code and the replaced sub-package program code, obtaining a supplemented function index table, and then obtaining the indexed call function called by the function reference in the supplemented function index table. The function index table stores function references, which are used to implement indirect calls. Different function references in the supplemented function index table can be used to call the same indexed call function or different indexed call functions. When the function signature of the indexed call function matches the target function signature, the indexed call function belongs to S functions; when the function signature of the indexed call function does not match the target function signature, the indexed call function does not belong to S functions. Furthermore, the computer equipment can determine the first package marker of the indexed call function based on the target first package program code, merge the first package marker and the function identifier of the indexed call function, and obtain the virtual parameters corresponding to the function references in the supplemented function index table (i.e., the virtual parameters corresponding to the indexed call functions). Furthermore, the computer device can determine the order of virtual parameters corresponding to function references in the supplemented function index table based on the order of function references in the supplemented function index table, thus obtaining a virtual function index table; the computer device can determine the order of function references in the target first package program code and the replaced sub-package program code based on the order of function identifiers of the indexed call functions (i.e., function identifiers of functions in the client program code), thus obtaining a rearranged function index table. In other words, the order of virtual parameters in the virtual function index table matches the order of function references in the supplemented function index table; the order of function references in the rearranged function index table matches the order of function identifiers of the indexed call functions (i.e., function identifiers of functions in the client program code).
[0124] Optionally, since the functions in the target first package program code and the replaced sub-package program code are the same as the functions in the client program code, the computer device can supplement the function index table according to the functions in the client program code to obtain a supplemented function index table, and obtain the indexed call function called by the function reference in the supplemented function index table.
[0125] Optionally, the computer device can obtain the functions in the client program code and their function identifiers, and determine the order of function references in the client program code based on the order of the function identifiers, thus obtaining a rearranged function index table. Therefore, the function references in the rearranged function index table and the function references in the function index table can be the same or different.
[0126] Understandably, functions in the client program code can be functions that directly call other functions, functions that indirectly call other functions, or functions that are called by both direct and indirect calls (i.e., a function in the client program code can be called by both direct and indirect calls simultaneously). Therefore, the function index table includes function references to functions called by indirect calls. Thus, index supplementation means adding function references to functions called by direct calls to the function index table, resulting in a supplemented function index table. In other words, index supplementation means retrieving functions from the client program code that do not have function references in the function index table, and adding those function references to the function index table so that the function index table contains function references to all functions in the client program code.
[0127] It should be understood that this application does not limit the specific implementation method of the merging process. For example, the merging process can be a concatenation process (i.e., concatenating the first packet marker and the function identifier of the indexed call function), or it can be an AND operation (i.e., performing an AND operation on the first packet marker and the function identifier of the indexed call function). In the case of an AND operation, the first packet marker can represent the high-order bits of the virtual parameter, avoiding the need to separately record the first packet marker and the function identifier, thereby reducing the memory occupied by the virtual parameter.
[0128] The specific process by which the computer device determines the first package marker of the indexed call function based on the target first package program code can be described as follows: The computer device can perform function matching between the functions in the target first package program code and the indexed call function to obtain a matching result. Further, if the matching result indicates that the indexed call function belongs to a function in the target first package program code (i.e., the indexed call function belongs to the first package), the computer device can determine the first marker parameter as the first package marker of the indexed call function. In this embodiment, the specific value of the first marker parameter is not limited; for example, the first marker parameter can be equal to 1. Optionally, if the matching result indicates that the indexed call function does not belong to a function in the target first package program code (i.e., the indexed call function does not belong to the first package), the computer device can determine the second marker parameter as the first package marker of the indexed call function. In this embodiment, the specific value of the second marker parameter is not limited; for example, the second marker parameter can be equal to 0.
[0129] The specific process by which the computer device determines the order of function references in the target first package program code and the replaced sub-package program code based on the order of function identifiers in the indexed function calls can be described as follows: The computer device can obtain function references from the target first package program code in the supplemented function index table, determine the order of function references in the target first package program code according to the order of function identifiers in the indexed function calls, and obtain the first package function index table corresponding to the application client; the computer device can also obtain function references from the replaced sub-package program code in the supplemented function index table, determine the order of function references in the replaced sub-package program code according to the order of function identifiers in the indexed function calls, and obtain the sub-package function index table corresponding to the application client. The first package function index table is obtained after compiling the target first package program code, and the sub-package function index table is obtained after compiling the replaced sub-package program code. Furthermore, the computer device can determine the first package function index table and the sub-package function index table as a rearranged function index table. In other words, the rearranged function index can include a first-package function index table and a sub-package function index table. The order of function references in the first-package function index table matches the order of function identifiers in the target first-package program code, and the order of function references in the sub-package function index table matches the order of function identifiers in the replaced sub-package program code.
[0130] For easier understanding, please refer to Figure 4 , Figure 4 This is a schematic diagram illustrating a table generation scenario provided in an embodiment of this application. For example... Figure 4 As shown, the function index table can include one or more function references. Specifically, multiple function references can include function reference 41a, function reference 41b, ..., function reference 41c. The functions called by function references 41a, 41b, ..., 41c can be the same or different. Function references 41a, 41b, ..., 41c each correspond to different reference identifiers, which indicate the position of the function reference in the function index table. For example, the reference identifier for function reference 41a can be 0, and the reference identifier for function reference 41b can be 1.
[0131] like Figure 4As shown, the virtual function index table can include one or more virtual parameters. Specifically, multiple virtual parameters can include virtual parameter 40a, virtual parameter 40b, ..., virtual parameter 40c. Virtual parameter 40a can be the virtual parameter corresponding to function reference 41a, virtual parameter 40b can be the virtual parameter corresponding to function reference 41b, ..., virtual parameter 40c can be the virtual parameter corresponding to function reference 41c. Virtual parameters 40a, 40b, ..., 40c each correspond to different reference identifiers, which indicate the position of the virtual parameter in the virtual function index table. For example, the reference identifier for virtual parameter 40a can be 0, and the reference identifier for virtual parameter 40b can be 1.
[0132] Specifically, the reference identifier corresponding to function reference 41a is the same as the reference identifier corresponding to virtual parameter 40a, the reference identifier corresponding to function reference 41b is the same as the reference identifier corresponding to virtual parameter 40b, ..., the reference identifier corresponding to function reference 41c is the same as the reference identifier corresponding to virtual parameter 40c; virtual parameter 40a contains the function identifier of the function called by function reference 41a, virtual parameter 40b contains the function identifier of the function called by function reference 41b, ..., virtual parameter 40c contains the function identifier of the function called by function reference 41c; virtual parameter 40a also contains the first package marker of the function called by function reference 41a, virtual parameter 40b also contains the first package marker of the function called by function reference 41b, ..., virtual parameter 40c also contains the first package marker of the function called by function reference 41c.
[0133] like Figure 4 As shown, the rearranged function index table can include one or more function references. Specifically, multiple function references can include function reference 42a, function reference 42b, ..., function reference 42c. The order of function references 42a, 42b, ..., 42c matches the order of function identifiers in the client program code. For example, function reference 42a can be a function reference to the function corresponding to function identifier 0, and function reference 42c can be a function reference to the function corresponding to function identifier 1.
[0134] It should be understood that functions in the client program code can have the same function signature or different function signatures, and the target function signature can be any one of the function signatures in the client program code. In this case, the computer device can perform the above steps S101-S104 for all function signatures in the client program code, and is not limited to the target function signature. This application uses the target function signature as an example for illustration. Here, the function signature refers to the function's parameter type (i.e., the type of the parameters passed to the function) and return type (i.e., the type of the parameters returned by the function).
[0135] Therefore, the embodiments of this application provide a technical solution to reduce the compilation memory of the first package by relocating functions. This solution can obtain S function calls that meet the replacement conditions from the client program code, obtain N function calls that meet the aggregation conditions and SN function calls that do not meet the aggregation conditions from the S function calls, aggregate the N function calls into aggregate function calls, and then implement the aggregate function calls and SN function calls through relocation functions, and replace the S function calls with calls to the relocation functions. Understandably, relocation functions are used to call S functions in the first or sub-packages of the application client during application client execution (i.e., the functions called by the S function calls). Among them, aggregate function calls are used to call placeholder functions in the relocation functions, and placeholder functions in the relocation functions are used to call the functions called by the N function calls. Thus, multiple functions are called through placeholder functions, that is, one placeholder function can correspond to multiple functions. Therefore, multiple placeholder functions are aggregated through relocation functions and written into the first package. This reduces the number of placeholder functions in the first package, thereby reducing the memory consumed by the application client during compilation (i.e., reducing the compilation memory of the application client), thus preventing the application client from crashing due to insufficient memory and improving the stability of the application client.
[0136] Further, please see Figure 5 , Figure 5 This is a schematic flowchart illustrating a data processing method provided in an embodiment of this application. This data processing method can be executed by a computer device, which can be the aforementioned... Figure 2 The server 20a in the corresponding embodiment can also be the one described above. Figure 2 The terminal device 20b in the corresponding embodiment. The data processing method may include the following steps S201-S203:
[0137] Step S201: During the running of the application client, the target first package program code is compiled to obtain the first package compilation result corresponding to the target first package program code;
[0138] Specifically, when the computer device is a terminal device, it can compile the target first package program code after downloading it. Similarly, when the computer device is a terminal device and the application client's runtime environment is a first runtime environment, the terminal device can compile the replaced sub-package program code after downloading it; when the computer device is a terminal device and the application client's runtime environment is a second runtime environment, the terminal device can download the JS functions (e.g., the target function) from the replaced sub-package program code.
[0139] Step S202: When the compilation result of the first package reaches the target relocation function call in the target first package program code, the relocation function corresponding to the target function signature is called according to the target function signature of the target function associated with the target relocation function call.
[0140] The target relocation function call (i.e., call_RedirectFunc) is obtained by replacing the target function call. The target relocation function call can be any one of the S relocation function calls, and the target function call can be any one of the S function calls. The target function is the function called by the target function call, and the target function signature is the function signature of the function called by the target function call.
[0141] It is understood that the target package program code may include one or more relocation functions. Multiple relocation functions may correspond to different function signatures. One or more relocation functions may include the relocation function corresponding to the target function signature, and multiple relocation functions may also include relocation functions corresponding to function signatures other than the target function signature. For ease of understanding, this application will use the relocation function corresponding to the target function signature in step S203 below as an example for illustration.
[0142] Step S203: Obtain the virtual function index table and the rearranged function index table corresponding to the application client. Based on the reference identifier of the target function, the virtual function index table, and the rearranged function index table, call the target function in the target first package program code or the replaced sub-package program code in the relocation function.
[0143] Specifically, the computer device can obtain the virtual function index table and the rearranged function index table corresponding to the application client. From the virtual function index table, it retrieves the virtual parameters corresponding to the reference identifier of the target function (e.g., the reference identifier can be a 32-bit integer data type). From the virtual parameters corresponding to the reference identifier of the target function, it retrieves the first package marker and the function identifier of the target function. The virtual parameters corresponding to the reference identifier of the target function are obtained by merging the first package marker and the function identifier of the target function. The reference identifier of the target function is used to specify the function to be called in the relocation function (i.e., the actual target function). Further, if the first package marker of the target function is the first marker parameter, the computer device can indirectly call (through the `call_indirect` instruction) the target function in the target first package program code within the relocation function, based on the first package compilation result, the function identifier of the target function, and the rearranged function index table. Therefore, this application can achieve indirect calls between first packages, indirect calls between sub-packages, and direct calls between sub-packages by calling the target function in the target first package program code within the relocation function. Optionally, if the target function's first package flag has a second flag parameter, the computer device can call the target function in the replaced sub-package program code within the relocation function based on the target function's function identifier and the rearranged function index table. Therefore, this application can achieve indirect calls from the first package to the sub-package, indirect calls from the sub-package to the sub-package, direct calls from the first package to the sub-package, and direct calls from the sub-package to the sub-package by calling the target function in the replaced sub-package program code within the relocation function.
[0144] Specifically, if the target function's first package marker is the first marker parameter, then the target function belongs to the target first package program code (i.e., the first marker parameter indicates that the target function belongs to the target first package program code); if the target function's first package marker is the second marker parameter, then the target function belongs to the replaced sub-package program code (i.e., the second marker parameter indicates that the target function belongs to the replaced sub-package program code). In this case, the target function's first package marker is used to determine whether the target function is a function in the first package or a function in a sub-package.
[0145] Optionally, if the first packet marker of the objective function is the first marker parameter, then the objective function has been downloaded to the terminal device (i.e., the first marker parameter indicates that the objective function has been downloaded to the terminal device); if the first packet marker of the objective function is the second marker parameter, then the objective function has not been downloaded to the terminal device (i.e., the second marker parameter indicates that the objective function has not been downloaded to the terminal device). In this case, the first packet marker of the objective function is used to determine whether the objective function has been downloaded to the terminal device.
[0146] Understandably, the specific process by which a computer device indirectly calls the target function in the target first package program code within a relocation function, based on the first package compilation result, the function identifier of the target function, and the reordered function index table, can be described as follows: The computer device can obtain the function reference corresponding to the function identifier of the target function (i.e., the function reference of the target function) from the reordered function index table, and indirectly call the target function in the target first package program code within a relocation function based on the first package compilation result and the function reference of the target function.
[0147] The specific process by which the computer device generates the virtual function index table and rearranges the function index table corresponding to the application client can be found in the above. Figure 3 The description of step S104 in the corresponding embodiment will not be repeated here.
[0148] Specifically, the computer device can obtain the virtual function index table corresponding to the application client from the application client's index table file, and obtain the rearranged function index table corresponding to the application client from the target first package program code (the rearranged function index table can be directly obtained during the compilation process of the target first package program code). Accordingly, after generating the virtual function index table and the rearranged function index table corresponding to the application client, the computer device can store the virtual function index table in the application client's index table file and write the rearranged function index table into the replaced first package program code.
[0149] Optionally, the rearranged function index table may include a first-package function index table and a sub-package function index table. The computer device can write the first-package function index table into the replaced first-package program code to finally obtain the target first-package program code, and write the sub-package function index table into the sub-package program code to finally obtain the replaced sub-package program code. In other words, the target first-package program code may include a first-package function index table, and the replaced sub-package program code may include a sub-package function index table. Thus, the computer device can obtain the first-package function index table in the target first-package program code after compiling it, and obtain the sub-package function index table in the replaced sub-package program code after compiling it.
[0150] The first runtime environment can have a first package function index table and a sub-package function index table, while the second runtime environment can have a first package function index table but not a sub-package function index table (tables cannot hold function references to JS functions). In this case, the first package function index table and the sub-package function index table in the first runtime environment can be collectively referred to as the rearranged function index table, and the first package function index table in the second runtime environment can be referred to as the rearranged function index table.
[0151] Furthermore, the computer device can write the Virtual Function Index Table (VFC) to the memory stack of the virtual machine (which is used to run Wasm code; the virtual machine does not support JS code) (i.e., write the VFC to the end of the memory stack), request client memory for the application client in the memory stack (e.g., game memory for a mini-game, where the mini-game can be a Unity game or a non-Unity game; Unity is a cross-platform game development engine), and write the VFC to the engine heap of the client memory (i.e., the memory of the Wasm instance) (i.e., the engine heap of the memory segment of the Wasm instance; the engine heap is an area for dynamically allocating and releasing memory). The computer device can compile the target package program code in the glue layer of the application client (the compilation process in the glue layer refers to the process of compiling the wasm file (i.e., wasm code) into machine code that the host environment can execute) to obtain a wasm instance (i.e., instantiate a wasm instance). The wasm instance is then run in the memory stack to allocate client memory for the application client. The application client manages the virtual function index table in the engine heap, thereby managing the virtual function index table in the memory segment (i.e., managing the virtual function index table in client memory). Furthermore, the computer device can automatically store the rearranged function index table in the table segment of the client memory. The table segment and the memory segment can be different memory segments in the client memory.
[0152] In this process, the computer device can request memory through the client engine (e.g., a game engine) using dlmalloc (dlmalloc represents memory allocation or memory allocator in a wasm instance), write the virtual function index table into the memory requested by dlmalloc, and write the returned starting address (i.e., the starting address of the memory requested by dlmalloc) into a global variable (i.e., the first global variable, for example, RedirBaseAddr). This allows the computer to query and modify the virtual function index table through the first global variable, preventing the virtual function index table from being overwritten.
[0153] Optionally, this application may also pre-allocate a segment of memory to store the virtual function index table before compiling the application client. In this way, a memory region can exist in the client memory of the application client to store the virtual function index table, avoiding the pre-allocated memory from being overwritten.
[0154] The computer device can obtain the runtime environment of the application client. Further, if the application client's runtime environment is a first runtime environment, the computer device can compile the replaced subpackage program code to obtain the subpackage compilation result corresponding to the replaced subpackage program code. Based on the subpackage compilation result, the function identifier of the target function, and the rearranged function index table, the computer device indirectly calls the target function in the replaced subpackage program code within the relocation function (indirect calling is implemented through the `call_indirect` instruction). Optionally, if the application client's runtime environment is a second runtime environment, the computer device can directly call the target function in the replaced subpackage program code within the relocation function based on the function identifier of the target function.
[0155] It is understood that, in this embodiment of the application, the runtime environment of the application client can be marked by a global variable (i.e., a second global variable). The value of the second global variable can be either a first parameter or a second parameter. During the execution of the application client, the value of the second global variable can be modified according to the actual runtime environment, thereby executing two different sub-package loading methods based on the value of the second global variable. In other words, the judgment logic of the second global variable (i.e., judging the value of the second global variable) can be executed during the execution of the application client. The judgment logic of the second global variable is located in the relocation function of the first package. Here, the first parameter indicates that the runtime environment of the application client is a first runtime environment, and the second parameter indicates that the runtime environment of the application client is a second runtime environment.
[0156] Understandably, the specific process by which a computer device indirectly calls the target function in the replaced subpackage program code within a relocation function, based on the subpackage compilation result, the function identifier of the target function, and the rearranged function index table, can be described as follows: The computer device can obtain the function reference corresponding to the function identifier of the target function (i.e., the function reference of the target function) from the rearranged function index table, and indirectly call the target function in the replaced subpackage program code within a relocation function based on the subpackage compilation result and the function reference of the target function.
[0157] The computer device can call placeholder functions (i.e., stub functions, import functions, and aggregate stub functions) within the relocation function based on the function identifier of the target function. The placeholder function retrieves the target function corresponding to the function identifier from the replaced sub-package program code and executes the target function. Specifically, placeholder functions are used to retrieve the target function based on its function identifier, and also to retrieve other functions besides the target function based on their function identifiers. Functions retrieved by placeholder functions have the same function signature, and there is one placeholder function within each relocation function. Placeholder functions are determined by aggregate function calls and are used to implement these calls. The functions retrieved by placeholder functions belong to the functions called by N function calls that satisfy the aggregation conditions. The functions retrieved by placeholder functions are JavaScript functions (i.e., placeholder functions are used to call JavaScript functions).
[0158] Understandably, in the high-performance mode of the second runtime environment, sub-packages are converted into JS at the function granularity. For the first package to call the JS version of the sub-package functions (i.e., JS functions), it must first import all the sub-package functions that may be called. In other words, the first package needs to have the entry information of the sub-package functions. Among them, placeholder functions (e.g., placeholder functions in the relocation function corresponding to the target function signature) are entry information associated with the function signature (e.g., the target function signature). Placeholder functions can aggregate the entry information of the functions called by N function calls that meet the aggregation conditions. In other words, this application can aggregate placeholder functions by function signature, thereby reducing the number of entry information (i.e., reducing the number of placeholder functions).
[0159] Optionally, since an application client can have a segment of client memory, this application can also store the virtual function index table in the client memory of other application clients (this embodiment does not limit the type of other application clients). Other application clients can export query functions (i.e., the GetRedirectIndex function), and application clients can import query functions. In this way, the wasm instance of the application client can call the query function and pass the reference identifier of the target function to the query function. The query function then retrieves the virtual parameters corresponding to the reference identifier of the target function from the virtual function index table in the client memory of other application clients.
[0160] It should be understood that after directly calling the target function in the replaced sub-package program code in the relocation function according to the function identifier of the target function, the computer device can obtain the virtual parameter to be updated (i.e., the first virtual parameter to be updated) associated with the function identifier of the target function from the virtual function index table. The virtual parameter to be updated (i.e., the first virtual parameter to be updated) is obtained by merging the function identifier of the target function and the second marker parameter. This embodiment does not limit the number of virtual parameters to be updated (i.e., the first virtual parameter to be updated); for example, the number of virtual parameters to be updated (i.e., the first virtual parameter to be updated) can be three. Further, the computer device can merge the function identifier of the target function and the first marker parameter to obtain the updated virtual parameter (i.e., the first updated virtual parameter), and update the virtual parameter to be updated (i.e., the first virtual parameter to be updated) by updating the updated virtual parameter (i.e., the first updated virtual parameter). In other words, the computer device can update the first package marker of the target function from the second marker parameter to the first marker parameter, thereby updating the virtual parameters in the virtual function index table (i.e., dynamically modifying virtual parameters during the running of the application client).
[0161] It should be understood that after indirectly calling the target function in the replaced subpackage program code in the relocation function based on the subpackage compilation result, the function identifier of the target function, and the rearranged function index table, the computer device can obtain the second virtual parameter to be updated associated with the function identifier of the function in the replaced subpackage program code from the virtual function index table. In this embodiment, the number of second virtual parameters to be updated is not limited; for example, the number of second virtual parameters to be updated can be 30. Further, the computer device can merge the function identifier and the first marker parameter of the function in the replaced subpackage program code to obtain the second updated virtual parameter, and update the second virtual parameter to be updated through the second updated virtual parameter. In other words, the computer device can update the first package marker of the function in the replaced subpackage program code from the second marker parameter to the first marker parameter, thereby updating the virtual parameters in the virtual function index table (i.e., dynamically modifying virtual parameters during the running of the application client). At this time, since the first package marker of the function in the target first package program code is the first marker parameter, the computer device can update all the first package markers in the virtual function index table from the second marker parameter to the first marker parameter.
[0162] For easier understanding, please refer to Figure 6 , Figure 6 This is a flowchart illustrating a method for calling a relocation function, as provided in an embodiment of this application. Figure 6As shown, the computer device can execute step S11, calling the relocation function according to the reference identifier and other parameters (i.e., the reference identifier and other parameters can be the function input parameters of the relocated function, and the other parameters can be the function input parameters of the target function), thereby calling the target function in the target first package program code or the replaced sub-package program code in the relocation function according to the reference identifier of the target function. Further, the computer device can execute step S12, retrieving the function identifier according to the reference identifier, that is, obtaining the virtual parameters corresponding to the reference identifier of the target function from the virtual function index table, and obtaining the function identifier of the target function from the virtual parameters corresponding to the reference identifier of the target function. Further, the computer device can execute step S13, determining whether the target function is in the first package, that is, obtaining the first package marker of the target function from the virtual parameters corresponding to the reference identifier of the target function. If the first package marker of the target function is the first marker parameter, then the target function is determined to be in the first package; if the first package marker of the target function is the second marker parameter, then the target function is determined not to be in the first package. Furthermore, if the target function is in the first package, the computer device can execute step S14, indirectly calling the target function through step S14, that is, indirectly calling the target function in the target first package program code within the relocation function. Furthermore, the computer device can determine the end of the relocation function execution through step S15.
[0163] Optionally, if the target function is not in the first package, the computer device can execute step S16 to determine whether it is executed in the second runtime environment (i.e., whether the application client's runtime environment is the second runtime environment). If it is not executed in the second runtime environment (i.e., the application client's runtime environment is the first runtime environment), the computer device can execute step S17 to call the sub-package synchronous loading function, i.e., obtain the replaced sub-package program code, compile the replaced sub-package program code, and obtain the sub-package compilation result corresponding to the replaced sub-package program code. Further, the computer device can execute step S14 to indirectly call the target function, i.e., indirectly call the target function in the replaced sub-package program code within the relocation function. Further, the computer device can determine the end of the relocation function execution through step S15.
[0164] Optionally, if execution is in a second runtime environment (i.e., the application client's runtime environment is the second runtime environment), the computer device can execute step S18. Step S18 involves calling a placeholder function to obtain and execute the target function; that is, calling the placeholder function in the relocation function to obtain the target function corresponding to the function identifier from the replaced sub-package program code through the placeholder function in the relocation function, and then executing the target function. Further, the computer device can determine the end of the relocation function execution through step S15.
[0165] It should be understood that when it is necessary to obtain a portion of the functions in the replaced sub-package program code in batches, but not all the functions in the replaced sub-package program code, the computer device can compile the patch program code (i.e., the patch package) to obtain the patch compilation result corresponding to the patch program code. The patch program code can be Wasm code, and the number of functions in the patch program code is less than the number of functions in the replaced sub-package program code. The functions in the patch program code are a subset of the functions in the replaced sub-package program code, thus enabling the loading of multiple functions at once through the patch program code, avoiding frequent loading of functions in the replaced sub-package program code, and avoiding loading all the functions in the replaced sub-package program code. Furthermore, the computer device can obtain the third virtual parameter to be updated associated with the function identifier of the function in the patch program code from the virtual function index table. In this embodiment, the number of third virtual parameters to be updated is not limited; for example, the number of third virtual parameters to be updated can be 10. Furthermore, the computer device can merge the function identifier and the first marker parameter of the function in the patch program code to obtain the third updated virtual parameter, and update the third virtual parameter to be updated using the third updated virtual parameter. In other words, the computer device can update the first package marker of the function in the patch code from the second marker parameter to the first marker parameter, thereby updating the virtual parameters in the virtual function index table (i.e., dynamically modifying the virtual parameters during the running of the application client).
[0166] Therefore, the embodiments of this application can call S functions (i.e., functions called by the S function calls) in the relocation function of the application client's first or sub-package. The aggregated function call is used to call N functions (i.e., functions called by the N function calls), and the SN function calls are used to call SN functions (i.e., functions called by the SN function calls) in the first or sub-package. Thus, this application can call multiple functions through placeholder functions in the relocation function; that is, one placeholder function can correspond to multiple functions. This allows multiple placeholder functions to be aggregated through the relocation function, and the relocation function is written into the first package. This reduces the number of placeholder functions in the first package, thereby reducing the memory consumed by the application client during compilation (i.e., reducing the application client's compilation memory), thus preventing the application client from crashing due to insufficient memory and improving the stability of the application client.
[0167] Further, please see Figure 7 , Figure 7 This is a schematic flowchart illustrating a data processing method provided in an embodiment of this application. This data processing method can be executed by a computer device, which can be the aforementioned... Figure 2 The server 20a in the corresponding embodiment can also be the one described above. Figure 2The terminal device 20b in the corresponding embodiment. The data processing method may include the following steps S301-S306:
[0168] Step S301: Obtain the indirect call corresponding to the target function signature from the client program code of the application client;
[0169] Indirect invocation refers to function invocation implemented through a function index table. The specific process by which the computer device obtains the indirect invocation corresponding to the target function signature from the client program code can be found above. Figure 3 The description of step S101 in the corresponding embodiments will not be repeated here.
[0170] It should be understood that a computer device can obtain the initial client program code of an application client, perform instruction optimization on the initial client program code, and obtain the client program code of the application client. Instruction optimization may include, but is not limited to, reusing local variables, merging code blocks, and instruction substitution. Instruction substitution means converting int64 (signed 64-bit integer data type) instructions in the initial client program code into int32 (signed 32-bit integer data type) instructions (i.e., converting an int64-bit instruction into two int32-bit instructions). The initial client program code may also include other instructions besides int64-bit instructions (e.g., int32-bit instructions). It should be understood that the embodiments of this application do not limit the instruction types of the initial client program code and the instructions in the client program code. For example, the initial client program code and the instructions in the client program code can be addition instructions, subtraction instructions, multiplication instructions, and division instructions.
[0171] It is understandable that, since 64-bit int instructions cannot be converted to JS instructions, while 32-bit int instructions can, and JS does not support 64-bit int instructions, this application cannot perform format conversion on functions in the initial client program code (i.e., cannot execute step S302 below), but can perform format conversion on functions in the client program (i.e., can execute step S302 below). Therefore, instruction substitution can process all instructions in the initial client program code into instructions that can be converted to JS instructions.
[0172] The initial client program code refers to the wasm code obtained by compiling application clients using non-JavaScript programming languages (e.g., C / C++) through the emscripten toolchain (i.e., the initial client program code is wasm code packaged by the emscripten toolchain), which enables the application client to be ported to the web platform and execute wasm code on the web.
[0173] Step S302: Perform format conversion on the functions in the client program code to obtain the conversion functions;
[0174] In this context, format conversion (i.e., wasm2js) means converting wasm code into JS code, or converting functions in client-side code to JS functions at the function level. The instructions within the JS functions are JS directives, and the client-side code can be wasm code, while the conversion function can be JS code. Thus, the JS function can be executed (or called) using the eval method (a method in JS), which can be used to execute JS code (or JS functions).
[0175] In this embodiment, the number of functions (or conversion functions) in the client program code is not limited. The number of functions (or conversion functions) in the client program code can be Q, where Q can be a positive integer greater than or equal to S. Thus, the computer device can perform format conversion on each of the Q functions in the client program code to obtain the corresponding conversion functions for each of the Q functions in the client program code.
[0176] Step S303: Modify the function directly called in the conversion function from calling the function in the client program code to calling the placeholder function to obtain the modified conversion function;
[0177] Understandably, since the client program code is a single unit and the Q transformation functions are Q parts, direct calls within functions in the client program code will execute successfully, while direct calls within the Q transformation functions will not. Therefore, introducing placeholder functions within the transformation functions allows direct calls within the Q modified transformation functions to execute successfully.
[0178] The computer device can modify the functions directly called by the Q transformation functions, replacing the functions in the calling client program code with placeholder functions, to obtain Q modified transformation functions. For ease of understanding, this application uses the example of all Q transformation functions having direct calls. If the target transformation function does not have direct calls, the computer device can determine the target transformation function as the modified target transformation function. The target transformation function can be any one of the Q transformation functions.
[0179] In this system, the placeholder function called by the direct call in the modified conversion function is used to load the modified conversion function (i.e., the placeholder function called by the direct call in the modified conversion function is used to call the modified conversion function). The placeholder functions called by the direct calls in the Q modified conversion functions are different. For example, the Q conversion functions may include a first conversion function and a second conversion function. The function called by the direct call in the first conversion function could be the second conversion function. However, if the direct call in the first conversion function to call the second conversion function fails to execute, the computer device can modify the function called by the direct call in the first conversion function from calling the second conversion function to calling a placeholder function, thus obtaining a modified first conversion function. The placeholder function called by the direct call in the modified first conversion function is used to load the second conversion function (or the modified second conversion function). The specific process of the computer device obtaining the modified second conversion function corresponding to the second conversion function can be found in the description of obtaining the modified first conversion function corresponding to the first conversion function, and will not be repeated here.
[0180] Step S304: The client program code is split into packages to obtain the first package program code and the sub-package program code;
[0181] Specifically, the computer device performs stubbing on the client program code to obtain stubbing-processed client program code. This stubbing can be used to collect function calls (i.e., determine whether a function has been called). Further, the computer device can run the stubbing-processed client program code to obtain function call indication information (i.e., function call information) corresponding to the client program code. This function call indication information indicates whether a function has been called; in other words, it can indicate whether a function has been called or not. Further, the computer device can divide the client program code into a primary package and candidate sub-packages based on the function call indication information. The computer device can add called functions from the client program code to the primary package and add uncalled functions from the client program code to the candidate sub-packages. Furthermore, the computer device can obtain the runtime environment of the application client. If the runtime environment of the application client is a first runtime environment, then the candidate subpackage program code is determined as the subpackage program code. Alternatively, the direct calls of the candidate subpackage program code to the first package program code in the candidate subpackage program code are replaced with indirect calls to obtain the subpackage program code. Optionally, if the runtime environment of the application client is a second runtime environment, the computer device can obtain the modified conversion function and determine the modified conversion function as the subpackage program code.
[0182] The number of modified conversion functions can be Q. These Q modified conversion functions can include functions in the first package and functions in the sub-packages. For ease of understanding, in this embodiment, the functions in the first package (which belong to the Q modified conversion functions) can be called the first package conversion functions, and the functions in the sub-packages (which belong to the Q modified conversion functions) can be called the sub-package conversion functions. Optionally, if the application client's runtime environment is a second runtime environment, the computer device can obtain the Q modified conversion functions, obtain the sub-package conversion functions from the Q modified conversion functions, and determine the sub-package conversion functions as sub-package program code.
[0183] The modified conversion function is obtained by modifying the direct calls within the conversion function, and the conversion function is obtained by performing format conversion on the functions in the client program code. The specific process of the computer device performing format conversion on the functions in the client program code can be found in the description of step S302 above, and will not be repeated here; the specific process of the computer device modifying the direct calls within the conversion function can be found in the description of step S303 above, and will not be repeated here.
[0184] The computer device can repeatedly perform stubbing processing on the client program code, run the stubbing client program code, and determine the first package program code and sub-package program code based on function call indication information (this embodiment does not limit the number of repetitions), continuously improving the function call indication information to make it more accurate, thereby making the first package program code more complete. For example, the first determined function call indication information can determine that the number of functions called is 1000, and the second determined function call indication information can determine that the number of added called functions is 200.
[0185] It should be understood that this application can determine the first package program code as the first package of the first runtime environment and the second runtime environment (that is, merge the processing of different platforms into one package), thereby unifying the first package to adapt to multiple platform runtime environments (that is, unifying the first package of the first runtime environment and the second runtime environment), eliminating the need to implement sub-package processing separately in the first runtime environment and the second runtime environment, thus saving the time spent on sub-package processing (i.e. saving sub-package time).
[0186] It is understood that, in the embodiments of this application, steps S302 and S303 can be executed before the client program code is subdivided into first package program code and sub-package program code. In this way, during the subdivision of the client program code, the computer device can directly determine the modified conversion function as the sub-package program code (i.e., directly obtain the JS function), without having to repeatedly obtain the JS function (i.e., determine the JS function based on the candidate sub-package program code, or perform format conversion on the sub-packages) during the subdivision process, thereby improving the efficiency of the subdivision process and saving resource consumption.
[0187] Therefore, this application can extract the common parts from the repeated sub-packaging process as a preprocessing process (the preprocessing process may include instruction optimization of the initial client program code, format conversion of functions in the client program code, and modification of direct calls in the conversion functions; the preprocessing process may also include replacing indirect calls in the client program code that meet the replacement conditions with relocation function calls) to execute common logic. For parts that are not completely the same, they are also adapted through real-time modification (real-time modification can be referred to the description of step S402 below), thereby saving the time spent on sub-packaging.
[0188] Step S305: Obtain direct calls that meet the replacement conditions from the first package program code and the sub-package program code;
[0189] Direct invocation refers to function invocation without using a function index table. The specific process by which the computer device retrieves direct invocations that meet the replacement conditions from the first package program code and the sub-package program code can be found above. Figure 3 The description of step S101 in the corresponding embodiments will not be repeated here.
[0190] In the first runtime environment, if the candidate subpackage program code is determined to be subpackage program code, the direct calls that satisfy the replacement conditions include direct calls from the first package program code corresponding to the target function signature to the subpackage program code and direct calls from the subpackage program code corresponding to the target function signature to the first package program code. The indirect calls that satisfy the replacement conditions include indirect calls corresponding to the target function signature. In the second runtime environment, the direct calls that satisfy the replacement conditions include direct calls from the first package program code corresponding to the target function signature to the subpackage program code, direct calls from the subpackage program code corresponding to the target function signature to the first package program code, and direct calls from the subpackage program code corresponding to the target function signature to the subpackage program code. The indirect calls that satisfy the replacement conditions include indirect calls corresponding to the target function signature.
[0191] Optionally, in the first runtime environment, if the direct calls of the candidate sub-package program code to the first package program code in the candidate sub-package program code are replaced with indirect calls to obtain the sub-package program code, then the direct calls that satisfy the replacement condition include the direct calls of the first package program code corresponding to the target function signature to the sub-package program code, and the indirect calls that satisfy the replacement condition include the indirect calls corresponding to the target function signature; in the second runtime environment, the direct calls that satisfy the replacement condition include the direct calls of the first package program code corresponding to the target function signature to the sub-package program code, and the indirect calls that satisfy the replacement condition include the indirect calls corresponding to the target function signature.
[0192] Step S306: The indirect calls corresponding to the target function signature and the direct calls that satisfy the replacement conditions are identified as S function calls that satisfy the replacement conditions.
[0193] Understandably, the computer device can execute steps S102-S104 after identifying S function calls that meet the replacement conditions. In other words, after processing the client program code into sub-packages, the computer device can replace direct calls and indirect calls that meet the replacement conditions with relocation function calls.
[0194] Optionally, the computer device can replace indirect calls that meet the replacement conditions with relocation function calls before processing the client program code into subpackages; the computer device can also replace direct calls that meet the replacement conditions with relocation function calls after processing the client program code into subpackages. In this case, the computer device can obtain the indirect calls corresponding to the target function signature (i.e., indirect calls that meet the replacement conditions) from the client program code of the application client, replace these indirect calls with relocation function calls, and obtain the replaced client program code. Further, the computer device can process the replaced client program code into subpackages to obtain first-package program code and sub-package program code. The specific process of the computer device processing the replaced client program code into subpackages can be found in the description of processing the client program code into subpackages, and will not be repeated here. Further, the computer device can obtain direct calls that meet the replacement conditions from the first-package program code and sub-package program code, replace these direct calls with relocation function calls, and obtain the replaced first-package program code and replaced sub-package program code.
[0195] Optionally, before repackaging the replaced client program code, the computer device can perform format conversion on the functions in the replaced client program code to obtain converted functions. The functions directly called in the converted functions are then modified from calling functions in the client program code to calling placeholder functions, resulting in the modified converted functions. The specific process of the computer device performing format conversion on the functions in the replaced client program code can be found in the description of function format conversion in client program code, and will not be repeated here.
[0196] Therefore, the embodiments of this application can determine the JS function (i.e. the modified conversion function) based on the client program code before processing the client program code into sub-packages to obtain the first package program code and the sub-package program code. In this way, when the client program code is repeatedly processed into sub-packages, the modified conversion function determined based on the client program code can be obtained directly without having to repeatedly determine the JS function based on the candidate sub-package program code, thus improving the efficiency of sub-package processing.
[0197] Further, please see Figure 8 , Figure 8 This is a schematic flowchart illustrating a data processing method provided in an embodiment of this application. This data processing method can be executed by a computer device, which can be the aforementioned... Figure 2 The server 20a in the corresponding embodiment can also be the one described above. Figure 2 The terminal device 20b in the corresponding embodiment. The data processing method may include the following steps S401-S402:
[0198] Step S401: Based on the function identifier of the target function, call the placeholder function in the relocation function;
[0199] The placeholder function in the relocation function is determined by the aggregate function call. The aggregate function call is used to call the placeholder function in the relocation function, and the placeholder function in the relocation function is used to call the functions called by the N function calls that satisfy the aggregation conditions.
[0200] Step S402: Obtain the target function corresponding to the function identifier from the replaced sub-package program code using the placeholder function, and execute the target function.
[0201] Understandably, in the second runtime environment, if direct calls that satisfy the replacement conditions include direct calls from the first package program code corresponding to the target function signature to the sub-package program code, direct calls from the sub-package program code corresponding to the target function signature to the first package program code, and direct calls from the sub-package program code corresponding to the target function signature to the sub-package program code, and indirect calls that satisfy the replacement conditions include indirect calls corresponding to the target function signature, then the computer device can obtain the target function corresponding to the function identifier from the replaced sub-package program code through the placeholder function and execute the target function.
[0202] Optionally, in the second runtime environment, if the direct call satisfying the replacement condition includes a direct call from the first package program code corresponding to the target function signature to the sub-package program code, and the indirect call satisfying the replacement condition includes an indirect call corresponding to the target function signature, then the computer device can obtain the target function corresponding to the function identifier from the replaced sub-package program code through the placeholder function. Further, if the target function contains a direct call from the replaced sub-package program code to the target first package program code, then the computer device can replace the direct call from the replaced sub-package program code to the target first package program code with an indirect call to obtain the replaced target function, and execute the replaced target function. Optionally, if the target function does not contain a direct call from the replaced sub-package program code to the target first package program code, then the computer device can execute the target function. For ease of understanding, this application embodiment uses the example of a direct call from the replaced sub-package program code to the target first package program code in the target function as an example. A direct call from the replaced sub-package program code to the target first package program code refers to the above-mentioned... Figure 7 The function call implemented by the placeholder function in step S303 of the corresponding embodiment.
[0203] Optionally, embodiments of this application may also generate a sub-package function index table for the second runtime environment. This sub-package function index table in the second runtime environment can store function references to JS functions. After the computer device obtains the function (e.g., the target function) corresponding to the function identifier from the replaced sub-package program code using a placeholder function, it can add the function reference of the target function to the sub-package function index table in the second runtime environment. In this way, when the computer device calls the placeholder function in the relocation function based on the function identifier of the target function the next time, it can indirectly call the target function corresponding to the function identifier through the sub-package function index table in the second runtime environment, without having to obtain the target function again from the replaced sub-package program code using a placeholder function. Similarly, before obtaining the target function corresponding to the function identifier from the replaced sub-package program code using a placeholder function, the computer device can determine whether a function reference to the target function corresponding to the function identifier exists in the sub-package function index table in the second runtime environment. If no function reference exists in the sub-package function index table, the target function is obtained from the replaced sub-package program code using a placeholder function.
[0204] For easier understanding, please refer to Figure 9 , Figure 9 This is a schematic diagram illustrating a runtime function modification process provided in an embodiment of this application. For example... Figure 9 As shown, when the application client in the terminal device runs to the point of loading JS functions on demand, the application client can execute step S21, and send a placeholder function call request to the developer tool plugin (hereinafter referred to as the plugin) through step S21. The placeholder function call request can include the function identifier of the function to be called (e.g., the target function). The function identifier is used to determine the target function called by the placeholder function (i.e., the target function actually called by the application client). The placeholder function is the entry point (or interface) provided by the plugin.
[0205] like Figure 9 As shown, the plugin can execute step S22, by sending a target function retrieval request to the server. The target function retrieval request may include client information of the application client and function identifier of the target function. The client information (e.g., game information) may include, but is not limited to, the client identifier of the application client and the sub-package version of the application client. The client identifier is used to identify the specific application client (e.g., the target mini-game), and the sub-package version is used to identify the versions of the first package and sub-packages. Different versions of the first package and sub-packages may include different functions.
[0206] like Figure 9As shown, the server can execute steps S23 and S24. Step S23 retrieves relocation information from the packet information storage based on client information. Step S24 retrieves a function from the function storage based on its function identifier (i.e., retrieves the target function based on its function identifier). Step S25 retrieves the target function, and step S26 retrieves the relocation information. The relocation information indicates whether the function called by a direct call in the target function is in the first packet (i.e., in the first packet or a sub-packet). This relocation information is stored after the client program code has been packetized. For example, the relocation information (function identifier 1, in the first packet) indicates that the function corresponding to function identifier 1 is in the first packet. If the function called by a direct call in the target function is in the first packet, then the direct call is a direct call from the replaced sub-packet program code to the target first packet program code. If the function called by a direct call in the target function is in a sub-packet, then the direct call is a direct call from the replaced sub-packet program code to the replaced sub-packet program code. In addition, relocation information can also be used to represent the relationship between function identifiers and reference identifiers, and the relationship between function identifiers and reference identifiers can be used to determine reference identifiers based on function identifiers.
[0207] Further, the server can execute step S27, in which it modifies the function according to the relocation information (i.e., modifies the target function according to the relocation information) to obtain the modified function (i.e., the modified target function). Specifically, the server can obtain the direct calls from the replaced sub-package program code to the target first package program code from the target function, and replace these direct calls with indirect calls to obtain the replaced target function. Further, the server can execute step S28, in which the modified target function is returned to the plugin.
[0208] like Figure 9 As shown, the plugin can execute step S29, storing and executing the modified function (i.e., the modified target function) to obtain the execution result (i.e., the function result) of the modified target function. Further, the plugin can execute step S30, returning the function result to the application client. For example, the target function can be used to purchase game equipment, and the execution result of the target function can indicate that the game equipment purchase was successful.
[0209] Therefore, this embodiment of the application can, when the application client is running in a second runtime environment, call the placeholder function in the relocation function according to the function identifier of the target function, obtain the target function corresponding to the function identifier from the replaced sub-package program code through the placeholder function, and then execute the replaced target function or target function according to whether there is a direct call to the target first package program code by the replaced sub-package program code in the target function, thereby reducing the compilation memory of the application client or improving the efficiency of sub-package processing.
[0210] Further, please see Figure 10 , Figure 10 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. The data processing device 1 may include: a call acquisition module 11, a function generation module 12, a call replacement module 13, and a function writing module 14; further, the data processing device 1 may also include: a function call module 15 and an index table generation module 16.
[0211] The module 11 is invoked to retrieve S function calls that satisfy the replacement conditions from the client program code of the application client; S is a positive integer, and the function signatures of the functions called by the S function calls are the signatures of the target functions; the client program code is divided into a first package program code and a sub-package program code, which are used to run the application client. The first package program code is the program code loaded at startup, and the sub-package program code is the program code loaded lazily.
[0212] Specifically, the call acquisition module 11 is used to obtain the indirect call corresponding to the target function signature from the client program code of the application client; the indirect call refers to the function call implemented through the function index table;
[0213] Call module 11, which is specifically used to process the client program code into packages to obtain the first package program code and the sub-package program code;
[0214] Among them, the call to the acquisition module 11 is specifically used to perform stubbing on the client program code to obtain the stubbing client program code;
[0215] Call the acquisition module 11, which is specifically used to run and process the client program code after the piling process, and obtain the function call indication information corresponding to the client program code;
[0216] The module 11 is invoked, which is specifically used to divide the client program code into the first package program code and the candidate sub-package program code according to the function call instruction information;
[0217] Calling module 11 is specifically used to determine the candidate sub-package program code as the sub-package program code if the application client's runtime environment is the first runtime environment, or to replace the direct call of the candidate sub-package program code to the first package program code with an indirect call to obtain the sub-package program code;
[0218] The module 11 is called, specifically to obtain the modified conversion function if the application client's runtime environment is the second runtime environment, and to determine the modified conversion function as the sub-package program code; the modified conversion function is obtained by modifying the direct call in the conversion function, and the conversion function is obtained by converting the format of the function in the client program code.
[0219] Specifically, calling the acquisition module 11 is also used to perform format conversion on functions in the client program code to obtain conversion functions;
[0220] The call to module 11 is also specifically used to modify the function called directly in the conversion function from the function in the calling client program code to the function called by a placeholder function, so as to obtain the modified conversion function; the placeholder function called directly in the modified conversion function is used to load the modified conversion function.
[0221] The module 11 is invoked, specifically to retrieve direct calls that meet the replacement conditions from the first package program code and the sub-package program code; direct calls refer to function calls implemented without using the function index table;
[0222] The acquisition module 11 is invoked, specifically to determine the indirect calls corresponding to the target function signature and the direct calls that meet the replacement conditions as S function calls that meet the replacement conditions.
[0223] Specifically, the call to the acquisition module 11 is used to obtain the first direct call from the first package program code to the sub-package program code from the first package program code;
[0224] Calling module 11 is specifically used to obtain the second direct call from the sub-package program code to the first package program code, and the third direct call from the sub-package program code to the sub-package program code.
[0225] Call the acquisition module 11, which is specifically used to acquire the runtime environment of the application client. If the runtime environment of the application client is the first runtime environment, then the direct call corresponding to the target function signature in the first direct call and the second direct call is determined as the direct call that satisfies the replacement condition.
[0226] The module 11 is invoked, specifically to determine the direct calls corresponding to the target function signatures in the first direct call, the second direct call, and the third direct call as direct calls that satisfy the replacement conditions if the application client's runtime environment is the second runtime environment.
[0227] Specifically, the call to the acquisition module 11 is used to obtain the first direct call from the first package program code to the sub-package program code from the first package program code;
[0228] The acquisition module 11 is invoked, specifically to determine the direct call corresponding to the target function signature in the first direct call as a direct call that satisfies the replacement condition.
[0229] The function generation module 12 is used to obtain N function calls that satisfy the aggregation condition and SN function calls that do not satisfy the aggregation condition from S function calls, aggregate the N function calls into an aggregate function call, and generate a relocation function corresponding to the target function signature based on the aggregate function call and the SN function calls; N is a positive integer less than or equal to S; the aggregate function call is used to call the placeholder function in the relocation function, and the placeholder function in the relocation function is used to call the function called by each of the N function calls;
[0230] The replacement module 13 is invoked to replace S function calls with relocation function calls, resulting in the replaced first package program code and the replaced sub-package program code; the relocation function call is used to directly invoke the relocation function;
[0231] The function writing module 14 is used to write relocation functions into the replaced first package program code to obtain the target first package program code; the relocation functions are used to call S functions in the target first package program code or the replaced sub-package program code during the running of the application client.
[0232] Optionally, the S function calls include the target function call, and the S relocation function calls include the target relocation function call corresponding to the target function call. The target function call is used to call the target function among the S functions.
[0233] Function call module 15 is used to compile the target first package program code during the running of the application client to obtain the first package compilation result corresponding to the target first package program code;
[0234] Function call module 15 is used to call the relocation function corresponding to the target function signature when the first package compilation result executes to the target relocation function call in the target first package program code, based on the target function signature of the target function associated with the target relocation function call;
[0235] Function call module 15 is used to obtain the virtual function index table and the rearranged function index table corresponding to the application client, and call the target function in the target first package program code or the replaced sub-package program code in the relocation function according to the reference identifier of the target function, the virtual function index table and the rearranged function index table.
[0236] Specifically, the function call module 15 is used to obtain the virtual parameters corresponding to the reference identifier of the target function from the virtual function index table, and to obtain the first package marker and the function identifier of the target function from the virtual parameters corresponding to the reference identifier of the target function.
[0237] Function call module 15 is specifically used to indirectly call the target function in the target first package program code in the relocation function according to the first package compilation result, the function identifier of the target function and the reordered function index table if the first package marker of the target function is the first marker parameter;
[0238] Function call module 15 is specifically used to call the target function in the replaced sub-package program code in the relocation function if the second flag parameter of the first package flag of the target function is true, based on the function identifier of the target function and the rearranged function index table.
[0239] Among them, the function call module 15 is specifically used to obtain the runtime environment of the application client. If the runtime environment of the application client is the first runtime environment, the replacement sub-package program code is compiled to obtain the sub-package compilation result corresponding to the replacement sub-package program code. Based on the sub-package compilation result, the function identifier of the target function and the rearranged function index table, the target function in the replacement sub-package program code is indirectly called in the relocation function.
[0240] Function call module 15 is specifically used to directly call the target function in the replaced subpackage program code in the relocation function according to the function identifier of the target function if the application client's runtime environment is the second runtime environment.
[0241] Specifically, the function call module 15 is used to call the placeholder function in the relocation function according to the function identifier of the target function; the placeholder function is determined by the aggregate function call.
[0242] Function call module 15 is specifically used to obtain the target function corresponding to the function identifier from the replaced subpackage program code through placeholder functions, and to execute the target function.
[0243] Specifically, the function call module 15 is used to obtain the target function corresponding to the function identifier from the replaced sub-package program code through the placeholder function;
[0244] Function call module 15 is specifically used to replace the direct call of the target first package program code by the replaced sub-package program code to the indirect call if there is a direct call of the target first package program code by the replaced sub-package program code in the target function, so as to obtain the replaced target function.
[0245] Function call module 15 is specifically used to execute the replaced target function.
[0246] Specifically, the function call module 15 is also used to obtain the virtual parameters to be updated that are associated with the function identifier of the target function from the virtual function index table;
[0247] The function call module 15 is also specifically used to merge the function identifier and the first marker parameter of the target function to obtain the updated virtual parameter;
[0248] Function call module 15 is also specifically used to update the virtual parameter to be updated by updating the virtual parameter.
[0249] Specifically, the function call module 15 is used to obtain the virtual function index table corresponding to the application client from the application client's index table file, and to obtain the reordered function index table corresponding to the application client from the target first package program code;
[0250] Function call module 15 is also specifically used to write the virtual function index table into the virtual machine's memory stack;
[0251] Function call module 15 is also specifically used to allocate client memory for the application client in the memory stack and write the virtual function index table into the engine heap of the client memory; the application client is used to manage the virtual function index table in the engine heap.
[0252] Optionally, the index table generation module 16 is used to supplement the function index table based on the target first package program code and the replaced sub-package program code, to obtain the supplemented function index table, and to obtain the indexed call function called by the function reference in the supplemented function index table;
[0253] The index table generation module 16 is used to determine the first package marker of the index call function based on the target first package program code, and to merge the first package marker and the function identifier of the index call function to obtain the virtual parameters corresponding to the function references in the supplemented function index table.
[0254] The index table generation module 16 is used to determine the order of virtual parameters corresponding to function references in the supplemented function index table according to the order of function references in the supplemented function index table, so as to obtain a virtual function index table.
[0255] The index table generation module 16 is used to determine the order of function references in the target first package program code and the replaced sub-package program code according to the order of function identifiers of the indexed function calls, and to obtain the rearranged function index table.
[0256] Among them, the index table generation module 16 is specifically used to perform function matching between the functions in the target first package program code and the index call functions to obtain the matching results;
[0257] The index table generation module 16 is specifically used to determine the first flag parameter as the first package flag of the index call function if the matching result indicates that the index call function belongs to the function in the target first package program code;
[0258] The index table generation module 16 is specifically used to determine the second flag parameter as the first package flag of the index call function if the matching result indicates that the index call function does not belong to the function in the target first package program code.
[0259] Specifically, the index table generation module 16 is used to obtain function references of functions in the target first package program code from the supplemented function index table, determine the order of function references of functions in the target first package program code according to the order of function identifiers of indexed functions, and obtain the first package function index table corresponding to the application client; the first package function index table is obtained after the target first package program code is compiled.
[0260] The index table generation module 16 is specifically used to obtain function references of functions in the replaced subpackage program code from the supplemented function index table, determine the order of function references in the replaced subpackage program code according to the order of function identifiers of indexed functions, and obtain the subpackage function index table corresponding to the application client; the subpackage function index table is obtained after the replaced subpackage program code is compiled.
[0261] The index table generation module 16 is specifically used to determine the first package function index table and the sub-package function index table as the rearranged function index table.
[0262] The specific implementation methods of the call acquisition module 11, function generation module 12, call replacement module 13, function writing module 14, and index table generation module 16 can be found in the above. Figure 3 The descriptions of steps S101-S104 in the corresponding embodiments will not be repeated here. The specific implementation of the function call module 15 can be found above. Figure 5 The descriptions of steps S201-S203 in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.
[0263] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0264] Further, please see Figure 11 , Figure 11 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device may be a terminal device or a server. Figure 11 As shown, the computer device 1000 may include a processor 1001, a network interface 1004, and a memory 1005. Furthermore, the computer device 1000 may also include a user interface 1003 and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. In some embodiments, the user interface 1003 may include a display screen and a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. Optionally, the network interface 1004 may include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the processor 1001. Figure 11 As shown, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application.
[0265] In such Figure 11 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface for users; and the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the steps in the methods of the various embodiments of this application.
[0266] It should be understood that the computer device 1000 described in the embodiments of this application can execute the foregoing text. Figure 3 and Figure 5 The description of the data processing method in the corresponding embodiments can also be performed as described above. Figure 10The description of the data processing device 1 in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated here.
[0267] Furthermore, it should be noted that this application embodiment also provides a computer-readable storage medium, which stores a computer program executed by the aforementioned data processing device 1. When the processor executes the computer program, it can execute the aforementioned... Figure 3 and Figure 5 The description of the data processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments related to this application, please refer to the description of the method embodiments of this application.
[0268] Furthermore, it should be noted that this application also provides a computer program product, which may include a computer program that can be stored in a computer-readable storage medium. The processor of a computer device reads the computer program from the computer-readable storage medium, and the processor can execute the computer program, causing the computer device to perform the aforementioned... Figure 3 and Figure 5 The description of the data processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer program product embodiments related to this application, please refer to the description of the method embodiments of this application.
[0269] 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 computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0270] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A data processing method, characterized by, The application comprises the following steps: S function calls meeting a replacement condition are obtained from client program code of an application client; S is a positive integer, and function signatures of functions called by the S function calls are target function signatures; the client program code is packaged into first package program code and sub package program code, the first package program code and the sub package program code are used to run the application client, the first package program code is program code of start loading, and the sub package program code is program code of delay loading; N function calls meeting an aggregation condition and S-N function calls not meeting the aggregation condition are obtained from the S function calls, the N function calls are aggregated into an aggregated function call, a relocation function corresponding to the target function signatures is generated according to the aggregated function call and the S-N function calls; N is a positive integer less than or equal to S; the aggregated function call is used to call a placeholder function in the relocation function, and the placeholder function in the relocation function is used to call functions called by the N function calls; the S function calls are respectively replaced by relocation function calls to obtain replaced first package program code and replaced sub package program code; the relocation function calls are used to directly call the relocation function; the relocation function is written in the replaced first package program code to obtain target first package program code; the relocation function is used to call S functions in the target first package program code or the replaced sub package program code in a process of running the application client.
2. The method of claim 1, wherein, The S function calls meeting the replacement condition are obtained from the client program code of the application client, comprising the following steps: an indirect call corresponding to the target function signatures is obtained from the client program code of the application client; the indirect call refers to a function call realized through a function index table; the client program code is packaged to obtain first package program code and sub package program code; direct calls meeting the replacement condition are obtained from the first package program code and the sub package program code; the direct call refers to a function call not realized through the function index table; the indirect call corresponding to the target function signatures and the direct call meeting the replacement condition are determined as the S function calls meeting the replacement condition.
3. The method of claim 2, wherein, The direct calls meeting the replacement condition are obtained from the first package program code and the sub package program code, comprising the following steps: a first direct call of the first package program code to the sub package program code is obtained from the first package program code; a second direct call of the sub package program code to the first package program code and a third direct call of the sub package program code to the sub package program code are obtained from the sub package program code; if a running environment of the application client is a first running environment, a direct call corresponding to the target function signatures in the first direct call and the second direct call is determined as a direct call meeting the replacement condition. If the running environment of the application client is a second running environment, the direct call corresponding to the target function signature in the first direct call, the second direct call and the third direct call is determined as a direct call satisfying a replacement condition.
4. The method of claim 1, wherein, The S function calls include a target function call, and the S repositioning function calls include a target repositioning function call corresponding to the target function call, the target function call being used to call a target function in the S functions; The method further includes: In the process of running the application client, the target first package program code is compiled to obtain a first package compilation result corresponding to the target first package program code; When the first package compilation result executes to the target repositioning function call in the target first package program code, the repositioning function corresponding to the target function signature of the target function associated with the target repositioning function call is called according to the target function signature of the target function. The virtual function index table and the rearranged function index table corresponding to the application client are obtained, and the target function in the target first package program code or the replaced sub-package program code is called in the repositioning function according to the reference identifier of the target function, the virtual function index table and the rearranged function index table.
5. The method of claim 4, wherein, The method further includes: The function index table is indexed and supplemented according to the target first package program code and the replaced sub-package program code to obtain a supplemented function index table, and an index call function called by a function reference in the supplemented function index table is obtained; The first package mark of the index call function is determined according to the target first package program code, and the first package mark of the index call function and the function identifier of the index call function are merged to obtain a virtual parameter corresponding to a function reference in the supplemented function index table; The order of the virtual parameter corresponding to the function reference in the supplemented function index table is determined according to the order of the function reference in the supplemented function index table to obtain the virtual function index table; The order of the function reference of the function in the target first package program code and the replaced sub-package program code is determined according to the order of the function identifier of the index call function to obtain the rearranged function index table.
6. The method of claim 5, wherein, The first package mark of the index call function is determined according to the target first package program code, and the first package mark of the index call function and the function identifier of the index call function are merged to obtain a virtual parameter corresponding to a function reference in the supplemented function index table; The order of the virtual parameter corresponding to the function reference in the supplemented function index table is determined according to the order of the function reference in the supplemented function index table to obtain the virtual function index table; The order of the function reference of the function in the target first package program code and the replaced sub-package program code is determined according to the order of the function identifier of the index call function to obtain the rearranged function index table. 7. The method of claim 5, wherein, obtaining a function reference of a function in the target first-package program code from the supplemented function index table, determining an order of the function reference of the function in the target first-package program code according to an order of function identifiers of the index calling function, and obtaining a first-package function index table corresponding to the application client; the first-package function index table is obtained after compiling the target first-package program code; obtaining a function reference of a function in the replaced sub-package program code from the supplemented function index table, determining an order of the function reference of the function in the replaced sub-package program code according to an order of function identifiers of the index calling function, and obtaining a sub-package function index table corresponding to the application client; the sub-package function index table is obtained after compiling the replaced sub-package program code; determining the first-package function index table and the sub-package function index table as the rearranged function index table.
8. The method of claim 4, wherein, the calling of the target function in the relocation function from the target first-package program code or the replaced sub-package program code according to the reference identifier of the target function, the virtual function index table and the rearranged function index table, includes: obtaining a virtual parameter corresponding to the reference identifier of the target function from the virtual function index table, and obtaining a first-package mark of the target function and a function identifier of the target function from the virtual parameter corresponding to the reference identifier of the target function; if the first-package mark of the target function is a first mark parameter, indirectly calling the target function in the target first-package program code in the relocation function according to the first-package compilation result, the function identifier of the target function and the rearranged function index table; if the first-package mark of the target function is a second mark parameter, calling the target function in the replaced sub-package program code in the relocation function according to the function identifier of the target function and the rearranged function index table.
9. The method of claim 8, wherein, the calling of the target function in the replaced sub-package program code in the relocation function according to the function identifier of the target function and the rearranged function index table, includes: obtaining a running environment of the application client, if the running environment of the application client is a first running environment, compiling the replaced sub-package program code to obtain a sub-package compilation result corresponding to the replaced sub-package program code, and indirectly calling the target function in the replaced sub-package program code in the relocation function according to the sub-package compilation result, the function identifier of the target function and the rearranged function index table; if the running environment of the application client is a second running environment, directly calling the target function in the replaced sub-package program code in the relocation function according to the function identifier of the target function.
10. The method of claim 9, wherein, the directly calling of the target function in the replaced sub-package program code in the relocation function according to the function identifier of the target function, includes: According to the function identifier of the target function, a placeholder function in the relocation function is called; the placeholder function is determined by the aggregation function call; The target function corresponding to the function identifier is obtained from the replaced sub-package program code through the placeholder function, and the target function is executed.
11. The method of claim 9, wherein, After the target function in the replaced sub-package program code is directly called in the relocation function according to the function identifier of the target function, the method further comprises: Obtaining a to-be-updated virtual parameter associated with the function identifier of the target function from the virtual function index table; Merging the function identifier of the target function and the first mark parameter to obtain an updated virtual parameter; Updating the to-be-updated virtual parameter through the updated virtual parameter.
12. The method of claim 4, wherein, The method further comprises: Obtaining the virtual function index table and the rearrangement function index table corresponding to the application client, comprising: Obtaining the virtual function index table corresponding to the application client from the index table file of the application client, and obtaining the rearrangement function index table corresponding to the application client from the target first package program code; The method further comprises: Writing the virtual function index table into the memory stack of the virtual machine; 13. The method of claim 2, wherein, Applying the client memory of the application client in the memory stack, and writing the virtual function index table into the engine heap of the client memory; the application client is used to manage the virtual function index table in the engine heap. The method further comprises: Punching the client program code to obtain the punched client program code; Performing running processing on the punched client program code to obtain function call indication information corresponding to the client program code; According to the function call indication information, the client program code is divided into a first package program code and a candidate sub-package program code; If the running environment of the application client is a first running environment, the candidate sub-package program code is determined as a sub-package program code, or the direct call of the candidate sub-package program code to the first package program code in the candidate sub-package program code is replaced by an indirect call to obtain a sub-package program code; 14. The method of claim 13, wherein, If the running environment of the application client is a second running environment, a modified conversion function is obtained, and the modified conversion function is determined as a sub-package program code; the modified conversion function is obtained by modifying the direct call in the conversion function, and the conversion function is obtained by format conversion on the function in the client program code. Before the client program code is divided into a first package program code and a sub-package program code, the method further comprises: Performing format conversion on the function in the client program code to obtain a conversion function; The function called by the direct call in the conversion function is modified to call a placeholder function, to obtain the modified conversion function; the placeholder function called by the direct call in the modified conversion function is used to load the modified conversion function.
15. The method of claim 2, wherein, The direct call satisfying the replacement condition is obtained from the first package program code and the sub-package program code, including: The first direct call of the first package program code to the sub-package program code is obtained from the first package program code; The direct call corresponding to the target function signature in the first direct call is determined as the direct call satisfying the replacement condition.
16. The method of claim 10, wherein, The target function corresponding to the function identifier is obtained from the replaced sub-package program code through the placeholder function, and the target function is executed, including: The target function corresponding to the function identifier is obtained from the replaced sub-package program code through the placeholder function; If the direct call of the replaced sub-package program code to the target first package program code exists in the target function, the direct call of the replaced sub-package program code to the target first package program code is replaced by an indirect call, to obtain a replaced target function; The replaced target function is executed.
17. A data processing apparatus, characterized by Including: The calling obtaining module is used to obtain S function calls satisfying a replacement condition from a client program code of an application client; S is a positive integer, and function signatures of functions respectively called by the S function calls are target function signatures; The client program code is used to be packaged into a first package program code and a sub-package program code, the first package program code and the sub-package program code are used to run the application client, the first package program code is a program code of start-up loading, and the sub-package program code is a program code of delay loading; The function generating module is used to obtain N function calls satisfying an aggregation condition and S-N function calls not satisfying the aggregation condition from the S function calls, aggregate the N function calls into an aggregated function call, and generate a relocation function corresponding to the target function signature according to the aggregated function call and the S-N function calls; N is a positive integer less than or equal to S; the aggregated function call is used to call a placeholder function in the relocation function, and the placeholder function in the relocation function is used to call functions respectively called by the N function calls; The calling replacement module is used to replace the S function calls by relocation function calls respectively, to obtain a replaced first package program code and a replaced sub-package program code; The relocation function call is used to directly call the relocation function; The function writing module is used to write the relocation function in the replaced first package program code, to obtain a target first package program code; The relocation function is used to call S functions in the target first package program code or the replaced sub-package program code in a process of running the application client.
18. A computer device, comprising: Including: A processor and a memory; The processor is connected with the memory, wherein the memory is configured to store a computer program, and the processor is configured to invoke the computer program to enable the computer device to perform the method in any one of claims 1-16.
19. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is adapted to be loaded and executed by the processor to enable the computer device having the processor to perform the method in any one of claims 1-16.
20. A computer program product, characterised in that, The computer program product comprises a computer program stored in a computer readable storage medium and adapted to be read and executed by the processor to enable the computer device having the processor to perform the method in any one of claims 1-16.