Function processing method and device, equipment, storage medium and product

By replacing the virtual machine method instance of the called function with a proxy function during the interpreted execution process, the applicability and source code modification issues of framework Java function calls in existing technologies are resolved, achieving more efficient and stable function processing.

CN122045587APending Publication Date: 2026-05-15BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2024-11-15
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies are difficult to adapt to scenarios involving inter-function calls between Java functions in frameworks when determining the cause of application exceptions, and require modification of the source code, resulting in poor flexibility and stability.

Method used

By replacing the virtual machine method instance of the called function with the virtual machine method instance of a preset proxy function during the interpreted execution of the called function, the called function can be processed without modifying the source code.

Benefits of technology

It improves the flexibility and versatility of function processing solutions, reduces the accuracy of source code modifications, adapts to more scenarios, and enhances processing efficiency and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122045587A_ABST
    Figure CN122045587A_ABST
Patent Text Reader

Abstract

The invention provides a function processing method and device, equipment, a storage medium and a product, and relates to the technical field of computers. The method comprises the steps that in response to the fact that a target called function is called by a target calling function, explanatory execution of the target called function is triggered, and in the explanatory execution process of the target called function, in response to the fact that a target interpreter function is called, explanatory execution of the target called function is triggered; a virtual machine method instance of a target tuned function in the input parameters of the target interpreter function is replaced with a virtual machine method instance of a first preset proxy function, and the target tuned function and the first preset proxy function have a preset corresponding relation; and in response to the condition that the first preset proxy function is called in the execution process of the target interpreter function, performing preset mode processing on calling of the target called function by executing the first preset proxy function. By adopting the technical scheme, the source code modification operation can be reduced, the accuracy of the source code is ensured, and the flexibility and universality of the function processing scheme are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to function processing methods, apparatus, devices, storage media, and products. Background Technology

[0002] During application development, stability and performance issues are frequently encountered in various application scenarios. If the cause of these issues is not identified and resolved in a timely manner, the application may malfunction, affecting normal use.

[0003] Currently, to determine the cause of an application (APP) exception, it is generally necessary to obtain the call information of the called function. This can be achieved by modifying the bytecode instructions when the application calls the function at compile time, so that the called function calls a proxy function before being invoked, and then the proxy function calls the called function, thereby obtaining the call information. However, the above-mentioned function processing scheme implemented at compile time has limited applicability. For example, it is not suitable for scenarios where Java functions within a framework call each other, and it is difficult to override dynamically executed plugin Java functions at runtime. Summary of the Invention

[0004] This disclosure provides a function processing method, apparatus, device, storage medium, and product, which can optimize existing function processing schemes for function call scenarios.

[0005] In a first aspect, embodiments of this disclosure provide a function processing method, including:

[0006] In response to the target called function being invoked by the target called function, the interpretation and execution of the target called function is triggered;

[0007] During the interpretation and execution of the target called function, in response to the call of the target interpreter function, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with the virtual machine method instance of the first preset proxy function, wherein the target called function and the first preset proxy function have a preset correspondence.

[0008] In response to the first preset proxy function being called during the execution of the target interpreter function, the call to the target called function is processed in a preset manner by executing the first preset proxy function.

[0009] Secondly, embodiments of this disclosure also provide a function processing apparatus, including:

[0010] The interpretation execution triggering module is used to trigger the interpretation execution of the target called function in response to the target called function being called by the target called function;

[0011] The replacement module is used to replace the virtual machine method instance of the target called function in the input parameters of the target interpreter function with the virtual machine method instance of a first preset proxy function in response to the target interpreter function being called during the interpretation and execution of the target called function, wherein the target called function and the first preset proxy function have a preset correspondence.

[0012] The function processing module is used to respond to the first preset proxy function being called during the execution of the target interpreter function, and to process the call to the target called function in a preset manner by executing the first preset proxy function.

[0013] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:

[0014] One or more processors;

[0015] Storage device for storing one or more programs.

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the function processing method provided in the embodiments of this disclosure.

[0017] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the function processing method provided in embodiments of this disclosure.

[0018] Fifthly, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the function processing method provided in this disclosure.

[0019] The function processing scheme provided in this disclosure, in response to a target called function being invoked by a target called function, triggers the interpretation and execution of the target called function. During the interpretation and execution of the target called function, in response to a call to the target interpreter function, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with a virtual machine method instance of a first preset proxy function. There is a preset correspondence between the target called function and the first preset proxy function. In response to a call to the first preset proxy function during the execution of the target interpreter function, the call to the target called function is processed in a preset manner by executing the first preset proxy function. By adopting the above technical solution, source code modification operations can be reduced, the accuracy of the source code can be guaranteed, and it can adapt to more scenarios, improving the flexibility and versatility of the function processing scheme. Attached Figure Description

[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0021] Figure 1 This is a flowchart illustrating a function processing method provided in an embodiment of the present disclosure;

[0022] Figure 2 This is a flowchart illustrating another function processing method provided in an embodiment of the present disclosure;

[0023] Figure 3 A schematic diagram of a framework provided for an embodiment of this disclosure;

[0024] Figure 4 A flowchart illustrating yet another function processing method provided in this embodiment of the disclosure;

[0025] Figure 5 This is a schematic diagram of the structure of a function processing device provided in an embodiment of the present disclosure;

