Interface calling method, device and storage medium

By pre-filling the storage address of the interface function when the application is loaded into memory, and determining the storage address of the interface function according to the type of the call object at runtime, the problem of low interface function call efficiency caused by multiple inheritance and multiple implementation in object-oriented programming is solved, and the effect of improving the execution efficiency of the application is achieved.

CN114610417BActive Publication Date: 2025-04-29HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011337494.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-25
Publication Date
2025-04-29
Estimated Expiration
2040-11-25

AI Technical Summary

Technical Problem

In object-oriented programming technology, multiple inheritance and multiple implementations make the compiler unable to determine the real type of the call object of the interface function during the compilation stage, which in turn affects the program execution efficiency.

Method used

When the application is loaded into memory, the first cache information is determined based on the storage address of the application and the preset second cache information, and the storage address of the interface function is prefilled; when the interface function is called, the storage address of the interface function is determined from the prefilled cache information according to the type of the call object, and the interface function is executed.

Benefits of technology

It improves the cache hit rate when the interface function is called for the first time, reduces the number of times the interface function is searched dynamically at runtime, and improves the execution efficiency and running performance of the application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114610417B_ABST
    Figure CN114610417B_ABST
Patent Text Reader

Abstract

The present application relates to an interface calling method, device and storage medium, the interface calling method comprising: in response to the calling of an interface function in an application, determining the storage address of the interface function according to the type of the target object to which the interface function is called and first cache information; reading the interface function from the storage address and executing the interface function, wherein the first cache information is determined when the application is loaded into the memory according to the storage address of the application in the memory and preset second cache information. The embodiment of the present application can pre-fill the first cache information, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for interface functions at runtime, and thereby improving the execution efficiency and running performance of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an interface calling method, device and storage medium. Background Art

[0002] Object-oriented programming technology supports multiple inheritance and multiple implementations. For example, in Java programming, an interface class can inherit multiple interface classes (i.e., multiple inheritance), and an interface class can also be implemented by multiple classes (i.e., multiple implementations). When there is a call to an interface function in an interface class with multiple inheritance or multiple implementations in the source code, during the compilation phase, the compiler is usually unable to determine the true type of the object that calls the interface function, and is also unable to determine the address of the called interface function. Only during the program running phase can the address of the called interface function be determined by dynamic search. However, dynamically searching for the address of the interface function at runtime is time-consuming and affects the execution efficiency of the program. Summary of the invention

[0003] In view of this, an interface calling method, device and storage medium are proposed.

[0004] In a first aspect, an embodiment of the present application provides an interface calling method, comprising: in response to a call of an interface function in an application, determining a storage address of the interface function according to a type of a target object that calls the interface function and first cache information; reading the interface function from the storage address, and executing the interface function, wherein the first cache information is determined when the application is loaded into the memory according to a storage address of the application in the memory and preset second cache information, the second cache information comprising a plurality of second cache entries, each second cache entry corresponding to a calling location of an interface function, the second cache entry comprising an identifier of the type of the object that calls the interface function and an identifier of the interface function in a function table of the type.

[0005] The interface calling method of the embodiment of the present application can determine the first cache information according to the storage address of the application in the memory and the preset second cache information when the application is loaded into the memory, so that before the interface function is called for the first time, its storage address has been cached in the first cache information, that is, the first cache information is pre-filled; during the operation of the application, when the interface function is called, the storage address of the interface function can be determined from the pre-filled first cache information according to the type of the target object that calls the interface function, and the interface function is read and executed from the storage address to complete the call of the interface function, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for the interface function at runtime, and thereby improving the execution efficiency and running performance of the application.

[0006] According to the first aspect, in a first possible implementation of the interface calling method, the first cache information includes multiple first cache entries, the first cache entries correspond to the second cache entries, and the first cache entries include the storage address of the type of object that calls the interface function and the storage address of the interface function.

[0007] According to the first aspect, in a second possible implementation of the interface calling method, the method further includes: determining calling information of each interface function in the application, the calling information including a calling location identifier of the interface function, an identifier of the type to which the object calling the interface function belongs, and an identifier of the interface function in a function table of the type; determining second cache information based on the calling information of each interface function.

[0008] In this embodiment, by determining the calling information of each interface function in the application program and determining the second cache information according to the calling information of each interface function, the accuracy of the second cache information can be improved.

[0009] According to the second possible implementation manner of the first aspect, in a third possible implementation manner of the interface calling method, determining the calling information of each interface function in the application includes: performing sampling compilation on the source code of the application to generate sampling target code, the sampling compilation is used to insert preset sampling code after the calling position of each interface function in the source code during the compilation process; executing the sampling target code to obtain the calling information of each interface function.

[0010] In this embodiment, by sampling and compiling the source code of the application, a preset sampling code can be inserted after the calling position of each interface function in the source code, and a sampling target code can be generated. After executing the sampling target code, the calling information of each interface function can be obtained. This is simple and convenient, and can improve the efficiency of obtaining the calling information of the interface function.

[0011] According to the third possible implementation manner of the first aspect, in the fourth possible implementation manner of the interface calling method, determining the second cache information based on the calling information of each interface function includes: in the process of compiling the source code to generate the executable file of the application, according to the calling information of each interface function, respectively creating second cache entries corresponding to the calling locations of each interface function to obtain second cache information, wherein the second cache information is located in the executable file.

[0012] In this embodiment, during the process of compiling the source code to generate the executable file of the application, second cache entries corresponding to each interface function are created according to the calling information of each interface function to obtain the second cache information. This not only improves the generation efficiency of the second cache information, but also saves the second cache information in the executable file of the application without affecting the installation or deployment of the application.

[0013] According to the first aspect, in a fifth possible implementation of the interface calling method, determining the storage address of the interface function according to the type of the target object that calls the interface function and the first cache information includes: determining the first cache entry corresponding to the calling position of the interface function from the first cache information; and obtaining the storage address of the interface function in the first cache entry when the type of the target object that calls the interface function is the same as the type in the first cache entry. In this way, the storage address of the interface function can be quickly determined.

[0014] According to the first aspect, in a sixth possible implementation of the interface calling method, the calling location of each interface function corresponds to at least one second cache entry.

[0015] In this way, at least one call information of each interface function call position can be cached, thereby improving the hit rate of the first cache entry corresponding to the second cache entry.

[0016] According to the first aspect, in a seventh possible implementation of the interface calling method, the second cache information is updated to the first cache information by backfilling the storage address, thereby reducing the use of cache space.

[0017] According to the first aspect or one or more of the multiple possible implementations of the first aspect, in an eighth possible implementation of the interface calling method, the executable file of the application is compiled and generated by the Ark compiler, and the application includes components of the emotional operating system EMUI and programs running on the emotional operating system EMUI.

[0018] In a second aspect, an embodiment of the present application provides an interface calling device, the device comprising: an address acquisition module, which responds to a call of an interface function in an application and determines a storage address of the interface function according to a type of a target object that calls the interface function and first cache information; an execution module, which reads the interface function from the storage address and executes the interface function, wherein the first cache information is determined when the application is loaded into the memory according to a storage address of the application in the memory and preset second cache information, the second cache information comprising a plurality of second cache entries, each second cache entry corresponding to a calling location of an interface function, the second cache entry comprising an identifier of the type of the object that calls the interface function and an identifier of the interface function in a function table of the type.

