CN114327772A - Code injection method, device, equipment and storage medium - Google Patents

Code injection method, device, equipment and storage medium Download PDF

Info

Publication number
CN114327772A
CN114327772A CN202111646723.5A CN202111646723A CN114327772A CN 114327772 A CN114327772 A CN 114327772A CN 202111646723 A CN202111646723 A CN 202111646723A CN 114327772 A CN114327772 A CN 114327772A
Authority
CN
China
Prior art keywords
code
editable
control flow
flow graph
injection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111646723.5A
Other languages
Chinese (zh)
Inventor
樊冰新
陈逢锦
郑旗
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202111646723.5A priority Critical patent/CN114327772A/en
Publication of CN114327772A publication Critical patent/CN114327772A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The disclosure provides a code injection method, a code injection device, code injection equipment and a storage medium, and relates to the technical fields of cloud service, edge computing, artificial intelligence, block chains and the like. The specific implementation scheme is as follows: acquiring a first code of a target program during running; converting the first code into an editable code; determining a control flow graph of editable code; injecting the second code into the editable code according to the control flow graph to obtain a third code; the third code is executed. The implementation mode can insert the second code according to the control flow graph, thereby reducing the performance overhead of the injected code and improving the execution efficiency.

Description

Code injection method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the technical fields of cloud services, edge computing, artificial intelligence, block chaining, and the like, and in particular, to a code injection method, apparatus, device, and storage medium.
Background
Code injection is the injection of code segments that implement certain functions into application code to increase the functionality that can be implemented by the original application. The code injection is realized by the process of dynamically inserting the code segment into the preset position in the process of running the application program.
The existing code injection method often needs to modify the source code, which is difficult to implement in some situations where the source code cannot be acquired.
Disclosure of Invention
The disclosure provides a code injection method, a device, equipment and a storage medium.
According to a first aspect, there is provided a code injection method comprising: acquiring a first code of a target program during running; converting the first code into an editable code; determining a control flow graph of editable code; injecting the second code into the editable code according to the control flow graph to obtain a third code; the third code is executed.
According to a second aspect, there is provided a code injection apparatus comprising: an acquisition unit configured to acquire a first code of a target program at runtime; a conversion unit configured to convert the first code into an editable code; a determination unit configured to determine a control flow graph of editable code; an injection unit configured to inject the second code into the editable code according to the control flow graph, resulting in a third code; an execution unit configured to execute the third code.
According to a third aspect, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described in the first aspect.
According to a fourth aspect, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method as described in the first aspect.
According to a fifth aspect, a computer program product comprising a computer program which, when executed by a processor, implements the method as described in the first aspect.
According to the technology disclosed by the invention, the second code can be inserted according to the control flow graph, so that the performance overhead of the injected code is reduced, and the execution efficiency is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a code injection method according to the present disclosure;
FIG. 3 is a schematic diagram of one application scenario of a code injection method according to the present disclosure;
FIG. 4 is a flow diagram of another embodiment of a code injection method according to the present disclosure;
FIG. 5 is a schematic block diagram of one embodiment of a code injection apparatus according to the present disclosure;
FIG. 6 is a block diagram of an electronic device for implementing a code injection method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture to which embodiments of the code injection method or code injection apparatus of the present disclosure may be applied.
As shown in fig. 1, the system architecture may include a virtual machine and its execution engine. The Virtual Machine may be various Virtual machines such as a Java Virtual Machine (JVM), an Etherhouse Virtual Machine (EVM). The execution engine may be a part Of the virtual machine responsible for code out-Of-execution, such as an AOT (Ahead-Of-Time) execution engine, a JIT (Just-In-Time) execution engine, an interpreter, and so on.
The virtual machine is a concept relative to a 'physical machine', both machines have code execution capacity, and the difference is that an execution engine of the physical machine is directly established on the processor, cache, instruction set and operating system level, and the execution engine of the virtual machine is realized by software, so that the structural system of the instruction set and the execution engine can be customized without being limited by physical conditions, and the instruction set format which is not directly supported by hardware can be executed.
It should be noted that the code injection method provided by the embodiments of the present disclosure is generally executed by a virtual machine. Accordingly, the code injection apparatus is generally provided in the virtual machine.
It should be understood that the number of virtual machines and execution engines in FIG. 1 is merely illustrative. There may be any number of virtual machines and execution engines, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a code injection method according to the present disclosure is shown. The code injection method of the embodiment comprises the following steps:
step 201, acquiring a first code of a target program during running.
In this embodiment, the execution subject may first obtain the first code of the target program when running. The target program may be any program installed on the virtual machine. A program running on a hardware or platform requires an intermediate layer for converting the programming language into a machine language understandable by the machine. Here, the machine language may be referred to as a first code. In some specific applications, the target program may be an execution engine, Webassembly, which is a method for using non-JavaScript code and making it run in a browser. These codes may be C, C + + or Rust, etc. They are compiled into a browser and run at a speed close to native on the CPU. These codes are in the form of binary files, which can be used directly in JavaScript as modules. Thus, the first code may be binary code or text. The first code may exist in the form of a wasm file or a wait file, both of which are readable forms of WebAssembly.
Step 202, converting the first code into an editable code.
After obtaining the first code, the execution subject may convert the first code into editable code using a code conversion tool. Here, the editable code may be C language code, IR (Intermediate Representation) of LLVM (LLVM is a framework system of a framework compiler, written in C + +), abstract syntax tree, or the like. The transcoding tool may be a WABT (The WebAssembly Binary Toolkit), which is a set of tools for WebAssembly containing a series of tools, such as a wat2wasm tool (converting from WebAssembly text format to WebAssembly Binary format), a wasm2wat tool (converting from Binary format back to text format (also referred to as. wat) as opposed to wat2 wasm), a wasm2C tool (converting from Binary format to C language format), a wasm2js tool (converting from Binary format to JSON language format), and a wasm-objdump (displaying information about a wasm Binary file).
Step 203, determine a control flow graph of editable code.
The execution subject may further determine a control flow graph of the editable code after determining the editable code. Specifically, the execution subject may analyze an execution sequence of each instruction in the editable code, and if the execution sequence of the instructions is different from the arrangement sequence of the instructions, it is indicated that a jump exists between the instructions. By analyzing the jump relation among the instructions, a control flow graph of editable codes can be obtained. A control flow graph is an abstract representation of a program, in which each node is a basic block and edges represent jump related instructions. A basic block refers to an instruction sequence without any jump instructions, and an instruction in a basic block is either all executed or none executed.
And step 204, injecting the second code into the editable code according to the control flow graph to obtain a third code.
The execution subject may select an injection position in the editable code according to the obtained control flow graph. And injecting a second code at the injection position to obtain a third code. Here, the injection position may be a position where the instruction jumps, or a position where the instruction is executed a preset number of times. The second code may be code for performing various functions, such as resource auditing functions, instruction tracing functions, and so forth. It will be appreciated that the form of the second code is the same as the form of the editable code. That is, if the editable code is C language code, the second code is also C language code.
Step 205, the third code is executed.
The execution subject may execute a third code obtained after the code injection to obtain an execution result. The execution result may be text information, numerical value, or the like.
With continued reference to fig. 3, a schematic diagram of one application scenario of a code injection method according to the present disclosure is shown. In the application scenario of fig. 3, the user source code is converted by the language tool chain to obtain a text file or binary code of the execution engine webassociation. The text file or binary code is converted by different language conversion tools to obtain different editable codes (including C code, LLVM IR, other modifiable intermediate representation, etc.). A control flow graph of editable code is then determined. And injecting the second code into the jump instruction position of the editable code to obtain an intermediate representation (namely, a third code) after the code is injected. The third code is entered into a different module in runtime for execution. Where the runtime is responsible for the actual execution of the code. The method comprises the steps that during AOT operation, WebAssembly is compiled into a module related to a local machine code, then related machine instructions are executed, and during the operation of an interpreter, the WebAssembly instructions are read one by one, translated into the machine instructions and executed. The JIT runtime is between the AOT runtime and the interpreter, and the execution code is interpreted one by one firstly, and the hot spot code is detected at the same time, the hot spot code is translated into the local relevant machine code, and the subsequent hot spot code execution is not translated one by one, but the translated local machine relevant code is executed.
According to the code injection method provided by the embodiment of the disclosure, the second code can be inserted according to the control flow graph, so that the performance overhead of the injected code is reduced, and the execution efficiency is improved.
With continued reference to FIG. 4, a flow 400 of another embodiment of a code injection method according to the present disclosure is shown. As shown in fig. 4, the method of the present embodiment may include the following steps:
step 401, a first code of a target program during running is obtained.
Step 402, converting the first code into an editable code.
At step 403, a control flow graph of editable code is determined.
Step 404, determining jump instruction positions between basic blocks in the editable code according to the control flow graph; and injecting the second code into the position of the jump instruction of the editable code to obtain a third code.
In this embodiment, after obtaining the control flow graph, the execution subject may determine the jump instruction positions between basic blocks in the editable code. In particular, the execution body may refer to an instruction between two adjacent jump instructions in the control flow graph as a basic block. The execution body may inject the second code at the location of the jump instruction, resulting in the third code. In some specific applications, the second code may be a resource audit code. If the resource statistics are carried out on each instruction, 50% of the instructions are used for resource auditing, and the determination of the insertion position of the resource auditing code by analyzing the control flow is mainly used for reducing the overhead caused by the resource auditing. Resource auditing is carried out when basic block skipping occurs in a control flow diagram, and resource auditing operation is not required to be carried out in the basic block.
In some optional implementations of this embodiment, the executing agent, when injecting the second code, may be implemented by: determining an injection form of the second code according to the type of the editable code; and injecting the second code into the editable code according to the injection form to obtain the third code.
The execution agent may determine the injection form of the second code according to the type of the editable code. For example, if the editable code is C code, the injected form of the second code may be C code. If the type of editable code is LLVM IR, the injection form of the second code may be instructions of LLVM IR. If the type of the editable code is an abstract syntax tree, the injection form of the second code may be a node of the abstract syntax tree. The execution agent may inject the second code into the editable code via the injection form described above, resulting in the third code. For example, if the type of editable code is an abstract syntax tree, the execution body may inject the second code by modifying nodes of the abstract syntax tree.
Step 405, persisting the third code; executing the code after the persistence.
In this embodiment, the execution subject may also persist the code obtained in the injection process. Here, the persistence may be to efficiently store the code or to convert the code obtained during the injection process into another form of code. In this way, the code obtained during the injection process can be effectively preserved. The execution agent may then execute the code after the persistence.
In some optional implementations of the present embodiment, the execution body may perform persistence by: and the third code is encoded and stored.
In this implementation, the execution agent may directly encode the third code and store the third code for use in a subsequent tool chain. Here, the serialization may refer to the serialization of the third code using various existing algorithms. It will be appreciated that subsequent tool chains, when used, may be deserialized first.
In some optional implementations of the present embodiment, the execution body may perform persistence by: the third code is compiled into machine code.
In this implementation, the execution agent may compile the third code into machine code. In this way, subsequent execution of third code at AOT runtime may be facilitated.
In some optional implementations of the present embodiment, the execution body may perform persistence by: the third code is converted into the same format as the first code.
In this implementation, the execution body may convert the third code into the same format as the first code. In particular, the execution agent may perform the above-described conversion using an existing transcoding tool. After conversion, the JIT runtime and interpreter facilitate execution on the third code.
The code injection method provided by the above embodiment of the present disclosure introduces a control flow analysis technique to reduce the resource audit loss. In a modern system structure, the proportion of branch instructions is about 10%, a basic unit of resource audit is changed into a basic block from one instruction through a control flow analysis technology, and the expense of resource audit is reduced to 10% of the original expense. In addition, by reducing the number of instructions for resource auditing, the performance overhead caused by cache invalidation, instruction prefetching and the like is reduced, and the performance overhead of resource auditing is further reduced.
In the blockchain application field, a user initiates a transaction through a node in a blockchain by using an external account in a blockchain network, and the transaction can be a common transfer transaction and can also be used for creating an intelligent contract or calling the intelligent contract. For example, a user issues an intelligent contract, the user writes the intelligent contract in a high-level language, and the intelligent contract needs to be compiled into Webassembly bytecode by a compiler to generate a contract module (which may also be referred to as a Webassembly module). The user may then publish the contract in the form of a transaction into the blockchain network. In the process of executing the intelligent contract by other nodes in the block chain network, functions such as resource statistics or resource limitation are generally required to be performed on the intelligent contract. In the case that the source code of the intelligent contract cannot be modified, the function needs to be dynamically injected into the intelligent contract to realize the function. By the code injection method, the function codes can be injected in the running process of the intelligent contract, the code injection efficiency is improved, and the intelligent contract in the block chain network can be conveniently controlled. And meanwhile, functional codes can be injected at the position of the jump instruction, so that the performance overhead of executing the functional codes is reduced, and the running efficiency of the codes is improved.
With further reference to fig. 5, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a code injection apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the code injection apparatus 500 of the present embodiment includes: an acquisition unit 501, a conversion unit 502, a determination unit 503, an injection unit 504, and an execution unit 505.
An obtaining unit 501 is configured to obtain a first code of a target program when the target program is running.
A conversion unit 502 configured to convert the first code into an editable code.
A determination unit 503 configured to determine a control flow graph of the editable code.
An injection unit 504 configured to inject the second code into the editable code according to the control flow graph, resulting in a third code.
An execution unit 505 configured to execute the third code.
In some optional implementations of this embodiment, the injection unit 504 may be further configured to: according to the control flow graph, determining jump instruction positions between basic blocks in the editable code; and injecting the second code into the position of the jump instruction of the editable code to obtain a third code.
In some optional implementations of this embodiment, the injection unit 504 may be further configured to: determining an injection form of the second code according to the type of the editable code; and injecting the second code into the editable code according to the injection form to obtain the third code.
In some optional implementations of this embodiment, the execution unit 505 may be further configured to: the third code is subjected to persistence; executing the code after the persistence.
In some optional implementations of this embodiment, the execution unit 505 may be further configured to: and the third code is encoded and stored.
In some optional implementations of this embodiment, the execution unit 505 may be further configured to: the third code is compiled into machine code.
In some optional implementations of this embodiment, the execution unit 505 may be further configured to: the third code is converted into the same format as the first code.
It should be understood that the units described in the code injection apparatus 500 correspond to the respective steps in the method described in fig. 2. Thus, the operations and features described above with respect to the code injection method are equally applicable to the apparatus 500 and the units included therein and will not be described in detail here.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information of the related user are all in accordance with the regulations of related laws and regulations and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to an embodiment of the present disclosure.
Fig. 6 shows a block diagram of an electronic device 600 that performs a code injection method according to an embodiment of the disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the electronic device 600 includes a processor 601 that may perform various suitable actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)602 or a computer program loaded from a memory 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the electronic apparatus 600 can also be stored. The processor 601, the ROM 602, and the RAM603 are connected to each other via a bus 604. An I/O interface (input/output interface) 605 is also connected to the bus 604.
Various components in the electronic device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a memory 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the electronic device 600 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
Processor 601 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of processor 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 601 performs the various methods and processes described above, such as the code injection method. For example, in some embodiments, the code injection method may be implemented as a computer software program tangibly embodied in a machine-readable storage medium, such as the memory 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into the RAM603 and executed by the processor 601, one or more steps of the code injection method described above may be performed. Alternatively, in other embodiments, the processor 601 may be configured to perform the code injection method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. The program code described above may be packaged as a computer program product. These program code or computer program products may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program code, when executed by the processor 601, causes the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable storage medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable storage medium may be a machine-readable signal storage medium or a machine-readable storage medium. A machine-readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel or sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions of the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (17)