[0026] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0027] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0028] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0029] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0030] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0031] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0032] To facilitate understanding of the technical solutions of the embodiments of this disclosure, related technologies are described below. In related technologies, bytecode instructions when an app calls a function are modified during compilation. This involves adding proxy function-related calling logic between the code logic of the calling function and the called function. For example, if function A (the calling function) in the app calls function B (the called function) in the framework, after the proxy logic of the proxy function is inserted, function A calls the proxy function, the proxy function calls function B, and the proxy function performs the call to function B, etc., thereby obtaining call information, which may include input parameter information and return values. This solution requires modification of the source code, changing the calling logic in the source code from function A calling function B to function A calling the proxy function, and the proxy function calling function B. This may affect the accuracy of the source code due to accidental modifications, thus affecting the normal operation of the app and causing app abnormalities. Furthermore, its applicability is limited. For example, in scenarios where Framework Java functions call each other, since Framework Java functions are Java functions of the electronic device's system framework, the APP development side cannot modify them during compilation. Therefore, the existing solution is not applicable. Furthermore, the existing solution cannot cover all Java runtime files, and dynamically executed plugin Java functions at runtime are easily missed. Moreover, when adding a plugin, the APP needs to be recompiled, resulting in poor flexibility and low implementation efficiency.

[0033] In this embodiment of the disclosure, there is no need to modify the source code to add proxy function-related calling logic in the code logic of calling the called function in the source code. Instead, the ArtMethod instance of the called function is replaced with the ArtMethod instance of the first preset proxy function during the interpretation and execution of the called function, so that the first preset proxy function can process the called function.

[0034] Figure 1This is a flowchart illustrating a function processing method provided in an embodiment of the present disclosure. This embodiment is applicable to function processing scenarios involving function calls. The method can be executed by a function processing device, which can be implemented in software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal like a mobile phone, smartwatch, tablet computer, or personal digital assistant, or a device like a personal computer (PC) or server.

[0035] like Figure 1 As shown, the method includes:

[0036] Step 101: In response to the target called function being called by the target called function, the interpretation and execution of the target called function is triggered.

[0037] In this embodiment, an application client runs on the electronic device, and the operating system of the electronic device may be, for example, Android. The target called function may be a pre-defined function that needs to be processed in a preset manner, and the preset manner can be set according to actual needs, without any specific limitation. The target calling function may be any function capable of calling the target called function. The function in this embodiment may be any function running on the electronic device, and may be a function based on a preset programming language, such as Java or Kotlin. The function in this embodiment may be executed in a preset virtual machine, which is the application virtual machine in the operating system and is a key component for running the Android application package (APK) file on the electronic device, specifically the Android Runtime (ART) virtual machine.

[0038] Taking Java functions as an example, Java functions in the abstract layer are described by the ArtMethod class in the Android ART virtual machine. The ArtMethod class can be understood as a structure, and each Java function corresponds to an instance of the ArtMethod class (i.e., an ArtMethod instance), also known as an ArtMethod object. An ArtMethod instance can include metadata about the corresponding Java function, such as access flags, function index, and offset. In the Android ART virtual machine, the execution of Java functions mainly includes two categories: interpreted execution and machine code execution. For interpreted execution, this involves shadowFrame (a data structure used to describe the stack frame corresponding to the function in interpreted execution mode), ArtMethod, codeItem (a structure in DexFile containing instructions and metadata related to function execution) to Dalvik code (bytecode running on the virtual machine). For machine code execution, this involves JIT (Just-In-Time) or OAT (Ahead-Of-Time) compilation to native code.

[0039] In this embodiment of the disclosure, a proxy function is introduced during the interpreted execution of the target called function. That is, when the target called function is called by the target calling function, it needs to be executed in an interpreted manner. Therefore, after the target called function is called by the target calling function, the interpreted execution of the target called function is triggered.

[0040] Step 102: During the interpretation and execution of the target called function, in response to the call of the target interpreter function, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with the virtual machine method instance of the first preset proxy function, wherein the target called function and the first preset proxy function have a preset correspondence.

[0041] For example, a virtual machine method can be an ArtMethod. Interpreted execution can be implemented using an interpreter. During interpreted execution, many interpreter functions may be involved. ArtMethod instances can be included in the input parameters of some of these interpreter functions, which can be designated as target interpreter functions. During interpreted execution, when an interpreter function is called, it can be determined whether the input parameters of the called interpreter function contain an ArtMethod instance of the target called function. If so, the called interpreter function is the target interpreter function. For the target interpreter function, the ArtMethod instance of the target called function in its input parameters is replaced with the ArtMethod instance of the first preset proxy function.

[0042] In this embodiment, the first preset proxy function is a pre-written proxy function. A preset correspondence exists between the target called function and the first preset proxy function; specifically, this correspondence can be a one-to-one relationship between the class to which the target called function belongs and the first preset proxy function. The technical solution of this disclosure can be implemented using a Software Development Kit (SDK). The implementation logic of the first preset proxy function and the preset object relationship can be included in the SDK. The implementation logic of the first preset proxy function may include logic related to processing the call to the target called function in a preset manner. Optionally, when applying the SDK, the target called function can be configured to specify the called function to be processed in a preset manner, thus meeting actual needs.

[0043] Step 103: In response to the first preset proxy function being called during the execution of the target interpreter function, the call to the target called function is processed in a preset manner by executing the first preset proxy function.