[0019] The interface calling device of the embodiment of the present application can determine the first cache information according to the storage address of the application in the memory and the preset second cache information when the application is loaded into the memory, so that before the interface function is called for the first time, its storage address has been cached in the first cache information, that is, the first cache information is pre-filled; during the operation of the application, when the interface function is called, the storage address of the interface function can be determined from the pre-filled first cache information according to the type of the target object that calls the interface function, and the interface function can be read and executed from the storage address to complete the call of the interface function, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for the interface function at runtime, and thereby improving the execution efficiency and running performance of the application.

[0020] According to the second aspect, in a first possible implementation of the interface calling device, the first cache information includes multiple first cache entries, the first cache entries correspond to the second cache entries, and the first cache entries include the storage address of the type of object that calls the interface function and the storage address of the interface function.

[0021] According to the second aspect, in a second possible implementation of the interface calling device, the device also includes: a calling information determination module, used to determine the calling information of each interface function in the application, the calling information including the calling location identifier of the interface function, the identifier of the type of the object calling the interface function and the identifier of the interface function in the function table of the type; a cache information determination module, used to determine the second cache information according to the calling information of each interface function.

[0022] In this embodiment, by determining the calling information of each interface function in the application program and determining the second cache information according to the calling information of each interface function, the accuracy of the second cache information can be improved.

[0023] According to the second possible implementation manner of the second aspect, in a third possible implementation manner of the interface calling device, the calling information determination module includes: a sampling compilation submodule, used to perform sampling compilation on the source code of the application to generate a sampling target code, the sampling compilation being used to insert a preset sampling code behind the calling position of each interface function in the source code during the compilation process; and a sampling execution submodule, used to execute the sampling target code to obtain the calling information of each interface function.

[0024] In this embodiment, by sampling and compiling the source code of the application, a preset sampling code can be inserted after the calling position of each interface function in the source code, and a sampling target code can be generated. After executing the sampling target code, the calling information of each interface function can be obtained. This is simple and convenient, and can improve the efficiency of obtaining the calling information of the interface function.

[0025] According to the third possible implementation method of the second aspect, in a fourth possible implementation method of the interface calling device, the cache information determination module includes: a cache information determination sub-module, which is used to create second cache entries corresponding to the calling locations of each interface function according to the calling information of each interface function during the process of compiling the source code to generate the executable file of the application, and obtain second cache information, wherein the second cache information is located in the executable file.

[0026] In this embodiment, during the process of compiling the source code to generate the executable file of the application, second cache entries corresponding to each interface function are created according to the calling information of each interface function to obtain the second cache information. This not only improves the generation efficiency of the second cache information, but also saves the second cache information in the executable file of the application without affecting the installation or deployment of the application.

[0027] According to the second aspect, in a fifth possible implementation of the interface calling device, the address acquisition module includes: a cache entry determination submodule, used to determine the first cache entry corresponding to the calling position of the interface function from the first cache information; a storage address determination submodule, used to obtain the storage address of the interface function in the first cache entry when the type of the target object calling the interface function is the same as the type in the first cache entry. In this way, the storage address of the interface function can be quickly determined.

[0028] According to the second aspect, in a sixth possible implementation of the interface calling device, a calling location of each interface function corresponds to at least one second cache entry.

[0029] In this way, at least one call information of each interface function call position can be cached, thereby improving the hit rate of the first cache entry corresponding to the second cache entry.

[0030] According to the second aspect, in a seventh possible implementation of the interface calling device, the second cache information is updated to the first cache information by backfilling the storage address, thereby reducing the use of cache space.

[0031] According to the second aspect or one or more of the multiple possible implementation methods of the second aspect, in an eighth possible implementation method of the interface calling device, the executable file of the application is compiled and generated by the Ark compiler, and the application includes components of the emotional operating system EMUI and programs running on the emotional operating system EMUI.

[0032] In a third aspect, an embodiment of the present application provides an interface calling device, comprising a processor and a memory for storing processor executable instructions, wherein the processor is configured to implement the above-mentioned first aspect or one or more of the multiple possible implementation methods of the first aspect when executing the instructions.

[0033] The interface calling device of the embodiment of the present application can determine the first cache information according to the storage address of the application in the memory and the preset second cache information when the application is loaded into the memory, so that before the interface function is called for the first time, its storage address has been cached in the first cache information, that is, the first cache information is pre-filled; during the operation of the application, when the interface function is called, the storage address of the interface function can be determined from the pre-filled first cache information according to the type of the target object that calls the interface function, and the interface function can be read and executed from the storage address to complete the call of the interface function, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for the interface function at runtime, and thereby improving the execution efficiency and running performance of the application.

[0034] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement an interface calling method of the above-mentioned first aspect or one or several of the multiple possible implementation methods of the first aspect.

[0035] According to an embodiment of the present application, when an application is loaded into the memory, the first cache information can be determined based on the storage address of the application in the memory and the preset second cache information, so that before the interface function is called for the first time, its storage address has been cached in the first cache information, that is, the first cache information is pre-filled; during the operation of the application, when the interface function is called, the storage address of the interface function can be determined from the pre-filled first cache information based on the type of the target object that calls the interface function, and the interface function is read and executed from the storage address to complete the call of the interface function, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for interface functions at runtime, and thereby improving the execution efficiency and running performance of the application.

[0036] In the fifth aspect, an embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code is running in an electronic device, the processor in the electronic device executes the interface calling method of the above-mentioned first aspect or one or several of the multiple possible implementation methods of the first aspect.

[0037] According to an embodiment of the present application, when an application is loaded into the memory, the first cache information can be determined based on the storage address of the application in the memory and the preset second cache information, so that before the interface function is called for the first time, its storage address has been cached in the first cache information, that is, the first cache information is pre-filled; during the operation of the application, when the interface function is called, the storage address of the interface function can be determined from the pre-filled first cache information based on the type of the target object that calls the interface function, and the interface function is read and executed from the storage address to complete the call of the interface function, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for interface functions at runtime, and thereby improving the execution efficiency and running performance of the application.

[0038] These and other aspects of the present application will become more apparent from the following description of the embodiment(s). BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application and, together with the description, serve to explain the principles of the present application.

[0040] Figure 1 A schematic diagram showing an application scenario of an interface calling method according to an embodiment of the present application.

[0041] Figure 2 A schematic diagram showing an application scenario of an interface calling method according to an embodiment of the present application.

[0042] Figure 3 A schematic diagram of the structure of a terminal device according to an embodiment of the present application is shown.

[0043] Figure 4 A software structure block diagram of a terminal device according to an embodiment of the present application is shown.

[0044] Figure 5 A flowchart of an interface calling method according to an embodiment of the present application is shown.

[0045] Figure 6 A schematic diagram showing the processing process of the interface calling method according to an embodiment of the present application.

[0046] Figure 7 A schematic diagram showing an interface of a compiler according to an embodiment of the present application is shown.

[0047] Figure 8 A schematic diagram showing the execution effect of the interface calling method according to an embodiment of the present application.

[0048] Fig. 9 A block diagram of an interface calling device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0049] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0050] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0051] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0052] In object-oriented programming technology, an interface class may include at least one interface function (also referred to as an interface method). In order to better understand the technical solution of the embodiment of the present application, multiple implementations of the interface class are exemplarily described below by way of example.

[0053] Assume that there are two interface classes, IntfA and IntfB. Interface class IntfA includes interface function sayCat(), and interface class IntfB includes interface function sayDog(). Subclasses SubClassA and SubClassB both implement IntfA and IntfB, as shown in Table 1 below:

[0054] Table 1 Interface class and its subclasses

[0055]

[0056] In Table 1, the interface class IntfA is implemented by both the subclass SubClassA and the subclass SubClassB, that is, one interface class is implemented by multiple classes, and this implementation method is called multiple implementation of the interface class. Similarly, the interface class IntfB is implemented by both the subclass SubClassA and the subclass SubClassB, which is also called multiple implementation.

[0057] The subclass SubClassA implements both the interface class IntfA and the interface class IntfB, that is, one class implements multiple interface classes. Similarly, the subclass SubClassB also implements the two interface classes IntfA and IntfB. In the related art, multiple inheritance of a class is similar to a class implementing multiple interface classes, which will not be described here one by one.

[0058] When calling an interface function on an object, the compiler cannot determine the actual type of the object calling the interface function at compile time. For example, in the following mutter() function, the interface function sayCat() is called on the object intf, and the object intf may be an object of the subclass SubClassA or an object of the subclass SubClassB:

[0059]

[0060] Since the compiler cannot determine whether the parameter intf passed to the mutter() function is an object of the subclass SubClassA or the subclass SubClassB at compile time, the compiler will translate the statement "intf.sayCat();" into the following four steps to dynamically find the correct interface function and call it when the program is running:

[0061] Step 1: Determine the real type realType of intf at runtime;

[0062] Step 2: Get the function table mTable (also called method table) associated with the real type realType of intf, that is, the set of functions included in the real type realType. For example, the function table of SubClassA includes the interface function sayCat() and the interface function sayDog().

[0063] Step 3, in the function table mTable, find the address addr of the interface function sayCat();

[0064] Step 4: Call sayCat() based on the found address addr.

[0065] The pseudo code of the statement "intf.sayCat();" after being converted by the compiler can be illustrated as follows:

[0066]

[0067] When the number of interface functions included in the interface class is large, executing the above four steps, especially executing step 3, is very time-consuming, which seriously affects the running efficiency of the program.

[0068] Relevant experience shows that when the same interface function is called multiple times, the objects calling the interface function are usually of the same type. For example, if intf.sayCat() is executed multiple times, and the type of the object intf is SubClassA when intf.sayCat() is executed for the first time, the type of the object intf is most likely to be SubClassA when intf.sayCat() is executed again.

[0069] Based on the above experience, the existing technical solution adopts inline caching technology to associate each interface function call with a cache entry, and saves the type of the object and the address of the interface function determined when the interface function call is executed for the first time to the corresponding cache entry. For example, when intf.sayCat() is executed for the first time, the type SubClassA of the determined object intf and the address of sayCat() can be saved to the corresponding cache entry. Among them, the cache occupied by the cache entry can be applied to the system according to the actual situation.

[0070] When intf.sayCat() is executed for the second time, the corresponding cache entry can be used to determine whether the type of intf is the same as the type SubClassA stored in the cache entry. If they are the same, the address of the interface function sayCat() stored in the cache entry is used directly without looking up the address of sayCat() in the function table of SubClassA.

[0071] For example, in the following source code, the function mutter() is executed three times and intf.sayCat() is also called three times:

[0072]

[0073] When using the inline cache technology, the mutter() function in the above source code is converted by the compiler, and pseudo code related to the inline cache mechanism is added, which can be illustrated as follows:

[0074]

[0075] Wherein, cacheTable represents a cache table, which is used to store cache entries. After the source code is compiled, the content in the cache table cacheTable is empty (for example, it can be represented as XXX). The cache table cacheTable can be schematically shown as follows:

[0076] 0[XXX,XXX]

[0077] 1[XXX,XXX]

[0078] 2[XXX,XXX]

[0079] 3[XXX,XXX]

[0080] In the cache table cacheTable, 0, 1, 2, and 3 are cache entry numbers, corresponding to the 0th call position, the 1st call position, the 2nd call position, and the 3rd call position, respectively. Each cache entry includes two fields, the 0th field indicates the type, and the 1st field indicates the address of the interface function.

[0081] In the above pseudocode, the cache entry corresponding to intf.sayCat() is the first cache entry, cacheTable[1][0] represents the 0th field of the first cache entry, and cacheTable[1][1] represents the 1st field of the first cache entry.

[0082] When intf.sayCat() is executed for the first time, the first cache entry in the cache table cacheTable is empty, so it cannot be found when searching in the cache table cacheTable. When the cache entry is not found for the first time, the real type SubClassA of intf and the address of the function sayCat() when sayCat() is called for the first time are saved to the corresponding cache entry, that is, the first cache entry. The updated cache table cacheTable is as follows:

[0083] 0[XXX,XXX]

[0084] 1[SubClassA, sayCat()'s address]

[0085] 2[XXX,XXX]

[0086] 3[XXX,XXX]

[0087] When sayCat() is called for the second and third time, since the real type of intf is consistent with the type stored in the first cache entry, the address of sayCat() can be directly obtained from the first field in the first cache entry when intf.sayCat() is executed for the second and third time, thereby improving the search speed of the interface function sayCat() and thus improving the running efficiency of the program.

[0088] However, when using the above inline cache technology, since the initial content of the cache entry in the cache table cacheTable is empty, there will inevitably be a cache miss when the interface function call is executed for the first time, which affects the program execution efficiency and causes performance loss.

[0089] In order to solve the above technical problems, the present application provides an interface calling method. The interface calling method of the embodiment of the present application can reduce the situation where the cache entry cannot be hit when the interface function call is executed for the first time, thereby improving the program execution efficiency and running performance.

[0090] Figure 1 A schematic diagram showing an application scenario of an interface calling method according to an embodiment of the present application is shown. Figure 1 As shown, the interface calling method of the embodiment of the present application is applied to a first device 10 , in which at least one application 20 is deployed or installed, and the application 20 is compiled and generated by source code 40 in a second device 30 .

[0091] The first device 10 may be a server or terminal device capable of running an application program; the second device 30 may be any type of device that can be used for application program development (including writing and compiling source code 40), such as a desktop computer, a mainframe computer, a notebook computer, a server, etc. The present application does not limit the specific types of the first device 10 and the second device 30.

[0092] Figure 2 A schematic diagram showing an application scenario of an interface calling method according to an embodiment of the present application is shown. Figure 2 As shown, the interface calling method of the embodiment of the present application is applied to the first device 10, and Figure 1 The difference is, Figure 2 The first device 10 in the example includes a source code 40 and an application program 20 compiled and generated by the source code 40. That is, Figure 2The first device 10 in the embodiment can be used for developing (eg, writing and compiling source code 40 ) and running the application 20 .

[0093] The interface calling method of the embodiment of the present application can also be applied to the second device 30. In this application scenario, the second device 30 includes the source code 40 and the application 20 compiled and generated therefrom, that is, the second device 30 is used for the development and operation of the application 20.

[0094] In a possible implementation, the terminal device involved in the present application may refer to a device with a wireless connection function, and the wireless connection function refers to the ability to connect to other terminal devices through wireless connection methods such as wifi and Bluetooth. The terminal device of the present application may also have the function of communicating through a wired connection. The terminal device of the present application may be a touch screen, a non-touch screen, or a screenless device. The touch screen device can be controlled by clicking and sliding on the display screen with a finger or a stylus. The non-touch screen device can be connected to an input device such as a mouse, keyboard, or touch panel to control the terminal device through the input device. For example, the device without a screen may be a Bluetooth speaker without a screen. For example, the terminal device of the present application may be a smart phone, a netbook, a tablet computer, a laptop computer, a wearable electronic device (such as a smart bracelet, a smart watch, etc.), a TV, a virtual reality device, a stereo, an electronic ink, and the like.

[0095] Figure 3 The following is a schematic diagram showing the structure of a terminal device according to an embodiment of the present application. Taking a mobile phone as an example, Figure 3 A schematic structural diagram of a mobile phone 200 is shown.

[0096] The mobile phone 200 may include a processor 210, an external memory interface 220, an internal memory 221, a USB interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 251, a wireless communication module 252, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a SIM card interface 295, etc. The sensor module 280 may include a gyroscope sensor 280A, an acceleration sensor 280B, a proximity light sensor 280G, a fingerprint sensor 280H, and a touch sensor 280K (of course, the mobile phone 200 may also include other sensors, such as a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, etc., which are not shown in the figure).

[0097] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the mobile phone 200. In other embodiments of the present application, the mobile phone 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0098] The processor 210 may include one or more processing units, for example: the processor 210 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (Neural-network Processing Unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the mobile phone 200. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0099] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.