1. A code injection method, comprising:
acquiring a first code of a target program during running;
converting the first code into an editable code;
determining a control flow graph of the editable code;
injecting a second code into the editable code according to the control flow graph to obtain a third code;
executing the third code.
2. The method of claim 1, wherein said injecting second code into said editable code according to said control flow graph resulting in third code comprises:
according to the control flow graph, determining jump instruction positions between basic blocks in the editable code;
and injecting the second code into the position of the jump instruction of the editable code to obtain the third code.
3. The method of claim 1, wherein said injecting second code into said editable code according to said control flow graph resulting in third code comprises:
determining an injection form of the second code according to the type of the editable code;
and injecting the second code into the editable code according to the injection form to obtain a third code.
4. The method of claim 1, wherein the executing the third code comprises:
persisting the third code;
executing the code after the persistence.
5. The method of claim 4, wherein the persisting the third code comprises:
and the third code is encoded and stored.
6. The method of claim 4, wherein the persisting the third code comprises:
compiling the third code into machine code.
7. The method of claim 4, wherein the persisting the third code comprises:
converting the third code to the same format as the first code.
8. A code injection apparatus, comprising:
an acquisition unit configured to acquire a first code of a target program at runtime;
a conversion unit configured to convert the first code into an editable code;
a determination unit configured to determine a control flow graph of the editable code;
an injection unit configured to inject a second code into the editable code according to the control flow graph, resulting in a third code;
an execution unit configured to execute the third code.
9. The apparatus of claim 8, wherein the injection unit is further configured to:
according to the control flow graph, determining jump instruction positions between basic blocks in the editable code;
and injecting the second code into the position of the jump instruction of the editable code to obtain the third code.
10. The apparatus of claim 8, wherein the injection unit is further configured to:
determining an injection form of the second code according to the type of the editable code;
and injecting the second code into the editable code according to the injection form to obtain a third code.
11. The apparatus of claim 8, wherein the execution unit is further configured to:
persisting the third code;
executing the code after the persistence.
12. The apparatus of claim 11, wherein the execution unit is further configured to:
and the third code is encoded and stored.
13. The apparatus of claim 11, wherein the execution unit is further configured to:
compiling the third code into machine code.
14. The apparatus of claim 11, wherein the execution unit is further configured to:
converting the third code to the same format as the first code.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-7.
CN202111646723.5A 2021-12-30 2021-12-30 Code injection method, device, equipment and storage medium Pending CN114327772A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111646723.5A CN114327772A (en) 2021-12-30 2021-12-30 Code injection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111646723.5A CN114327772A (en) 2021-12-30 2021-12-30 Code injection method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114327772A true CN114327772A (en) 2022-04-12