[0044] For example, after replacing the ArtMethod instance of the target called function in the input parameters of the target interpreter function with the ArtMethod instance of the first preset proxy function, the target interpreter function can be executed. During the execution of the target interpreter function, because the ArtMethod instance of the target called function in its input parameters has been replaced with the ArtMethod instance of the first preset proxy function, the call to the first preset proxy function will be triggered. After the first preset proxy function is called, the call to the target called function is processed in a preset manner by executing the first preset proxy function. The preset processing may include, for example, obtaining call information, which may include the function call thread, input parameters, and return value, etc.

[0045] The function processing method provided in this disclosure, in response to a target called function being called by a target calling function, triggers the interpretation and execution of the target called function. During the interpretation and execution of the target called function, in response to a target interpreter function being called, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with a virtual machine method instance of a first preset proxy function. The target called function and the first preset proxy function have a preset correspondence. In response to the first preset proxy function being called during the execution of the target interpreter function, the call to the target called function is processed in a preset manner by executing the first preset proxy function. By adopting the above technical solution, it is not necessary to modify the source code to add proxy function-related call logic in the code logic of the calling function calling the called function. During the interpretation and execution of the called function, by replacing the virtual machine method instance of the called function with the virtual machine method instance of the first preset proxy function, the processing of the called function by the first preset proxy function is realized, reducing source code modification operations, ensuring the accuracy of the source code, and adapting to more scenarios, thus improving the flexibility and versatility of the function processing solution. In this embodiment, the function description layer, located between the function implementation layer and the function abstraction layer, is selected for function-related replacement. Compared with the solution based on the upper-layer interface, the solution based on the lower-layer interface is more stable and reliable. Moreover, processing at the function description layer can reduce the amount of data processing for function-related replacement operations and improve processing efficiency compared to processing at the function implementation layer. In addition, this solution can reuse the data structure and data processing flow of ART itself, avoid introducing unnecessary problems due to modifications, improve the stability of the solution, and ensure the normal operation of the application.

[0046] In some embodiments, the target called function and / or the target invoked function includes framework Java functions and / or plugin Java functions. This allows for adaptation to different scenarios.

[0047] For example, in the scenario of mutual calls between Framework Java functions as described above, since the technical solution of this disclosure embodiment does not require modification of the source code, there is no problem that the APP development side cannot modify it during the compilation period. When both the target called function and the target calling function are Framework Java functions, the call to the target called function can still be effectively processed in a preset manner.

[0048] For example, as mentioned earlier, the problem of easily missing Java functions in plugins can be addressed by writing corresponding proxy functions and establishing corresponding preset relationships for the Java functions in each plugin. When adding a new plugin, only the corresponding proxy function and the corresponding preset relationship need to be added, without recompiling the APP, which can improve flexibility and increase implementation efficiency.

[0049] In some embodiments, the call to the target called function is processed in a preset manner by executing the first preset proxy function, including at least one of the following (1) to (4):

[0050] (1) The target called function is invoked by executing the first preset proxy function, and the input parameter information of the target called function is obtained.

[0051] For example, because the ArtMethod instance of the target called function in the input parameters of the target interpreter function is replaced with the ArtMethod instance of the first preset proxy function, the first preset proxy function is called before the target called function is executed. Therefore, the first preset proxy function can read the input parameter information of the target called function. The input parameter information of the target called function, as a kind of invocation information, can be used to trace the source of APP exceptions. The specific invocation method of calling the target called function by executing the first preset proxy function is not limited; for example, it can be implemented by reflection.

[0052] (2) The target called function is invoked by executing the first preset proxy function, the return value of the target called function is obtained, and the return value is returned to the target calling function.

[0053] For example, the target called function can be executed under the call of the first preset proxy function. In this case, for the target called function, the first preset proxy function is the actual calling function. Therefore, after execution, the target called function will return a value to the first preset proxy function, allowing the first preset proxy function to read the return value of the target called function. The return value of the target called function, as a form of call information, can be used for tracing the source of APP exceptions. Furthermore, to ensure the normal execution of the target calling function, the first preset proxy function returns the obtained return value to the target calling function, which can then perform subsequent related processing based on this return value.

[0054] (3) The target called function is called by executing the first preset proxy function, the return value of the target called function is obtained, the obtained return value is modified to obtain the target return value, and the target return value is returned to the target calling function.

[0055] For example, if an exception occurs in the target called function, or in a related test scenario, the actual return value returned by the target called function can be modified by the first preset proxy function, and the modified return value (denoted as the target return value) can be returned to the target calling function. The target calling function can then perform subsequent related processing based on the target return value to achieve exception handling or meet related test requirements.

[0056] (4) Stop calling the target called function by executing the first preset proxy function.

[0057] For example, if an exception occurs in the target called function, or in a related test scenario, the call to the target called function can be stopped through the first preset proxy function to achieve exception handling or meet the relevant test requirements.

[0058] In some embodiments, before triggering the interpreted execution of the target called function in response to being called by the target calling function, the method further includes: determining a target called function and a first preset proxy function with a preset correspondence based on preset configuration information; and calling a preset add interface using symbolic calls to add the ArtMethod instance of the target called function and the ArtMethod instance of the first preset proxy function to a preset set, wherein the function to which the ArtMethod instance in the preset set belongs is set to interpreted execution state. Thus, by performing relevant processing before the target called function is called by the target calling function, the target called function is ensured to execute in the expected interpreted execution mode, thereby achieving successful replacement of the subsequent ArtMethod instance.

[0059] For example, the preset addition interface can specifically be an interface used to add ArtMethod instances of functions to a preset collection. The functions to which the ArtMethod instances in the preset collection belong are set to interpreted execution state, that is, when the functions to which the ArtMethod instances in the preset collection belong are called, they are executed in interpreted execution mode. Taking the Android operating system as an example, the preset collection can be a deoptimized collection, and the preset addition interface can be the InstrumentationAddDeoptimized interface. In this embodiment of the disclosure, the preset addition interface can be called using symbolic calls. Symbolic calls can be understood as calling functions through symbol names. Symbol names can be identifiers in the source code, which are mapped to addresses in memory during the compilation process, such as the name of the preset addition interface. The address of the symbol (interface name) in the dynamic library can be dynamically obtained at runtime through dynamic linking functions (such as dlsym), and the preset addition interface can be called based on the obtained address.

[0060] For example, preset configuration information can be stored in the SDK. After the app starts, the preset configuration information is read to determine the target called function and the first preset proxy function with a preset correspondence. The ArtMethod instances of the target called function and the first preset proxy function are then added to a preset set. Therefore, when the target called function is invoked, it can be executed in an interpreted manner, thereby replacing the ArtMethod instance of the target called function in the input parameters of the target interpreter function with the ArtMethod instance of the first preset proxy function.

[0061] In some embodiments, if the first preset proxy function needs to call the target called function, the target called function will be called again and executed in an interpreted manner. To prevent the ArtMethod instance of the target called function in the input parameters of the target interpreter function from being replaced with the ArtMethod instance of the first preset proxy function again during the interpreted execution process, recursive or nested execution of the proxy function can be prevented. Specifically, this can be achieved by adding a preset switch and setting the state of the preset switch.

[0062] Figure 2 This is a flowchart illustrating another function processing method provided in this embodiment. This embodiment optimizes the various optional solutions in the above embodiments. Specifically, the method includes the following steps:

[0063] Step 201: Determine the target called function and the first preset proxy function that have a preset correspondence based on the preset configuration information.

[0064] For example, this step is performed after the app is launched.

[0065] Step 202: Call the preset add interface using symbolic calling to add the ArtMethod instance of the target called function and the ArtMethod instance of the first preset proxy function to the preset set. The function to which the ArtMethod instance in the preset set belongs is set to interpreted execution state.

[0066] Optionally, the preset switch can be initialized to the on state, or the preset switch can be set to the on state after the ArtMethod instance of the target called function and the ArtMethod instance of the first preset proxy function are added to the preset set.

[0067] For example, the app's homepage can be displayed after this step.

[0068] Step 203: In response to the target called function being called by the target called function, the interpretation and execution of the target called function is triggered.

[0069] Step 204: During the interpretation and execution of the target called function, in response to the call of the target interpreter function, if it is determined that the input parameters of the target interpreter function include the ArtMethod instance of the target called function and the preset switch is in the on state, the ArtMethod instance of the target called function in the input parameters of the target interpreter function is replaced with the ArtMethod instance of the first preset proxy function.

[0070] For example, taking the Android operating system as an example, target interpreter functions may include artQuickToInterpreterBridge, art_quick_invoke_static_stub, art_quick_invoke_stub, EnterInterpreterFromInvoke, and DoCall. <false>wait.

[0071] For example, the ArtMethod instance of the target called function in the input parameters of the target interpreter function can be replaced with the ArtMethod instance of the first preset proxy function by executing a preset replacement function. The preset replacement function can be a proxy function written based on a preset inline replacement framework. There is a pre-defined correspondence between the preset replacement function and the target interpreter function. To distinguish it from the preset correspondence in the text, it is referred to as the target correspondence here.

[0072] Optionally, after the app starts, the preset replacement function can also be initialized to ensure successful execution of this step. The preset inline replacement framework can be a framework for modifying function calls at runtime. By calling the target interface in this framework and inputting the target interpreter function and the preset replacement function, the preset replacement function can be initialized.

[0073] Step 205: In response to the first preset proxy function being called during the execution of the target interpreter function, the preset switch is set to the off state, the target called function is called by executing the first preset proxy function, and the call information of the target called function is obtained, and the preset switch is set to the on state.

[0074] In this step, after the first preset proxy function is called by the target interpreter function, the preset switch is first set to the off state to prevent the ArtMethod instance of the target called function in the input parameters of the target interpreter function from being replaced with the ArtMethod instance of the first preset proxy function again during the subsequent interpretation and execution of the first preset proxy function. After the target called function is called and the relevant call information is obtained, the preset switch can be set to the on state. Thus, after the target called function is called by the target calling function and the interpretation and execution of the target called function is triggered, the ArtMethod instance of the target called function in the input parameters of the target interpreter function can still be replaced with the ArtMethod instance of the first preset proxy function because the preset switch is set to the on state. This allows the first preset proxy function to process the call to the target called function in a preset way.

[0075] The function processing method provided in this embodiment determines a target called function and a first preset proxy function with a preset correspondence based on preset configuration information. It then uses symbolic calling to invoke a preset addition interface to add the ArtMethod instances of the target called function and the first preset proxy function to a preset set. During the interpretation and execution process triggered by the target called function, for the called target interpreter function, if it is determined that its input parameters include the ArtMethod instance of the target called function and the preset switch is on, the ArtMethod instance of the target called function in the input parameters of the target interpreter function is replaced with the ArtMethod instance of the first preset proxy function. After the first preset proxy function is called by the target interpreter function, the preset switch is first set to the off state. The target called function is then called by executing the first preset proxy function, and the call information of the target called function is obtained. Finally, the preset switch is set to the on state. This method can flexibly and efficiently obtain the call information of the target called function and avoid recursive replacement of the ArtMethod instance of the target called function, further improving function processing efficiency.

[0076] In some embodiments, the processing result after the call to the target called function is processed in a preset manner by executing the first preset proxy function, such as the obtained call information, can be used by the preset tools in the preset toolset of the application layer. An interface layer can be set up so that the implementation layer can execute the function processing method in this embodiment of the disclosure and return the processing result to the preset tools of the application layer through the interface layer.

[0077] For example, Figure 3 This is a schematic diagram of a framework provided by an embodiment of the present disclosure. The framework includes an application layer, an interface layer, an implementation layer, and an infrastructure layer. The application layer includes a preset toolset, which may include, for example, a message queue crash detection tool, a view (e.g., the root view, DecorView) crash detection and repair tool, a tool for detecting the creation of preset view classes (e.g., ViewRootImpl) by child threads, and a tool for detecting automatically triggered system exit (System.exit) events, etc. Target call functions can be categorized, with different categories of target call functions corresponding to different interfaces in the interface layer. For example... Figure 3 As shown, function categories can include direct functions, virtual functions, and initialization functions. Direct functions can include static functions, final functions, and private functions; virtual functions can include public functions, packaged functions, and protected functions; initialization functions can include class initialization functions and instance initialization functions. The implementation layer includes adding ArtMethod instances to the Deoptimized collection, proxy execution of target interpreter functions, replacement of ArtMethod instances, and implementation of the original call origin of the target calling function. The infrastructure layer includes basic capabilities such as the dlsym function related to symbolic calls and the inline replacement framework.

[0078] In some embodiments, the scheme can be further optimized according to the virtual function category. For example, after determining the target called function and the first preset proxy function with a preset correspondence based on preset configuration information, the method further includes: if the target called function is a virtual function, then replacing the ArtMethod instance of the target called function in the virtual function table of the function class to which the target called function belongs with the ArtMethod instance of the first preset proxy function. Therefore, in the case where the target called function is a virtual function, the successful execution of the first preset proxy function can be guaranteed.

[0079] Figure 4 This is a flowchart illustrating another function processing method provided in this disclosure. This disclosure optimizes the various optional solutions in the above embodiments, refining the steps related to calling the target called function through a first preset proxy function. Specifically, the method includes the following steps:

[0080] Step 401: Determine the target called function and the first preset proxy function that have a preset correspondence based on the preset configuration information.

[0081] Step 402: Call the preset add interface using symbolic calling to add the ArtMethod instance of the target called function and the ArtMethod instance of the first preset proxy function to the preset set. The function to which the ArtMethod instance in the preset set belongs is set to interpreted execution state.

[0082] Step 403: In response to the target called function being called by the target called function, the interpretation and execution of the target called function is triggered.

[0083] Step 404: During the interpretation and execution of the target called function, in response to the call of the target interpreter function, if it is determined that the input parameters of the target interpreter function include the ArtMethod instance of the target called function and the preset switch is in the on state, the ArtMethod instance of the target called function in the input parameters of the target interpreter function is replaced with the ArtMethod instance of the first preset proxy function.

[0084] Step 405: In response to the first preset proxy function being called during the execution of the target interpreter function, the preset switch is set to the off state.

[0085] Step 406: By executing the first preset proxy function, a preset virtual reflection function is invoked, and the instance information of the ArtMethod instance of the target called function and the input parameter information of the target called function are passed to the preset virtual reflection function.

[0086] For example, a reflection-based invocation method can be used to call the target function. However, when the target function is a virtual function, the virtual function's invocation parameters (such as the first invocation parameter `this`) have a parent-child inheritance relationship. If the system's native reflection invocation method, such as the `Method.invoke` function, is used, the original system flow will call the subclass's `ArtMethod` based on the virtual function table of the class to which `this` belongs. However, in this disclosure, the parent class's `ArtMethod` needs to be called. Therefore, to avoid invocation errors, this embodiment can specify the `ArtMethod` to be called, that is, specify the parent class's `ArtMethod` to be called, avoiding the execution of the system's reworked subclass virtual function lookup process. The `Method.invoke` function is declared as a native Java function. In this embodiment, a second preset proxy function can be used to proxy the implementation of the `Method.invoke` function, and the parent class's `ArtMethod` to be called can be passed through the original function parameters (`obj` and `args`) of the `Method.invoke` function. Here, the `obj` parameter represents the object instance of the method to be called, and `args` represents the parameters to be passed to the function to be called.

[0087] In this embodiment, to maintain the original execution state of the virtual machine and ensure the stability of the execution scheme, a new Java function, called the preset virtual reflection function, is added. This function is internally empty and its purpose is to encapsulate execution information. The preset virtual reflection function can be used to identify whether to reflectively call the second preset proxy function or the system's Method.invoke function. By executing the first preset proxy function, the preset virtual reflection function is called, and the instance information of the ArtMethod instance of the target called function and the input parameter information of the target called function are passed to the preset virtual reflection function.

[0088] Step 407: If the target called function is determined to be a preset function by executing the preset virtual reflection call function, the second preset proxy function is invoked by reflection, and the instance information of the ArtMethod instance of the target called function and the input parameter information of the target called function are passed to the second preset proxy function through the reflection call parameters.