[0100] The processor 210 can run the interface calling method provided in the embodiment of the present application to improve the cache hit rate when the interface function is called for the first time, reduce the number of dynamic searches for the interface function at runtime, and thus improve the execution efficiency and operation performance of the application. The processor 210 can include different devices. For example, when the CPU and GPU are integrated, the CPU and GPU can cooperate to execute the interface calling method provided in the embodiment of the present application, such as part of the algorithm in the interface calling method is executed by the CPU, and another part of the algorithm is executed by the GPU to obtain faster processing efficiency.

[0101] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone 200 may include 1 or N display screens 294, where N is a positive integer greater than 1. The display screen 294 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI). For example, the display 294 can display photos, videos, web pages, or files, etc. For another example, the display 294 can display a graphical user interface. Among them, the graphical user interface includes a status bar, a hidden navigation bar, a time and weather widget, and application icons, such as a browser icon. The status bar includes the operator name (such as China Mobile), the mobile network (such as 4G), the time, and the remaining power. The navigation bar includes a back key icon, a home key icon, and a forward key icon. In addition, it can be understood that in some embodiments, the status bar may also include a Bluetooth icon, a Wi-Fi icon, an external device icon, etc. It can also be understood that in other embodiments, the graphical user interface may also include a Dock bar, and the Dock bar may include commonly used application icons, etc. When the processor 210 detects a touch event of a user's finger (or a stylus, etc.) for a certain application icon, in response to the touch event, the user interface of the application corresponding to the application icon is opened, and the user interface of the application is displayed on the display 294.

[0102] In the embodiment of the present application, the display screen 294 may be an integrated flexible display screen, or a spliced ​​display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.

[0103] The camera 293 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos. Generally, the camera 293 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signal.

[0104] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the mobile phone 200 by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store codes of operating systems, applications (such as camera applications, WeChat applications, etc.), etc. The data storage area may store data created during the use of the mobile phone 200 (such as images, videos, etc. collected by the camera application), etc.

[0105] The internal memory 221 may also store one or more computer programs 1310 corresponding to the interface calling method provided in the embodiment of the present application. The one or more computer programs 1304 are stored in the above-mentioned memory 221 and are configured to be executed by the one or more processors 210. The one or more computer programs 1310 include instructions, and the above-mentioned instructions can be used to execute such as Figure 5 or Figure 6 The various steps in the corresponding embodiments.

[0106] In addition, the internal memory 221 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0107] Of course, the code of the interface calling method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 210 can run the code of the interface calling method stored in the external memory through the external memory interface 220.

[0108] The functions of the sensor module 280 are described below.

[0109] The gyroscope sensor 280A can be used to determine the motion posture of the mobile phone 200. In some embodiments, the angular velocity of the mobile phone 200 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 280A. That is, the gyroscope sensor 280A can be used to detect the current motion state of the mobile phone 200, such as shaking or stillness.

[0110] When the display screen in the embodiment of the present application is a foldable screen, the gyroscope sensor 280A can be used to detect the folding or unfolding operation acting on the display screen 294. The gyroscope sensor 280A can report the detected folding operation or unfolding operation as an event to the processor 210 to determine the folded state or unfolded state of the display screen 294.

[0111] The acceleration sensor 280B can detect the magnitude of the acceleration of the mobile phone 200 in all directions (generally three axes). That is, the gyroscope sensor 280A can be used to detect the current motion state of the mobile phone 200, such as shaking or stillness. When the display screen in the embodiment of the present application is a foldable screen, the acceleration sensor 280B can be used to detect the folding or unfolding operation acting on the display screen 294. The acceleration sensor 280B can report the detected folding operation or unfolding operation as an event to the processor 210 to determine the folding state or unfolding state of the display screen 294.

[0112] The proximity light sensor 280G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The mobile phone emits infrared light outward through the light emitting diode. The mobile phone uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the mobile phone. When insufficient reflected light is detected, the mobile phone can determine that there is no object near the mobile phone. When the display screen in the embodiment of the present application is a foldable screen, the proximity light sensor 280G can be set on the first screen of the foldable display screen 294, and the proximity light sensor 280G can detect the size of the folding angle or unfolding angle between the first screen and the second screen based on the optical path difference of the infrared signal.

[0113] The gyroscope sensor 280A (or the acceleration sensor 280B) can send the detected motion state information (such as angular velocity) to the processor 210. The processor 210 determines whether the current state is handheld or tripod based on the motion state information (for example, when the angular velocity is not 0, it means that the mobile phone 200 is in the handheld state).

[0114] The fingerprint sensor 280H is used to collect fingerprints. The mobile phone 200 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0115] The touch sensor 280K is also called a "touch panel". The touch sensor 280K can be set on the display screen 294, and the touch sensor 280K and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In other embodiments, the touch sensor 280K can also be set on the surface of the mobile phone 200, which is different from the position of the display screen 294.

[0116] Exemplarily, the display screen 294 of the mobile phone 200 displays a main interface, which includes icons of multiple applications (such as a camera application, a WeChat application, etc.). The user clicks the icon of the camera application in the main interface through the touch sensor 280K, triggering the processor 210 to start the camera application and turn on the camera 293. The display screen 294 displays the interface of the camera application, such as a viewfinder interface.

[0117] The wireless communication function of the mobile phone 200 can be realized through the antenna 1, the antenna 2, the mobile communication module 251, the wireless communication module 252, the modem processor and the baseband processor.

[0118] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0119] The mobile communication module 251 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the mobile phone 200. The mobile communication module 251 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 251 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 251 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 251 can be set in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 251 can be set in the same device as at least some of the modules of the processor 210. In an embodiment of the present application, the mobile communication module 251 can also be used to interact with other terminal devices for information.

[0120] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 251 or other functional modules.

[0121] The wireless communication module 252 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the mobile phone 200. The wireless communication module 252 can be one or more devices integrating at least one communication processing module. The wireless communication module 252 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 210. The wireless communication module 252 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0122] In addition, the mobile phone 200 can implement audio functions through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone interface 270D, and the application processor. For example, music playback, recording, etc. The mobile phone 200 can receive the key 290 input and generate key signal input related to the user settings and function control of the mobile phone 200. The mobile phone 200 can use the motor 291 to generate a vibration prompt (such as an incoming call vibration prompt). The indicator 292 in the mobile phone 200 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 295 in the mobile phone 200 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 295, or pulled out from the SIM card interface 295, to achieve contact and separation with the mobile phone 200.