Family

ID=81017016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111646723.5A Pending CN114327772A (en) 2021-12-30 2021-12-30 Code injection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114327772A (en)

Similar Documents

Publication Publication Date Title
CN110096338B (en) Intelligent contract execution method, device, equipment and medium
US9069574B2 (en) Code analysis for simulation efficiency improvement
US10579351B2 (en) Computer speed via metadata-based business rule interpreter
CN110780879B (en) Decision execution method, device, equipment and medium based on intelligent compiling technology
CN114327481A (en) Code processing method, device, equipment and storage medium
CN111427583A (en) Component compiling method and device, electronic equipment and computer readable storage medium
CN112506602B (en) Page generation method and device, electronic equipment and computer readable medium
CN114691148A (en) Model reasoning acceleration method and device, electronic equipment and storage medium
CN114879948A (en) WebAssembly-based intelligent contract processing method, device, equipment and storage medium
US11029924B2 (en) Program optimization by converting code portions to directly reference internal data representations
US9886251B2 (en) Optimized compiling of a template function
CN112925522A (en) Dependency graph generation method, dependency graph generation device, dependency graph generation apparatus, storage medium, and program product
CN114327772A (en) Code injection method, device, equipment and storage medium
US20110246972A1 (en) Method of selecting an expression evaluation technique for domain-specific language compilation
CN112114817B (en) COBOL language-based data dictionary field information acquisition method and device
US11429358B2 (en) Representing asynchronous state machine in intermediate code
CN114327496A (en) Code injection method, device, equipment and storage medium
CN114416029A (en) Data processing method, device, equipment, storage medium and computer program product
CN114327774A (en) Code running method, device, equipment and storage medium
CN113296837A (en) Resource calculation method and device, electronic equipment and readable storage medium
CN112650502A (en) Batch processing task processing method and device, computer equipment and storage medium
CN113010182B (en) Method and device for generating upgrade file and electronic equipment
CN113031962B (en) Compiling method, compiling apparatus, electronic device, storage medium, and program product
CN115809062A (en) Operating system development processing method, device, equipment and storage medium
CN115145627A (en) Method, device, equipment and storage medium for building local operation environment of plug-in

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination