Calling control method and equipment for runtime metadata

By statically analyzing the generated runtime metadata during the compilation period, and directly obtaining the target metadata from the metadata generated during the compilation period, the problem of low efficiency in obtaining runtime metadata in the existing technology is solved, which improves call efficiency and reduces resource usage.

CN119597619APending Publication Date: 2025-03-11BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411640665.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, the efficiency of obtaining runtime metadata is low, and it is necessary to search target metadata from many runtime metadata through a complex runtime search algorithm, which occupies a lot of memory and computing resources.

Method used

Runtime metadata is generated through static analysis during the compilation period, and the target runtime metadata is directly obtained from the metadata generated during the compilation period during the application runtime, avoiding searching from the runtime context.

Benefits of technology

Improves the efficiency of calling metadata at runtime and reduces the use of memory and computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597619A_ABST
    Figure CN119597619A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a calling control method and device for runtime metadata, and the method comprises the steps: responding to a runtime metadata obtaining request of a target calling function, and the runtime metadata obtaining request is used for indicating to obtain target runtime metadata about the target calling function and generated by pre-appointed static analysis in a compiling period; according to a function calling interface of a target calling function in the runtime metadata obtaining request, directly obtaining target runtime metadata from runtime metadata generated by static analysis in a compiling period in advance; wherein the runtime metadata generated by static analysis in the compiling period comprises the runtime metadata generated by static analysis according to information borne on a syntax tree in the syntax tree analysis stage through a compiler in advance for a target runtime metadata type indicated in a configuration file; the target runtime metadata type is a runtime metadata type corresponding to the target call function. According to the method, the calling efficiency of the metadata during operation can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The disclosed embodiments relate to the field of Internet technology, and in particular to a method and device for controlling the call of runtime metadata. Background Art

[0002] Runtime metadata is an important part of an application. In order to solve various runtime problems, various runtime metadata need to be introduced.

[0003] In the prior art, a complex runtime search algorithm is usually used to find the desired allowed runtime metadata from a large number of runtime metadata. The runtime search algorithm implementation will occupy more memory resources and computing resources, and the speed of obtaining the runtime metadata is also relatively limited. Summary of the invention

[0004] The embodiments of the present disclosure provide a runtime metadata call control method and device, which can improve the efficiency of acquiring runtime metadata.

[0005] In a first aspect, an embodiment of the present disclosure provides a runtime metadata call control method, comprising:

[0006] In response to a runtime metadata acquisition request of a target calling function, the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function generated by static analysis at compile time in advance;

[0007] According to the function call interface of the target call function in the runtime metadata acquisition request, directly acquiring the target runtime metadata from the runtime metadata generated in advance by static analysis during compilation;

[0008] Among them, the runtime metadata generated by static analysis during compilation includes runtime metadata generated in advance by the compiler in the syntax tree parsing stage based on static analysis of information carried on the syntax tree for the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target calling function.

[0009] In a second aspect, an embodiment of the present disclosure provides a runtime metadata call control device, including:

[0010] A determination unit, configured to respond to a runtime metadata acquisition request of a target calling function, wherein the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function generated by static analysis at compile time in advance;

[0011] A calling unit, configured to directly obtain the target runtime metadata from the runtime metadata generated in advance by static analysis during compilation according to the function calling interface of the target calling function in the runtime metadata acquisition request; wherein the runtime metadata generated in advance by static analysis during compilation includes runtime metadata generated in advance by static analysis of information carried on a syntax tree by a compiler during a syntax tree parsing phase for a target runtime metadata type indicated in a configuration file, and the target runtime metadata type is a runtime metadata type corresponding to the target calling function.

[0012] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;

[0013] The memory stores computer-executable instructions;

[0014] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the runtime metadata call control method described in the first aspect and various possible designs of the first aspect.

[0015] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the runtime metadata calling control method described in the first aspect and various possible designs of the first aspect is implemented.

[0016] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the runtime metadata calling control method as described in the first aspect and various possible designs of the first aspect.

[0017] The present embodiment provides a method and device for controlling the call of runtime metadata, the method comprising: responding to a runtime metadata acquisition request of a target call function, the runtime metadata acquisition request is used to indicate the acquisition of target runtime metadata about the target call function that is pre-specified and generated by static analysis at compile time; directly acquiring the target runtime metadata from the runtime metadata that is pre-generated by static analysis at compile time according to the function call interface of the target call function in the runtime metadata acquisition request; wherein the runtime metadata generated by static analysis at compile time includes runtime metadata that is pre-generated by the compiler at the syntax tree parsing stage according to the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target call function. In this technical solution, since the runtime metadata is pre-generated by static analysis at compile time of the application, the target runtime metadata of the target call function can be directly called from the runtime metadata generated by static analysis at compile time when the application is running, so that the target runtime metadata of the target call function does not need to be searched from the runtime context, thereby improving the calling efficiency of the runtime metadata. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0019] Figure 1 A schematic diagram of an application scenario of the runtime metadata call control method provided by an embodiment of the present disclosure;

[0020] Figure 2 The process of the runtime metadata call control method provided by the embodiment of the present disclosure Figure 1 ;

[0021] Figure 3 Schematic diagram of the runtime metadata call control method provided by the embodiment of the present disclosure Figure 1 ;

[0022] Figure 4 Schematic diagram of the runtime metadata call control method provided by the embodiment of the present disclosure Figure 2 ;

[0023] Figure 5 A schematic diagram of the structure of a runtime metadata call control device provided by an embodiment of the present disclosure;

[0024] Figure 6A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and corresponding operation entrances shall be provided for users to choose to authorize or refuse.

[0027] Runtime metadata is an important part of the application. In order to solve various runtime problems, various runtime metadata need to be introduced. If you want to print stack traceback information when an exception occurs in the program, you need runtime metadata such as source code line number and source code file.

[0028] In the prior art, if the expected runtime metadata is the line number information of the calling function of the log interface, it is necessary to first determine which functions call the log interface by backtracking the function stack, and then find the line number information of the calling function of the log interface from the runtime context through the value of the program counter register (that is, the calling function).

[0029] However, in order to obtain the desired runtime metadata, it is necessary to find the desired runtime metadata among the numerous runtime metadata generated through the value of the program counter register, which results in a relatively low efficiency in obtaining the runtime metadata.

[0030] In response to the technical problems in the prior art, the inventor's technical conception is as follows: at compile time, it is possible to know which call points have called the log interface, and the line number information of all functions is also known. Therefore, the runtime metadata generated by static analysis at compile time can be generated in advance, and the required target runtime metadata can be obtained from the runtime metadata generated at compile time when needed, and it is no longer necessary to obtain it from the runtime metadata generated by running the application. Therefore, the calling efficiency of the runtime metadata can be improved.

[0031] Accordingly, the specific steps may include: first, responding to a runtime metadata acquisition request of a target calling function, the runtime metadata acquisition request is used to indicate the acquisition of target runtime metadata about the target calling function that is pre-specified and generated by static analysis at compile time; directly acquiring the target runtime metadata from the runtime metadata that is pre-generated by static analysis at compile time according to the function calling interface of the target calling function in the runtime metadata acquisition request; wherein the runtime metadata generated by static analysis at compile time includes runtime metadata that is pre-generated by static analysis of information carried on the syntax tree by the compiler at the syntax tree parsing stage according to the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target calling function.

[0032] In this technical solution, since the runtime metadata is generated in advance through static analysis during the compile time of the application, the target runtime metadata of the target calling function can be called directly from the runtime metadata generated by the static analysis during the compile time when the application is running. This eliminates the need to search for the target runtime metadata of the target calling function from the runtime context, thereby improving the calling efficiency of the runtime metadata.

[0033] The application scenarios of the embodiments of the present disclosure are explained below:

[0034] The runtime metadata call control method provided by the embodiment of the present disclosure can be applied to scenarios where runtime metadata needs to be introduced to solve various runtime problems. Figure 1 As shown, at compile time, a calling function is generated ( Figure 1 The mapping relationship between the program instructions in the program and the runtime metadata. When the runtime metadata needs to be called, the value of the program counter register can be obtained. The corresponding runtime metadata is obtained through this value and the mapping relationship between the program instructions and the runtime metadata. After that, garbage collection, stack backtracking, reflective dynamic function call and other behaviors are completed through the corresponding runtime metadata.

[0035] The following is a specific implementation process of the runtime metadata call control method and device involved in the embodiment of the present disclosure. Some examples are only for example and are not limiting. The execution subject of the runtime metadata call control method involved in the embodiment of the present disclosure is an electronic device, which can be a terminal, a server, etc.

[0036] Figure 2 The process of the runtime metadata call control method provided by the embodiment of the present disclosure Figure 1 ,like Figure 2 As shown, the call control method of the runtime metadata may include:

[0037] S201 . Respond to a runtime metadata acquisition request of a target calling function, where the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function that is pre-specified and generated by static analysis during compile time.

[0038] In the disclosed embodiment, when the application executes a preset task, it generates a request to obtain runtime metadata. For example, when an exception occurs in the application, it will execute the task of printing stack backtrace information, and at this time, runtime metadata such as source code line number and source code file are required. For another example, when the application executes a garbage collection task, it needs runtime metadata such as program instruction address, function stack size, pointer bitmap on function stack, etc. For another example, when the program wants to perform reflection dynamic call function, it needs function address, input parameter type, output parameter type, name, etc. to describe the runtime metadata of a function.

[0039] In some embodiments, when an application program performs a task of printing stack traceback information abnormally, a runtime metadata acquisition request of a target calling function is generated. At this time, the target calling function includes a print log function, and the target runtime metadata includes line number information.

[0040] S202. According to the function call interface of the target calling function in the runtime metadata acquisition request, directly obtain the target runtime metadata from the runtime metadata generated by static analysis in advance during the compile time; wherein the runtime metadata generated by static analysis in advance during the compile time includes runtime metadata generated by static analysis in advance by the compiler during the syntax tree parsing stage according to the information carried on the syntax tree for the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target calling function.

[0041] In some embodiments, the runtime metadata pre-generated by static analysis during compile time is recorded in the function object of the target calling function; accordingly, according to the function calling interface of the target calling function in the runtime metadata acquisition request, the target runtime metadata is directly acquired from the runtime metadata pre-generated by static analysis during compile time, including: according to the function calling interface of the target calling function in the runtime metadata acquisition request, the target runtime metadata is directly acquired from the preset field of the function object.

[0042] For example, although each call point calls the same log interface, the created log objects are all associated with the call point. In this case, the compiler can rewrite the syntax tree to pass the line number information into the log object, and replace the runtime search logic with direct acquisition from the log object. In this way, when the log interface obtains the call point line number information, it can directly use the line number information in the log object without having to obtain it from the context.

[0043] It should be noted that before obtaining the target runtime metadata through the function call interface, the function call interface needs to be rewritten in the syntax tree, and the target runtime metadata is obtained from the preset field of the function object first, rather than from the runtime context. In addition, before directly obtaining the target runtime metadata from the preset field of the function object, it is necessary to determine whether the preset field is empty, and only obtain the target runtime metadata from the preset field of the function object when it is not empty. Accordingly, directly obtaining the target runtime metadata from the preset field of the function object includes: determining whether the preset field of the function object is empty; when it is not empty, directly obtaining the target runtime metadata from the preset field of the function object; otherwise, obtaining the target runtime metadata from the runtime context.

[0044] Exemplarily, the target runtime metadata is line number information. Before obtaining the line number information through the log interface, the log interface of the print log function can be rewritten in the syntax tree. When obtaining the line number information through the log interface of the print log function, the line number information is obtained from the preset field of the function object first. Furthermore, when obtaining the line number information from the preset field of the function object, first determine whether the preset field of the function object is empty. If it is not empty, use the line number information. Otherwise, continue to obtain the line number information in the runtime context.

[0045] In some embodiments, for the target runtime metadata type indicated in the configuration file, the runtime metadata generated in advance by the compiler in the syntax tree parsing stage according to the information carried on the syntax tree static analysis may include the following steps (1) to (3):

[0046] (1) The compiler determines the function identifier of the target call function corresponding to the target runtime metadata type according to the target runtime metadata type indicated in the configuration file during the syntax tree parsing stage.

[0047] In this step, the target runtime metadata type indicated in the configuration file is a runtime metadata type that can be determined during compilation. Exemplarily, the target runtime metadata type includes function line number information, template string, and the like.

[0048] (2) Perform static analysis on the target calling function according to the function identifier of the target calling function and the information carried on the syntax tree to obtain the runtime metadata corresponding to the target calling function.

[0049] In this step, a syntax tree parsing phase can be added during compilation, and signature judgment can be performed on the calling function in the syntax tree. If it is found to be the target calling function, the runtime metadata of this calling point is recorded. Accordingly, this step can include: traversing each calling function in the syntax tree, and performing signature judgment on each calling function through the function identifier of the target calling function; if the function identifier of the calling function is determined to be the same as the function identifier of the target calling function, static analysis is performed on the target calling function according to the information carried on the syntax tree to obtain the runtime metadata corresponding to the target calling function.

[0050] In the syntax tree parsing stage, the compile-time static analysis technology can be used to perform only one top-down syntax tree traversal instead of multiple times. The call point that needs the data can be accurately found through the function signature, and the runtime metadata information can be obtained through the information left on the syntax tree during the compile-time syntax tree parsing stage.

[0051] For example, Figure 3 As shown, the target calling function is a log function, and the runtime metadata corresponding to the log function is the line number information. Traverse each calling function in the syntax tree: call the server initialization function (non-log function, skip record); print the log "Server initialization successful" (log function, record line number information); call the request processing function (non-log function, skip record); print the log "Request processing successful" (log function, record line number information).

[0052] (3) Add runtime metadata to the function object of the target calling function.

[0053] Optionally, this step may include: associating a preset field with the interface code of the target function object; in response to the target calling function calling the function object through the interface code, adding a preset field to the function object of the target calling function, and adding runtime metadata to the preset field; wherein the preset field is a string type field.

[0054] It should be noted that the line number information can be put into the log object mentioned above. The original log object does not have a corresponding field to store the line number information. At this time, it needs to be rewritten to add a field to the end of the log object type to store the line number information. It is necessary to judge by the fully qualified class name during the source code parsing stage and add a string type field to the end of the log object type.

[0055] Optionally, the line number information is passed to the log object. Although the log object for each call point is different, the code for each call point is the same. Now, in order to pass the line number information to the log object, it is equivalent to making the code of each call point different. Here, the log interface code needs to be copied and rewritten, which is equivalent to inlining the log function and then further processing. After copying the code, the syntax tree will be traversed, and the code will be inserted at the generation point of the log object, and the line number information that has been obtained will be passed to the newly added field of the log object.

[0056] Accordingly, a preset field is added to the function object of the calling function, and runtime metadata is added to the preset field, including: associating the preset field with the interface code of the function object; in response to the calling function calling the function object through the interface code of the function object, adding a preset field to the function object of the calling function, and adding runtime metadata to the preset field.

[0057] In the disclosed embodiment, the syntax tree rewriting technology is used to expand the type, and the syntax tree is copied using inline, so as to achieve differential rewriting at the function call point, and transform the program from dynamically obtaining runtime metadata to directly obtaining runtime metadata statically.

[0058] In some embodiments, adding a preset field to the function object of the target calling function includes: adding the preset field to the end of the function object of the target calling function, or adding the preset field to the beginning of the function object of the target calling function.

[0059] For example, Figure 4 As shown, the target calling function is a print log function; the function objects of the print log function include: "Server initialization successful" and "Request processing successful".

[0060] Add a preset field to the header of "Server initialization successful": "", add the runtime metadata (file name 1, line number 1) to the preset field to obtain: "File name 1, line number 1" "Server initialization successful".

[0061] Add a preset field to the header of "Request processed successfully": "", add the runtime metadata (file name 2, line number 2) to the preset field to obtain: "file name 2, line number 2" "Request processed successfully".

[0062] The disclosed embodiment provides a method for controlling the call of runtime metadata. First, in response to a runtime metadata acquisition request of a target call function, the runtime metadata acquisition request is used to indicate the acquisition of target runtime metadata about the target call function that is pre-specified and generated by static analysis at compile time; according to the function call interface of the target call function in the runtime metadata acquisition request, the target runtime metadata is directly acquired from the runtime metadata that is pre-generated by static analysis at compile time; wherein the runtime metadata generated by static analysis at compile time includes runtime metadata that is pre-generated by the compiler at the syntax tree parsing stage according to the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target call function. In this technical solution, since the runtime metadata is pre-generated by static analysis at compile time of the application, the target runtime metadata of the target call function can be directly called from the runtime metadata generated by static analysis at compile time when the application is running, so there is no need to search for the target runtime metadata of the target call function from the runtime context, thereby improving the calling efficiency of the runtime metadata.

[0063] Figure 5 A schematic diagram of the structure of the runtime metadata call control device provided by the embodiment of the present disclosure, such as Figure 5 As shown, the call control device of the runtime metadata includes:

[0064] A determining unit 501 is used to respond to a runtime metadata acquisition request of a target calling function, wherein the runtime metadata acquisition request is used to instruct to acquire target runtime metadata about the target calling function generated by static analysis at compile time in advance;

[0065] A calling unit 502 is used to directly obtain the target runtime metadata from the runtime metadata generated by static analysis in advance during compilation according to the function calling interface of the target calling function in the runtime metadata acquisition request; wherein the runtime metadata generated by static analysis in advance during compilation includes runtime metadata generated by static analysis of information carried on the syntax tree in advance by the compiler during the syntax tree parsing stage for the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target calling function.

[0066] According to one or more embodiments of the present disclosure, the runtime metadata pre-generated by static analysis during compile time is recorded in the function object of the target calling function; accordingly, the calling unit 502 directly obtains the target runtime metadata from the runtime metadata pre-generated by static analysis during compile time according to the function calling interface of the target calling function in the runtime metadata acquisition request, including: directly obtaining the target runtime metadata from a preset field of the function object according to the function calling interface of the target calling function in the runtime metadata acquisition request.

[0067] According to one or more embodiments of the present disclosure, the calling unit 502 directly obtains the target runtime metadata from the preset field of the function object, including: determining whether the preset field of the function object is empty; when it is not empty, directly obtaining the target runtime metadata from the preset field of the function object; otherwise, obtaining the target runtime metadata from the runtime context.

[0068] According to one or more embodiments of the present disclosure, the call control device also includes: a compilation unit; the compilation unit, for the target runtime metadata type indicated in the configuration file, pre-generates runtime metadata by statically analyzing the information carried on the syntax tree through the compiler in the syntax tree parsing stage, including: determining, by the compiler in the syntax tree parsing stage, the function identifier of the target call function corresponding to the target runtime metadata type indicated in the configuration file; statically analyzing the target call function according to the function identifier of the target call function and the information carried on the syntax tree to obtain the runtime metadata corresponding to the target call function; and adding the runtime metadata to the function object of the target call function.

[0069] According to one or more embodiments of the present disclosure, the compilation unit performs static analysis on the target calling function according to the function identifier of the target calling function and the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function, including: traversing each calling function in the syntax tree, and performing signature judgment on each calling function through the function identifier of the target calling function; if it is judged that the function identifier of the calling function is the same as the function identifier of the target calling function, then performing static analysis on the target calling function according to the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function.

[0070] According to one or more embodiments of the present disclosure, the compilation unit adds the runtime metadata to the function object of the target calling function, including: associating a preset field with the interface code of the target function object; in response to the target calling function calling the function object through the interface code, adding a preset field in the function object of the target calling function, and adding the runtime metadata to the preset field; wherein the preset field is a field of string type.

[0071] According to one or more embodiments of the present disclosure, the compilation unit adds a preset field in the function object of the target calling function, including: adding the preset field at the end of the function object of the target calling function, or adding the preset field at the beginning of the function object of the target calling function.

[0072] According to one or more embodiments of the present disclosure, the target calling function includes a print log function, and the runtime metadata includes line number information.

[0073] Figure 6 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 6 The electronic device 600 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers, portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

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

[0075] Typically, the following devices may be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0076] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0077] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0078] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0079] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0080] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely 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., via the Internet using an Internet service provider).