[0089] For example, during app initialization, preset function information can be initialized. This preset function information includes functions that need to be processed using the methods described in this embodiment. Once the preset virtual reflection call function is determined, and the target called function is a preset function, a call to the target called function can be identified. Currently, a second preset proxy function needs to be reflected. The preset virtual reflection call function can pass the instance information of the ArtMethod instance of the target called function and the input parameter information of the target called function to the second preset proxy function through reflection call parameters (javaReceiver).

[0090] Step 408: By executing the second preset proxy function to interpret the reflection call parameters, the instance information of the ArtMethod instance of the target called function and the input parameter information of the target called function are obtained. The virtual machine's reflection function is called by symbolic calling so that the virtual machine's reflection function can call the ArtMethod instance of the target called function based on the instance information and the input parameter information of the target called function. The call information of the target called function is returned to the first preset proxy function, and the preset switch is set to the on state by the first preset proxy function.

[0091] For example, the javaReceiver is parsed through the second preset proxy function, and the instance information (originMethods) of the ArtMethod instance of the target called function and the input parameter information (originReceiver) of the target called function are obtained from obj and args. The virtual machine's reflection function (art::ArtMethod::Invoke) is called through the dlsym symbol to obtain the corresponding ArtMethod instance of the target called function based on the instance information and the input parameter information of the target called function. After obtaining the call result, the call information of the target called function is returned to the first preset proxy function, and the preset switch is set to the on state through the first preset proxy function.

[0092] It should be noted that if the target called function is not a virtual function, it can also be processed in the manner of steps 406-408. This avoids developing different calling implementation logic for virtual and non-virtual functions, reduces condition judgments, reduces code development, improves development efficiency, and ensures the stability of the solution.

[0093] The function processing method provided in this embodiment determines a target called function and a first preset proxy function with a preset correspondence based on preset configuration information. It then calls a preset addition interface using symbolic calls to add the ArtMethod instances of the target called function and the first preset proxy function to a preset set. During the interpretation and execution process triggered by the target called function, for the called target interpreter function, if it is determined that its input parameters include the ArtMethod instance of the target called function and the preset switch is on, the ArtMethod instance of the target called function in the input parameters of the target interpreter function is replaced with the first preset... The ArtMethod instance of the proxy function, after the first preset proxy function is called by the target interpreter function, first sets the preset switch to the off state. Then, through the preset virtual reflection function and the second preset proxy function, the ArtMethod of the target called function to be called is specified, avoiding the calling of the ArtMethod instance of the sub-function. Finally, the call information of the target called function is obtained, and then the preset switch is set to the on state. This can flexibly and efficiently obtain the call information of the target called function, avoid the recursive replacement of the ArtMethod instance of the target called function, and avoid the accidental calling of the ArtMethod instance of its sub-function when the target called function is a virtual function, further improving the accuracy of function processing.

[0094] Figure 5 This is a schematic diagram of the structure of a function processing device provided in an embodiment of the present disclosure, as shown below. Figure 5 As shown, the device includes:

[0095] The interpretation execution triggering module 501 is used to trigger the interpretation execution of the target called function in response to the target called function being called by the target called function;

[0096] The replacement module 502 is used to replace the virtual machine method instance of the target called function in the input parameters of the target interpreter function with the virtual machine method instance of the first preset proxy function in response to the target interpreter function being called during the interpretation and execution of the target called function, wherein the target called function and the first preset proxy function have a preset correspondence relationship;

[0097] The function processing module 503 is used to respond to the first preset proxy function being called during the execution of the target interpreter function, and to process the call to the target called function in a preset manner by executing the first preset proxy function.

[0098] The function processing apparatus provided in this disclosure does not require modification of the source code to add proxy function-related calling logic between the code logic of calling the called function in the source code. During the interpretation and execution of the called function, the virtual machine method instance of the called function is replaced with the virtual machine method instance of the first preset proxy function, thereby realizing the processing of the called function by the first preset proxy function. This reduces source code modification operations, ensures the accuracy of the source code, and can adapt to more scenarios, improving the flexibility and versatility of the function processing scheme. In this disclosure, the function description layer, located between the function implementation layer and the function abstraction layer, is selected for function-related replacement. Compared with the scheme based on the upper-layer interface, the scheme based on the lower-layer interface is more stable and reliable. Moreover, processing at the function description layer can reduce the amount of data processing for function-related replacement operations and improve processing efficiency compared to processing at the function implementation layer. In addition, this scheme can reuse the data structure and data processing flow of ART itself, avoiding unnecessary problems introduced by modifications, improving the stability of the scheme, and ensuring the normal operation of the application.

[0099] Optionally, the call to the target called function is processed in a preset manner by executing the first preset proxy function, including at least one of the following:

[0100] The first preset proxy function is executed to call the target called function, and the input parameter information of the target called function is obtained.

[0101] The first preset proxy function is executed to call the target called function, the return value of the target called function is obtained, and the return value is returned to the target calling function;

[0102] The first preset proxy function is executed to call the target called function, the return value of the target called function is obtained, the obtained return value is modified to obtain the target return value, and the target return value is returned to the target calling function.

[0103] The call to the target called function is stopped by executing the first preset proxy function.

[0104] Optionally, the replacement module is used to: during the interpretation and execution of the target called function, in response to the target interpreter function being called, if it is determined that the input parameters of the target interpreter function include a virtual machine method instance of the target called function, and the preset switch is in the on state, replace the virtual machine method instance of the target called function in the input parameters of the target interpreter function with a virtual machine method instance of a first preset proxy function;

[0105] The device also includes:

[0106] The shutdown state setting module is used to set the preset switch to the off state before calling the target called function by executing the first preset proxy function;

[0107] The enabled state setting module is used to set the preset switch to the enabled state after the target called function is invoked by executing the first preset proxy function.

[0108] Optionally, the device may also include:

[0109] The relationship determination module is used to determine, based on preset configuration information, a target called function and a first preset proxy function that have a preset corresponding relationship before the interpretation and execution of the target called function is triggered in response to the target called function being called by the target called function.

[0110] The instance addition module is used to call a preset addition interface using symbolic calls to add the virtual machine method instance of the target called function and the virtual machine method instance of the first preset proxy function to a preset set, wherein the function to which the virtual machine method instance in the preset set belongs is set to interpreted execution state.

[0111] Optionally, the device may also include:

[0112] The virtual function table replacement module is used to replace the virtual machine method instance of the target called function in the virtual function table of the function class to which the target called function belongs with the virtual machine method instance of the first preset proxy function after determining the target called function and the first preset proxy function that have a preset correspondence based on the preset configuration information.

[0113] Optionally, the step of calling the target called function by executing the first preset proxy function includes:

[0114] By executing the first preset proxy function, a preset virtual reflection function is invoked, and the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are passed to the preset virtual reflection function.

[0115] If the target called function is determined to be a preset function by executing the preset virtual reflection call function, the second preset proxy function is invoked by reflection, and the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are passed to the second preset proxy function through the reflection call parameters.

[0116] By executing the second preset proxy function to interpret the reflection call parameters, the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are obtained. The virtual machine's reflection function is then invoked through symbolic invocation, so that the virtual machine method instance of the target called function can be invoked by the virtual machine's reflection function based on the instance information and the input parameter information of the target called function.

[0117] The function processing apparatus provided in this disclosure can execute the function processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0118] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0119] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 6 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 6 The diagram below shows the structure of the terminal device or server 600. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0120] like Figure 6 As shown, electronic device 600 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of electronic device 600. The processing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. An edit / output (I / O) interface 605 is also connected to bus 604.

[0121] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0122] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.

[0123] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0124] The electronic device provided in this embodiment and the function processing method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0125] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the function processing method provided in the above embodiments.

[0126] This disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the function processing method provided in the above embodiments.

[0127] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0128] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0129] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes the aforementioned one or more programs, the electronic device causes the following: in response to a target called function being called by a target calling function, the electronic device triggers the interpretation and execution of the target called function; during the interpretation and execution of the target called function, in response to a target interpreter function being called, the electronic device replaces the virtual machine method instance of the target called function in the input parameters of the target interpreter function with a virtual machine method instance of a first preset proxy function, wherein the target called function and the first preset proxy function have a preset correspondence; in response to the first preset proxy function being called during the execution of the target interpreter function, the electronic device processes the call to the target called function in a preset manner by executing the first preset proxy function.

[0130] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0131] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0132] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a module does not necessarily limit the module itself; for example, an interpreted execution triggering module can also be described as "a module that triggers the interpreted execution of a target called function in response to the target called function being called by a target calling function."

[0133] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0134] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0135] According to one or more embodiments of this disclosure, a function processing method is provided, comprising:

[0136] In response to the target called function being invoked by the target called function, the interpretation and execution of the target called function is triggered;

[0137] During the interpretation and execution of the target called function, in response to the call of the target interpreter function, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with the virtual machine method instance of the first preset proxy function, wherein the target called function and the first preset proxy function have a preset correspondence.

[0138] In response to the first preset proxy function being called during the execution of the target interpreter function, the call to the target called function is processed in a preset manner by executing the first preset proxy function.

[0139] According to one or more embodiments of this disclosure, the call to the target called function is processed in a preset manner by executing the first preset proxy function, including at least one of the following:

[0140] The first preset proxy function is executed to call the target called function, and the input parameter information of the target called function is obtained.

[0141] The first preset proxy function is executed to call the target called function, the return value of the target called function is obtained, and the return value is returned to the target calling function;

[0142] The first preset proxy function is executed to call the target called function, the return value of the target called function is obtained, the obtained return value is modified to obtain the target return value, and the target return value is returned to the target calling function.

[0143] The call to the target called function is stopped by executing the first preset proxy function.

[0144] According to one or more embodiments of this disclosure, in response to a target interpreter function being called, replacing the virtual machine method instance of the target called function in the input parameters of the target interpreter function with a virtual machine method instance of a first preset proxy function includes:

[0145] In response to the target interpreter function being called, if it is determined that the input parameters of the target interpreter function include a virtual machine method instance of the target called function, and the preset switch is in the on state, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with a virtual machine method instance of the first preset proxy function.

[0146] The method further includes, before invoking the target called function by executing the first preset proxy function:

[0147] Set the preset switch to the off state;

[0148] The process further includes, after invoking the target called function by executing the first preset proxy function:

[0149] Set the preset switch to the on state.

[0150] According to one or more embodiments of this disclosure, before triggering the interpreted execution of the target called function in response to the target called function being invoked by the target called function, the method further includes:

[0151] Based on the preset configuration information, determine the target called function and the first preset proxy function that have a preset corresponding relationship;

[0152] The preset add interface is invoked using symbolic calls to add the virtual machine method instance of the target called function and the virtual machine method instance of the first preset proxy function to a preset set, wherein the function to which the virtual machine method instance in the preset set belongs is set to interpreted execution state.

[0153] According to one or more embodiments of this disclosure, after determining the target called function and the first preset proxy function that have a preset correspondence based on preset configuration information, the method further includes:

[0154] If the target called function is a virtual function, then the virtual machine method instance of the target called function in the virtual function table of the function class to which the target called function belongs is replaced with the virtual machine method instance of the first preset proxy function.

[0155] According to one or more embodiments of this disclosure, the step of invoking the target called function by executing the first preset proxy function includes:

[0156] By executing the first preset proxy function, a preset virtual reflection function is invoked, and the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are passed to the preset virtual reflection function.

[0157] If the target called function is determined to be a preset function by executing the preset virtual reflection call function, the second preset proxy function is invoked by reflection, and the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are passed to the second preset proxy function through the reflection call parameters.

[0158] By executing the second preset proxy function to interpret the reflection call parameters, the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are obtained. The virtual machine's reflection function is then invoked through symbolic invocation, so that the virtual machine method instance of the target called function can be invoked by the virtual machine's reflection function based on the instance information and the input parameter information of the target called function.

[0159] According to one or more embodiments of this disclosure, the target called function and / or the target calling function includes framework Java functions and / or plugin Java functions.

[0160] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0161] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0162] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.< / false>

Claims

1. A function processing method, characterized in that, include: In response to the target called function being invoked by the target called function, the interpretation and execution of the target called function is triggered; During the interpretation and execution of the target called function, in response to the call of the target interpreter function, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with the virtual machine method instance of the first preset proxy function, wherein the target called function and the first preset proxy function have a preset correspondence. In response to the first preset proxy function being called during the execution of the target interpreter function, the call to the target called function is processed in a preset manner by executing the first preset proxy function.

2. The function processing method according to claim 1, characterized in that, The call to the target called function is processed in a preset manner by executing the first preset proxy function, including at least one of the following: The first preset proxy function is executed to call the target called function, and the input parameter information of the target called function is obtained. The first preset proxy function is executed to call the target called function, the return value of the target called function is obtained, and the return value is returned to the target calling function; The first preset proxy function is executed to call the target called function, the return value of the target called function is obtained, the obtained return value is modified to obtain the target return value, and the target return value is returned to the target calling function. The call to the target called function is stopped by executing the first preset proxy function.

3. The function processing method according to claim 2, characterized in that, In response to the invocation of the target interpreter function, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with the virtual machine method instance of the first preset proxy function, including: In response to the target interpreter function being called, if it is determined that the input parameters of the target interpreter function include a virtual machine method instance of the target called function, and the preset switch is in the on state, the virtual machine method instance of the target called function in the input parameters of the target interpreter function is replaced with a virtual machine method instance of the first preset proxy function. The method further includes, before invoking the target called function by executing the first preset proxy function: Set the preset switch to the off state; The process further includes, after invoking the target called function by executing the first preset proxy function: Set the preset switch to the on state.

4. The function processing method according to claim 1, characterized in that, Before triggering the interpreted execution of the target called function in response to the target called function being invoked by the target called function, the method further includes: Based on the preset configuration information, determine the target called function and the first preset proxy function that have a preset corresponding relationship; The preset add interface is invoked using symbolic calls to add the virtual machine method instance of the target called function and the virtual machine method instance of the first preset proxy function to a preset set, wherein the function to which the virtual machine method instance in the preset set belongs is set to interpreted execution state.

5. The function processing method according to claim 4, characterized in that, After determining the target called function and the first preset proxy function that have a preset correspondence based on the preset configuration information, the following is also included: If the target called function is a virtual function, then the virtual machine method instance of the target called function in the virtual function table of the function class to which the target called function belongs is replaced with the virtual machine method instance of the first preset proxy function.

6. The function processing method according to claim 2, characterized in that, The step of calling the target called function by executing the first preset proxy function includes: By executing the first preset proxy function, a preset virtual reflection function is invoked, and the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are passed to the preset virtual reflection function. If the target called function is determined to be a preset function by executing the preset virtual reflection call function, the second preset proxy function is invoked by reflection, and the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are passed to the second preset proxy function through the reflection call parameters. By executing the second preset proxy function to interpret the reflection call parameters, the instance information of the virtual machine method instance of the target called function and the input parameter information of the target called function are obtained. The virtual machine's reflection function is then invoked through symbolic invocation, so that the virtual machine method instance of the target called function can be invoked by the virtual machine's reflection function based on the instance information and the input parameter information of the target called function.

7. The function processing method according to any one of claims 1-6, characterized in that, The target called function and / or the target calling function include framework Java functions and / or plugin Java functions.

8. A function processing device, characterized in that, include: The interpretation execution triggering module is used to trigger the interpretation execution of the target called function in response to the target called function being called by the target called function; The replacement module is used to replace the virtual machine method instance of the target called function in the input parameters of the target interpreter function with the virtual machine method instance of a first preset proxy function in response to the target interpreter function being called during the interpretation and execution of the target called function, wherein the target called function and the first preset proxy function have a preset correspondence. The function processing module is used to respond to the first preset proxy function being called during the execution of the target interpreter function, and to process the call to the target called function in a preset manner by executing the first preset proxy function.

9. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the function processing method as described in any one of claims 1-7.

10. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the function processing method as described in any one of claims 1-7.

11. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the function processing method as described in any one of claims 1-7.