[0123] It should be understood that in actual applications, the mobile phone 200 may include Figure 3 The embodiments of the present application are not limited to the more or fewer components shown. The illustrated mobile phone 200 is only an example, and the mobile phone 200 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0124] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the terminal device.

[0125] Figure 4 It is a software structure block diagram of the terminal device of an embodiment of the present application.

[0126] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

[0127] The application layer can include a series of application packages.

[0128] like Figure 4 As shown, the application package may include applications such as phone, camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0129] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0130] like Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0131] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0132] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0133] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0134] The phone manager is used to provide communication functions for terminal devices, such as the management of call status (including answering, hanging up, etc.).

[0135] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0136] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.

[0137] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0138] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0139] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0140] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0141] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0142] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0143] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0144] A 2D graphics engine is a drawing engine for 2D drawings.

[0145] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0146] Figure 5 FIG. 1 is a flow chart showing an interface calling method according to an embodiment of the present application. The method can be applied to the first device 10. Figure 5 As shown, the interface calling method includes:

[0147] Step S501, in response to a call of an interface function in an application, determining a storage address of the interface function according to the type of a target object that calls the interface function and first cache information;

[0148] Step S502, reading the interface function from the storage address and executing the interface function;

[0149] The first cache information is determined when the application is loaded into the memory according to the storage address of the application in the memory and the preset second cache information.

[0150] The second cache information includes multiple second cache entries, each of which corresponds to a calling location of an interface function, and the second cache entry includes an identifier of the type to which the object calling the interface function belongs and an identifier of the interface function in a function table of the type.

[0151] In this embodiment, before executing step S501, the second cache information may be determined first. The following is an exemplary description of the method for determining the second cache information.

[0152] In one possible implementation, when determining the second cache information, the calling information of each interface function in the application can be first determined, the calling information including the calling location identifier of the interface function, the identifier of the type of the object calling the interface function, and the identifier of the interface function in the function table of the type, and then the second cache information is determined based on the calling information of each interface function.

[0153] Among them, the application may include operating system components and programs running on the operating system. Among them, the operating system may include a computer operating system, a mobile phone operating system and other operating systems. The computer operating system may be, for example, a Windows operating system, a Linux operating system, etc., and the mobile phone operating system may be, for example, an Android system, an emotional operating system EMUI (Emotion User Interface), etc. This application does not limit the specific type of operating system. When the operating system is an emotional operating system EMUI (Emotion User Interface), the application may include components of the emotional operating system EMUI and programs running on the emotional operating system EMUI.

[0154] When determining the second cache information, the calling information of each interface function in the application program can be determined by breakpoint debugging, sampling, etc. The calling information of the interface function may include the calling position identifier of the interface function, the identifier of the type to which the object calling the interface function belongs, and the identifier of the interface function in the function table of the type.

[0155] For example, the calling information of an interface function can be represented as 2[5,6], where 2 represents the calling location identifier of the interface function, 5 represents the identifier of the type to which the object calling the interface function belongs, namely classIndex, and 6 represents the identifier of the interface function in the function table of the said type, namely methodIndex.

[0156] In a possible implementation, the call location of each interface function may correspond to at least one call information. For example, the call location of the interface function may be debugged or sampled multiple times to check the type of the object that calls the interface function. If the type of the object that calls the interface function does not change during multiple breakpoint debugging or sampling, or the probability of type change is less than a preset probability threshold, it can be considered that the call location of the interface function corresponds to one call information; if the type of the object that calls the interface function changes during multiple breakpoint debugging or sampling and switches between at least two types, or the probability of type change is greater than a preset probability threshold, it can be considered that the call location of the interface function corresponds to two or more call information. Those skilled in the art may set the maximum number of call information corresponding to the call location of each interface function according to actual conditions, and this application does not limit this.

[0157] In a possible implementation, determining the calling information of each interface function in an application may include: performing sampling compilation on the source code of the application to generate sampling target code, wherein the sampling compilation is used to insert preset sampling code after the calling position of each interface function in the source code during the compilation process; and executing the sampling target code to obtain the calling information of each interface function.

[0158] When the compiler performs sampling compilation on the source code of the application, it can insert the preset sampling code after the calling position of each interface function in the source code to generate the sampling target code. In other words, the sampling target code includes the code converted by the compiler from the source code and the sampling code inserted after the calling position of each interface function.

[0159] When the sampling code is executed, it can automatically capture the type information of the object that calls the interface function (such as the type identifier, that is, the subscript of the type in the class array in the compiled file) and the information of the interface function (such as the interface function identifier, that is, the subscript of the interface function in the function table of the type) according to the calling position where it is located. The sampling code can also write the captured call information into a preset file (such as a text file for storing call information) for preservation for subsequent use. Among them, the preset file can be a text file, a word file, an excel file, etc. Those skilled in the art can set the specific type of the preset file according to actual conditions, and this application does not limit this.

[0160] For example, in the following source code, the calling position of the interface function is the statement "intf.sayCat();":

[0161]

[0162] When the compiler performs sampling compilation on the above source code, it can insert the sampling code after the calling position of the interface function, that is, after the statement "intf.sayCat();". The sampling target code generated by the compiler after sampling compilation on the above source code is as follows:

[0163]

[0164] Among them, the last three lines are the sampling codes inserted by the compiler during the sampling compilation process. The statement "classIndex = get index of realType in the executable" is used to obtain the identifier of the real type of the object intf that calls the interface function sayCat(), and the statement "methodIndex = get index of sayCat in mTable" is used to obtain the identifier of the interface function sayCat() in the function table mTable of the real type of the object intf. The statement "saveclassIndex and methodIndex of current invocation into file" is used to save the obtained classIndex and methodIndex to the preset file.

[0165] In a possible implementation, after the sampled target code is generated, the sampled target code can be executed to obtain the call information of each interface function, and the call information of each interface function can also be saved to a preset file. The call information can be represented by the following format:

[0166] The calling location identifier [the identifier of the type to which the object calling the interface function belongs, the identifier of the interface function in the function table of the type], that is, the calling location identifier [classIndex, methodIndex].

[0167] For example, the call information of the 0th to 3rd call positions can be represented as:

[0168] 0[2,5]

[0169] 1[3,1]

[0170] 2[5,6]

[0171] 3[1,0]

[0172] In a possible implementation, the call information may also be represented by other methods such as a table, a two-dimensional matrix, a two-dimensional array, etc. This application does not limit the representation method of the call information.

[0173] By sampling and compiling the source code of the application, the preset sampling code can be inserted after the calling position of each interface function in the source code, and the sampling target code can be generated. After executing the sampling target code, the calling information of each interface function can be obtained. It is simple and convenient and can improve the efficiency of obtaining the calling information of the interface function.

[0174] In a possible implementation, after obtaining the call information of each interface function, the second cache information can be determined according to the call information of each interface function. The second cache information may include multiple second cache entries, wherein the second cache entry may include an identifier of the type to which the object calling the interface function belongs and an identifier of the interface function in the function table of the type. Corresponding second cache entries can be established according to the call information of each interface function, and the second cache entries correspond to the call information one-to-one, that is, each second cache entry corresponds to one call information. In a possible implementation, the second cache information can be represented by a cache table cacheTable.

[0175] Since the calling position of each interface function can correspond to at least one piece of calling information, in the case where the second cache entry corresponds to the calling information one-to-one, the calling position of each interface function can correspond to at least one second cache entry. In this way, at least one calling information of each interface function calling position can be cached, thereby improving the hit rate of the first cache entry corresponding to the second cache entry.

[0176] In one possible implementation, determining the second cache information based on the calling information of each interface function may include: in the process of compiling the source code to generate the executable file of the application, creating second cache entries corresponding to the calling locations of each interface function based on the calling information of each interface function, to obtain the second cache information, wherein the second cache information is located in the executable file.

[0177] After determining the calling information of each interface function, the compiler can allocate at least one second cache entry to the calling location of each interface function when compiling the source code to generate the executable file of the application, and read the classIndex and methodIndex in the calling information corresponding to each calling location from the preset text that saves the calling information, and write them into the corresponding second cache entry, thereby obtaining the second cache information, which is located in the executable file of the application.

[0178] Among them, the compiler used during compilation may be different depending on the development environment of the source code or the operating environment of the application. For example, when the application is a component of the emotional operating system EMUI or a program running on the emotional operating system EMUI, the executable file of the application can be compiled and generated by the Ark compiler. This application does not limit the specific type of compiler.

[0179] By creating second cache entries corresponding to each interface function according to the calling information of each interface function during the process of compiling the source code to generate the executable file of the application, the second cache information can be obtained. This not only improves the generation efficiency of the second cache information, but also saves the second cache information in the executable file of the application without affecting the installation or deployment of the application.

[0180] According to the above embodiment, by determining the calling information of each interface function in the application program and determining the second cache information according to the calling information of each interface function, the accuracy of the second cache information can be improved.

[0181] In a possible implementation, after the source code is compiled to generate an executable file of the application, the executable file of the application can be installed or deployed on a target device (eg, Figure 1 Once the installation or deployment is complete, you can run the application.

[0182] When the application is loaded into the memory, the first cache information can be determined according to the storage address of the application in the memory and the second cache information, wherein the first cache information includes a plurality of first cache entries, the first cache entries correspond to the second cache entries in the second cache information, and the first cache entries include the storage address of the type to which the object calling the interface function belongs and the storage address of the interface function.

[0183] For example, when the application is loaded into the memory and dynamic linking is performed, the content of each second cache entry in the second cache information can be parsed, and based on the storage address of the application in the memory, the storage address in the memory of the class corresponding to the classIndex in each second cache entry and the storage address of the interface function corresponding to the methodIndex are determined respectively, and based on the determined storage address, the corresponding first cache entry is established to obtain the first cache information.

[0184] In a possible implementation, the second cache information can also be updated to the first cache information by backfilling the storage address. That is, for any second cache entry, the classIndex in the second cache entry can be updated to the storage address in memory of the class corresponding to the classIndex, and the methodIndex in the second cache entry can be updated to the storage address of the interface function corresponding to the methodIndex, thereby obtaining the first cache entry corresponding to the second cache entry. Updating the second cache information to the first cache information by backfilling the storage address can reduce the use of cache space. It should be understood that the present application does not limit the method for determining the first cache information.

[0185] In a possible implementation, the first cache information may be represented by a cache table cacheTable, as shown below:

[0186] 0[SubClassA_addr,sayDog_addr]

[0187] 1[SubClassA_addr,sayCat_addr]

[0188] 2[SubClassB_addr,sayDog_addr]

[0189] 3[SubClassB_addr,sayCat_addr]

[0190] Among them, SubClassA_addr represents the storage address of type SubClassA; SubClassB_addr represents the storage address of type SubClassB; sayDog_addr in the 0th first cache entry represents the storage address of the interface function sayDog() in type SubClassA; sayCat_addr in the 1st first cache entry represents the storage address of the interface function sayCat() in type SubClassA; sayDog_addr in the 2nd first cache entry represents the storage address of the interface function sayDog() in type SubClassB; sayCat_addr in the 3rd first cache entry represents the storage address of the interface function sayCat() in type SubClassB.

[0191] In one possible implementation, after determining the first cache information, during the running of the application, in response to the call of the interface function in the application, in step S501, the storage address of the interface function is determined according to the type of the target object that calls the interface function and the first cache information.

[0192] That is to say, when the interface function in the application is called, the storage address of the interface function can be determined not by dynamic search, but by the type of the target object calling the interface function and the first cache information.

[0193] In a possible implementation, step S501 may include: determining the first cache entry corresponding to the calling location of the interface function from the first cache information; judging whether the type of the target object that calls the interface function is the same as (or matches) the type in the first cache entry; if the type of the target object that calls the interface function is the same as the type in the first cache entry, it can be considered that the information in the first cache entry matches the calling information of the interface function, and the storage address of the interface function can be directly obtained from the first cache entry. In this way, the storage address of the interface function can be quickly determined.

[0194] In a possible implementation, when the type of the target object that calls the interface function is different from the type in the first cache entry, the storage address of the interface function can be determined by dynamic search.

[0195] In a possible implementation, after the storage address of the interface function is determined in step S501, the interface function may be read from the storage address and executed in step S502 to complete the calling of the interface function.

[0196] For example, the application includes the following source code, in which the interface function intf.sayCat() is called three times:

[0197]

[0198] The first cache information of the application is:

[0199] 0[SubClassA_addr,sayDog_addr]

[0200] 1[SubClassA_addr,sayCat_addr]

[0201] 2[SubClassB_addr,sayDog_addr]

[0202] 3[SubClassB_addr,sayCat_addr]

[0203] When the first call to the interface function intf.sayCat() is executed, the real type of the object intf is SubClassA, which matches the first cache entry "1[SubClassA_addr,sayCat_addr]" in the first cache information. Therefore, when the interface function intf.sayCat() is called for the first time, the cache can be hit, and the storage address of intf.sayCat() can be quickly determined, thereby speeding up the execution efficiency.

[0204] The interface calling method of the embodiment of the present application can determine the first cache information according to the storage address of the application in the memory and the preset second cache information when the application is loaded into the memory, so that before the interface function is called for the first time, its storage address has been cached in the first cache information, that is, the first cache information is pre-filled; during the operation of the application, when the interface function is called, the storage address of the interface function can be determined from the pre-filled first cache information according to the type of the target object that calls the interface function, and the interface function is read and executed from the storage address to complete the call of the interface function, thereby improving the cache hit rate when the interface function is called for the first time, reducing the number of dynamic searches for the interface function at runtime, and thereby improving the execution efficiency and running performance of the application.

[0205] The interface calling method of the embodiment of the present application can be used to optimize the search process of the interface function or interface method, and can be applied to multiple versions of the Ark compiler, such as the Ark compiler 2.0. By compiling the components of the emotional operating system EMUI and the programs running on the emotional operating system EMUI through the Ark compiler, the component performance of the emotional operating system EMUI can be optimized, and the execution efficiency and running performance of the programs running on the emotional operating system EMUI can also be improved.

[0206] Figure 6 A schematic diagram showing the processing process of the interface calling method according to an embodiment of the present application. As shown in Figure 6, the processing process of the interface calling method may include steps S601 to S609, which can be divided into three stages: sampling, optimization compilation, and operation. Among them, the sampling stage is used to obtain the call information of each interface function in the application, the optimization compilation stage is used to generate the second cache information, and the operation stage is the call execution stage of the interface function.

[0207] The first is the sampling stage. In step S601, the source code of the application can be sampled and compiled to generate a sampling target code. The sampling compilation can insert a preset sampling code after the calling position of each interface function in the source code during the compilation process, and in step S602, the sampling target code is executed to obtain the calling information of each interface function.

[0208] After obtaining the call information of each interface function, the optimization compilation stage is entered. In step S603, the call information and source code of each interface function are used as inputs of the optimization compilation, and the optimization compilation is performed. In the process of optimizing and compiling to generate the executable file of the application, the compiler can create second cache entries corresponding to the call positions of each interface function according to the call information of each interface function, and obtain second cache information. The second cache information is located in the executable file of the application.

[0209] After obtaining the second cache information, the operation phase begins. The operation phase can be divided into a first cache information pre-filling phase (including step S604) and an interface function calling phase (including steps S605 to S609).

[0210] In step S604, the first cache information may be pre-filled. Specifically, when the application is loaded into the memory or when the application is dynamically linked, the second cache information may be updated to the first cache information by backfilling the storage address according to the storage address of the application in the memory and the second cache information. Then, during the execution of the application, the interface function may be called according to the first cache information. Specifically, in step S605, in response to the call of the interface function in the application, the first cache entry corresponding to the call location of the interface function may be determined from the first cache information, and in step S606, it is determined whether the type of the target object of the call interface function is the same as the type in the first cache entry. If they are the same, step S607 is executed to obtain the storage address of the interface function in the first cache entry. Otherwise, step S608 is executed to dynamically search for the storage address of the interface function. After obtaining the storage address of the interface function in step S607 or S608, the interface function may be read and executed from the storage address in step S609 to complete the call of the interface function.

[0211] In this embodiment, the calling information of each interface function in the application is obtained through sampling compilation, the second cache information is generated through optimization compilation, and according to the second cache information, the first cache information is pre-filled when the application is loaded into the memory or when the application is dynamically linked. Therefore, when the application calls the interface function for the first time, the storage address of the interface function can be quickly determined through the pre-filled first cache information, which can improve the cache hit rate when the interface function is called for the first time, reduce the number of dynamic searches for interface functions at runtime, and thus improve the execution efficiency and running performance of the application.

[0212] In a possible implementation, in order to facilitate the execution of sample compilation and optimization compilation, a sample compilation shortcut and an optimization compilation shortcut can be added to the compiler operation interface. The shortcut may include a toolbar button, a menu list, a shortcut key, etc., which is not limited in this application.

[0213] Figure 7 FIG. 1 is a schematic diagram showing an operation interface of a compiler according to an embodiment of the present application. Figure 7 As shown, a sampling button 720 and an optimization compilation button 730 can be added to the toolbar 710 of the compiler operation interface 700. When the sampling button is triggered, the execution Figure 6 In step S601 and step S602, when the optimization compilation button 730 is triggered, execute Figure 6Step S603 in .

[0214] Figure 8 A schematic diagram showing the execution effect of the interface calling method according to an embodiment of the present application. Figure 8 As shown, ART (Android RunTime) represents the average search time of the interface function when executing the preset interface test set on the operating environment of the Android system. MAPLE (Multiple Architecture Programming Language Environment) represents the Ark compiler, and MAPLE-RT (MAPLE-RunTime) represents the average search time of the interface function when executing the interface test set on the operating environment of MAPLE without using the interface calling method of the embodiment of the present application. MAPLE-RT is about twice as slow as ART. MAPLE-OPT-RT (MAPLE-Optimisation-RunTime) represents the average search time of the interface function when executing the interface test set on the operating environment of MAPLE after using the interface calling method of the present application. MAPLE-OPT-RT is about more than twice as fast as ART. It can be seen that after using the interface calling method of the embodiment of the present application, the average search time of the interface function is significantly reduced, thereby significantly improving the running performance of the application.

[0215] In another embodiment, the interface execution time using the interface calling method of the embodiment of the present application and the interface execution time not using the interface calling method of the embodiment of the present application can be tested separately, and the test results can be analyzed, as shown in Table 2 below, wherein interface execution time 1 represents the interface execution time when the interface calling method of the embodiment of the present application is used, and interface execution time 2 represents the interface execution time when the interface calling method of the embodiment of the present application is not used.

[0216] Table 2 Interface execution time comparison

[0217]

[0218] It can be seen from Table 2 that the interface execution time using the interface calling method of the embodiment of the present application is reduced to varying degrees, thereby improving the operating performance.

[0219] In a possible implementation, when determining whether an application uses the interface calling method of the embodiment of the present application, you can first reverse the executable file of the application to confirm whether the calling location of its interface function is associated with the cache table cacheTable. If there is an associated cache table, you can confirm whether the classIndex and methodIndex values ​​stored in the cache table of the executable file have obvious identification features, rather than an unordered binary sequence. If the classIndex and methodIndex values ​​have obvious identification features, it is considered that the application uses the interface calling method of the embodiment of the present application. In general, the identification features of classIndex and methodIndex are: the value of classIndex is less than 100000, and the value of methodIndex is less than 2000.

[0220] For example, when determining whether an application uses the interface calling method of the embodiment of the present application, the binary code of the application can be analyzed. If the interface calling method of the embodiment of the present application is used, an obvious address fetching operation can be found at the calling position of the interface function, and the specific behavior feature is "fixed address + offset". For example:

[0221] Address acquisition operation 1:

[0222] adrp x0,

[0223] __inline_cache_table$$_home_l00510180_usr1_mapleSDK_maple_sdk_0706_3_gconly_deve co_build_apk_unzip_helloworld_classes2_dex+48;

[0224] Address operation 2:

[0225] adrp x0,

[0226] __inline_cache_table$$_home_l00510180_usr1_mapleSDK_maple_sdk_0706_3_gconly_deve co_build_apk_unzip_helloworld_classes2_dex+40.

[0227] From the above two address fetching operations, we can see that the fixed addresses of these two address fetching operations are the storage addresses of the cache table:

[0228] __inline_cache_table$$_home_l00510180_usr1_mapleSDK_maple_sdk_0706_3_gconly_deveco_build_apk_unzip_helloworld_classes2_dex,

[0229] It’s just that different interface function calls have different corresponding cache table offsets. For address fetch operation one, the offset is 48, and for address fetch operation two, the offset is 40.

[0230] Moreover, the data stored in the cache table should also have certain rules. For example, for the following cache table:

[0231] __inline_cache_table$$_home_l00510180_usr1_mapleSDK_maple_sdk_0706_3_gconly_deveco_build_apk_unzip_helloworld_classes2_dex,

[0232] The [classIndex, methodIndex] in its binary content has a certain pattern: classIndex<100000, methodIndex<2000.

[0233] By taking address operations and the regularity of the data stored in the cache table, it can be determined whether the application uses the interface calling method of the embodiment of the present application.

[0234] Fig. 9 FIG. 1 is a block diagram of an interface calling device according to an embodiment of the present application. Fig. 9 As shown, the interface calling device is applied to the first device 10, and the interface calling device includes:

[0235] The address acquisition module 91, in response to the call of the interface function in the application, determines the storage address of the interface function according to the type of the target object that calls the interface function and the first cache information;

[0236] An execution module 92 reads the interface function from the storage address and executes the interface function.

[0237] The first cache information is determined when the application is loaded into the memory according to the storage address of the application in the memory and the preset second cache information.

[0238] The second cache information includes multiple second cache entries, each of which corresponds to a calling location of an interface function, and the second cache entry includes an identifier of the type to which the object calling the interface function belongs and an identifier of the interface function in a function table of the type.

[0239] In a possible implementation, the first cache information includes multiple first cache entries, the first cache entries correspond to the second cache entries, and the first cache entries include a storage address of a type of an object that calls an interface function and a storage address of the interface function.

[0240] In a possible implementation, the device also includes: a call information determination module, which is used to determine the call information of each interface function in the application, the call information including the call location identifier of the interface function, the identifier of the type of the object calling the interface function and the identifier of the interface function in the function table of the type; a cache information determination module, which is used to determine the second cache information based on the call information of each interface function.

[0241] In a possible implementation, the calling information determination module includes: a sampling compilation submodule, which is used to perform sampling compilation on the source code of the application to generate sampling target code, and the sampling compilation is used to insert preset sampling code after the calling position of each interface function in the source code during the compilation process; a sampling execution submodule, which is used to execute the sampling target code to obtain the calling information of each interface function.

[0242] In one possible implementation, the cache information determination module includes: a cache information determination sub-module, which is used to create second cache entries corresponding to the calling locations of each interface function according to the calling information of each interface function during the process of compiling the source code to generate the executable file of the application, so as to obtain second cache information, wherein the second cache information is located in the executable file.

[0243] In one possible implementation, the address acquisition module 91 includes: a cache entry determination submodule, used to determine a first cache entry corresponding to the calling location of the interface function from the first cache information; a storage address determination submodule, used to obtain the storage address of the interface function in the first cache entry when the type of the target object that calls the interface function is the same as the type in the first cache entry.

[0244] In a possible implementation, the calling location of each interface function corresponds to at least one second cache entry.

[0245] In a possible implementation, the second cache information is updated to the first cache information by backfilling the storage address.

[0246] In a possible implementation, the executable file of the application is compiled and generated by the Ark compiler, and the application includes components of the emotional operating system EMUI and a program running on the emotional operating system EMUI.

[0247] An embodiment of the present application provides an interface calling device, comprising: a processor and a memory for storing processor executable instructions; wherein the processor is configured to implement the above method when executing the instructions.

[0248] An embodiment of the present application provides a non-volatile computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.

[0249] An embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0250] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing.

[0251] The computer-readable program instructions or codes described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0252] The computer program instructions for performing the operation of the present application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may 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 may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, by utilizing the state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present application.

[0253] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0254] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0255] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0256] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, system, method and computer program product according to multiple embodiments of the present application. In this regard, each square frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the square frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square frames can actually be executed substantially in parallel, and they can also be executed in reverse order sometimes, depending on the functions involved.

[0257] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware (such as a circuit or ASIC (Application Specific Integrated Circuit)) that performs the corresponding function or action, or can be implemented by a combination of hardware and software, such as firmware.

[0258] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0259] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. An interface calling method, characterized in that: include: In response to a call of an interface function in an application program, determining a storage address of the interface function according to a type of a target object that calls the interface function and first cache information; Reading the interface function from the storage address and executing the interface function, The first cache information is determined when the application is loaded into the memory according to the storage address of the application in the memory and the preset second cache information. The second cache information includes multiple second cache entries, each second cache entry corresponds to the calling location of an interface function, the second cache entry includes an identifier of the type to which the object calling the interface function belongs and an identifier of the interface function in a function table of the type, and the first cache information includes multiple first cache entries, the first cache entry corresponds to the second cache entry, and the first cache entry includes a storage address of the type to which the object calling the interface function belongs and a storage address of the interface function.

2. The method according to claim 1, characterized in that Also includes: Determine the calling information of each interface function in the application, the calling information including the calling position identifier of the interface function, the identifier of the type of the object calling the interface function and the identifier of the interface function in the function table of the type; The second cache information is determined according to the calling information of each interface function.

3. The method according to claim 2, characterized in that The determining of the calling information of each interface function in the application program includes: Performing sampling compilation on the source code of the application to generate sampling target code, wherein the sampling compilation is used to insert preset sampling code after the calling position of each interface function in the source code during the compilation process; The sampled target code is executed to obtain the calling information of each interface function.

4. The method according to claim 3, characterized in that Determining the second cache information according to the calling information of each interface function includes: In the process of compiling the source code to generate the executable file of the application, second cache entries corresponding to the calling positions of the respective interface functions are created respectively according to the calling information of the respective interface functions to obtain the second cache information, Wherein, the second cache information is located in the executable file.

5. The method according to claim 1, characterized in that The step of determining the storage address of the interface function according to the type of the target object that calls the interface function and the first cache information includes: Determining, from the first cache information, a first cache entry corresponding to a calling location of the interface function; When the type of the target object that calls the interface function is the same as the type in the first cache entry, the storage address of the interface function in the first cache entry is obtained.

6. The method according to claim 1, characterized in that The calling location of each interface function corresponds to at least one second cache entry.

7. The method according to claim 1, characterized in that The second cache information is updated to the first cache information by backfilling the storage address.

8. According to the method described in any one of claims 1 to 7, the executable file of the application is compiled and generated by the Ark compiler, and the application includes components of the emotional operating system EMUI and programs running on the emotional operating system EMUI.

9. An interface calling device, characterized in that: include: An address acquisition module, in response to a call of an interface function in an application program, determines a storage address of the interface function according to a type of a target object that calls the interface function and first cache information; an execution module, reading the interface function from the storage address and executing the interface function, The first cache information is determined when the application is loaded into the memory according to the storage address of the application in the memory and the preset second cache information. The second cache information includes multiple second cache entries, each second cache entry corresponds to the calling location of an interface function, the second cache entry includes an identifier of the type to which the object calling the interface function belongs and an identifier of the interface function in a function table of the type, and the first cache information includes multiple first cache entries, the first cache entry corresponds to the second cache entry, and the first cache entry includes a storage address of the type to which the object calling the interface function belongs and a storage address of the interface function.

10. The device according to claim 9, characterized in that Also includes: A calling information determination module, used to determine the calling information of each interface function in the application, wherein the calling information includes a calling position identifier of the interface function, an identifier of the type to which the object calling the interface function belongs, and an identifier of the interface function in a function table of the type; The cache information determination module is used to determine the second cache information according to the calling information of each interface function.

11. The device according to claim 10, characterized in that The calling information determining module comprises: A sampling compilation submodule, used for performing sampling compilation on the source code of the application program to generate sampling target code, wherein the sampling compilation is used for inserting a preset sampling code after the calling position of each interface function in the source code during the compilation process; The sampling execution submodule is used to execute the sampling target code and obtain the calling information of each interface function.

12. The device according to claim 11, characterized in that The cache information determination module includes: The cache information determination submodule is used to create second cache entries corresponding to the calling positions of the respective interface functions according to the calling information of the respective interface functions in the process of compiling the source code to generate the executable file of the application program, and obtain the second cache information. Wherein, the second cache information is located in the executable file.

13. The device according to claim 9, characterized in that The address acquisition module includes: A cache entry determination submodule, used to determine a first cache entry corresponding to a calling position of the interface function from the first cache information; The storage address determination submodule is used to obtain the storage address of the interface function in the first cache entry when the type of the target object that calls the interface function is the same as the type in the first cache entry.

14. The device according to claim 9, characterized in that The calling location of each interface function corresponds to at least one second cache entry.

15. The device according to claim 9, characterized in that The second cache information is updated to the first cache information by backfilling the storage address.

16. According to the device according to any one of claims 9-15, the executable file of the application is compiled and generated by the Ark compiler, and the application includes components of the emotional operating system EMUI and programs running on the emotional operating system EMUI.

17. An interface calling device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1-8 when executing the instructions.

18. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.