[0081] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0082] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0083] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0084] In a first aspect, according to one or more embodiments of the present disclosure, a runtime metadata call control method is provided, comprising:

[0085] In response to a runtime metadata acquisition request of a target calling function, the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function generated by static analysis at compile time in advance;

[0086] According to the function call interface of the target call function in the runtime metadata acquisition request, directly acquiring the target runtime metadata from the runtime metadata generated in advance by static analysis during compilation;

[0087] Among them, the runtime metadata generated by static analysis during compilation includes runtime metadata generated in advance by the compiler in the syntax tree parsing stage based on static analysis of information carried on the syntax tree for the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target calling function.

[0088] According to one or more embodiments of the present disclosure, the runtime metadata pre-generated by static analysis during compile time is recorded in the function object of the target calling function; accordingly, directly obtaining the target runtime metadata from the runtime metadata pre-generated by static analysis during compile time according to the function calling interface of the target calling function in the runtime metadata acquisition request includes: directly obtaining the target runtime metadata from a preset field of the function object according to the function calling interface of the target calling function in the runtime metadata acquisition request.

[0089] According to one or more embodiments of the present disclosure, directly obtaining the target runtime metadata from the preset field of the function object includes: determining whether the preset field of the function object is empty; when it is not empty, directly obtaining the target runtime metadata from the preset field of the function object; otherwise, obtaining the target runtime metadata from the runtime context.

[0090] According to one or more embodiments of the present disclosure, the runtime metadata generated in advance by a compiler in a syntax tree parsing stage for a target runtime metadata type indicated in a configuration file through static analysis based on information carried on a syntax tree includes: determining, by the compiler in a syntax tree parsing stage, a function identifier of a target call function corresponding to the target runtime metadata type according to the target runtime metadata type indicated in the configuration file; statically analyzing the target call function according to the function identifier of the target call function and the information carried on the syntax tree to obtain runtime metadata corresponding to the target call function; and adding the runtime metadata to a function object of the target call function.

[0091] According to one or more embodiments of the present disclosure, the target calling function is statically analyzed according to the function identifier of the target calling function and the information carried on the syntax tree to obtain the runtime metadata corresponding to the target calling function, including: traversing each calling function in the syntax tree, and performing signature judgment on each calling function through the function identifier of the target calling function; if it is judged that the function identifier of the calling function is the same as the function identifier of the target calling function, the target calling function is statically analyzed according to the information carried on the syntax tree to obtain the runtime metadata corresponding to the target calling function.

[0092] According to one or more embodiments of the present disclosure, the runtime metadata is added to the function object of the target calling function, including: associating a preset field with the interface code of the target function object; in response to the target calling function calling the function object through the interface code, adding a preset field in the function object of the target calling function, and adding the runtime metadata to the preset field; wherein the preset field is a field of string type.

[0093] According to one or more embodiments of the present disclosure, adding a preset field in the function object of the target calling function includes: adding the preset field at the end of the function object of the target calling function, or adding the preset field at the beginning of the function object of the target calling function.

[0094] According to one or more embodiments of the present disclosure, the target calling function includes a print log function, and the runtime metadata includes line number information.

[0095] In a second aspect, according to one or more embodiments of the present disclosure, a runtime metadata call control device is provided, including:

[0096] A determination unit, configured to respond to a runtime metadata acquisition request of a target calling function, wherein the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function generated by static analysis at compile time in advance;

[0097] A calling unit, configured to directly obtain the target runtime metadata from the runtime metadata generated in advance by static analysis during compilation according to the function calling interface of the target calling function in the runtime metadata acquisition request; wherein the runtime metadata generated in advance by static analysis during compilation includes runtime metadata generated in advance by static analysis of information carried on a syntax tree by a compiler during a syntax tree parsing phase for a target runtime metadata type indicated in a configuration file, and the target runtime metadata type is a runtime metadata type corresponding to the target calling function.

[0098] According to one or more embodiments of the present disclosure, the runtime metadata pre-generated by static analysis during compile time is recorded in the function object of the target calling function; accordingly, the calling unit directly obtains the target runtime metadata from the runtime metadata pre-generated by static analysis during compile time according to the function calling interface of the target calling function in the runtime metadata acquisition request, including: directly obtaining the target runtime metadata from a preset field of the function object according to the function calling interface of the target calling function in the runtime metadata acquisition request.

[0099] According to one or more embodiments of the present disclosure, the calling unit directly obtains the target runtime metadata from the preset field of the function object, including: determining whether the preset field of the function object is empty; when it is not empty, directly obtaining the target runtime metadata from the preset field of the function object; otherwise, obtaining the target runtime metadata from the runtime context.

[0100] According to one or more embodiments of the present disclosure, the call control device also includes: a compilation unit; the compilation unit, for the target runtime metadata type indicated in the configuration file, pre-generates runtime metadata by statically analyzing the information carried on the syntax tree through the compiler in the syntax tree parsing stage, including: determining, by the compiler in the syntax tree parsing stage, the function identifier of the target call function corresponding to the target runtime metadata type indicated in the configuration file; statically analyzing the target call function according to the function identifier of the target call function and the information carried on the syntax tree to obtain the runtime metadata corresponding to the target call function; and adding the runtime metadata to the function object of the target call function.

[0101] According to one or more embodiments of the present disclosure, the compilation unit performs static analysis on the target calling function according to the function identifier of the target calling function and the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function, including: traversing each calling function in the syntax tree, and performing signature judgment on each calling function through the function identifier of the target calling function; if it is judged that the function identifier of the calling function is the same as the function identifier of the target calling function, then performing static analysis on the target calling function according to the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function.

[0102] According to one or more embodiments of the present disclosure, the compilation unit adds the runtime metadata to the function object of the target calling function, including: associating a preset field with the interface code of the target function object; in response to the target calling function calling the function object through the interface code, adding a preset field in the function object of the target calling function, and adding the runtime metadata to the preset field; wherein the preset field is a field of string type.

[0103] According to one or more embodiments of the present disclosure, the compilation unit adds a preset field in the function object of the target calling function, including: adding the preset field at the end of the function object of the target calling function, or adding the preset field at the beginning of the function object of the target calling function.

[0104] According to one or more embodiments of the present disclosure, the target calling function includes a print log function, and the runtime metadata includes line number information.

[0105] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;

[0106] The memory stores computer-executable instructions;

[0107] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the runtime metadata call control method as described in the first aspect and various possible designs of the first aspect.

[0108] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the runtime metadata calling control method described in the first aspect and various possible designs of the first aspect is implemented.

[0109] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the runtime metadata calling control method as described in the first aspect and various possible designs of the first aspect.

[0110] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0111] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0112] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A runtime metadata call control method, characterized in that: include: In response to a runtime metadata acquisition request of a target calling function, the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function generated by static analysis at compile time in advance; According to the function call interface of the target call function in the runtime metadata acquisition request, directly acquiring the target runtime metadata from the runtime metadata generated in advance by static analysis during compilation; Among them, the runtime metadata generated by static analysis during compilation includes runtime metadata generated in advance by the compiler in the syntax tree parsing stage based on static analysis of information carried on the syntax tree for the target runtime metadata type indicated in the configuration file, and the target runtime metadata type is the runtime metadata type corresponding to the target calling function.

2. The call control method according to claim 1, characterized in that: The runtime metadata generated in advance by static analysis during compilation is recorded in the function object of the target calling function; Accordingly, directly acquiring the target runtime metadata from the runtime metadata generated by static analysis in advance during compilation according to the function call interface of the target call function in the runtime metadata acquisition request includes: The target runtime metadata is directly acquired from a preset field of the function object according to the function calling interface of the target calling function in the runtime metadata acquisition request.

3. The call control method according to claim 2, characterized in that: The directly acquiring the target runtime metadata from the preset field of the function object includes: Determine whether the preset field of the function object is empty; When it is not empty, the target runtime metadata is directly obtained from the preset field of the function object; otherwise, the target runtime metadata is obtained from the runtime context.

4. The call control method according to claim 1, characterized in that: The runtime metadata generated in advance by the compiler during the syntax tree parsing phase according to the information carried on the syntax tree for the target runtime metadata type indicated in the configuration file includes: Determine, by the compiler in the syntax tree parsing stage, according to the target runtime metadata type indicated in the configuration file, a function identifier of a target call function corresponding to the target runtime metadata type; Performing static analysis on the target calling function according to the function identifier of the target calling function and the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function; The runtime metadata is added to a function object of the target call function.

5. The call control method according to claim 4, characterized in that: The step of performing static analysis on the target calling function according to the function identifier of the target calling function and the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function includes: Traversing each calling function in the syntax tree, and performing signature judgment on each calling function according to the function identifier of the target calling function; If it is determined that the function identifier of the calling function is the same as the function identifier of the target calling function, a static analysis is performed on the target calling function according to the information carried on the syntax tree to obtain runtime metadata corresponding to the target calling function.

6. The call control method according to claim 4, characterized in that: Adding the runtime metadata to the function object of the target calling function includes: Associating a preset field with an interface code of the objective function object; In response to the target calling function calling the function object through the interface code, a preset field is added in the function object of the target calling function, and the runtime metadata is added to the preset field; wherein the preset field is a field of string type.

7. The calling control method according to claim 6, characterized in that: Adding preset fields to the function object of the target calling function includes: A preset field is added to the end of the function object of the target calling function, or a preset field is added to the head of the function object of the target calling function.

8. The calling control method according to any one of claims 1 to 7, characterized in that: The target calling function includes a print log function, and the runtime metadata includes line number information.

9. A runtime metadata call control device, characterized in that: include: A determination unit, configured to respond to a runtime metadata acquisition request of a target calling function, wherein the runtime metadata acquisition request is used to instruct acquisition of target runtime metadata about the target calling function generated by static analysis at compile time in advance; A calling unit, configured to directly obtain the target runtime metadata from the runtime metadata generated in advance by static analysis during compilation according to the function calling interface of the target calling function in the runtime metadata acquisition request; wherein the runtime metadata generated in advance by static analysis during compilation includes runtime metadata generated in advance by static analysis of information carried on a syntax tree by a compiler during a syntax tree parsing phase for a target runtime metadata type indicated in a configuration file, and the target runtime metadata type is a runtime metadata type corresponding to the target calling function.

10. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the runtime metadata call control method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the runtime metadata calling control method as described in any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the runtime metadata call control method according to any one of claims 1 to 8 is implemented.