Code processing method and apparatus, and computing device cluster
By annotating runtime information in the source code, the problem of insufficient compiler optimization generalization is solved, thereby improving the generalization of applications and increasing upgrade efficiency.
Patent Information
- Application Number
- PCT/CN2025/071230
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-04
- Filing Date
- 2025-01-08
- Publication Date
- 2025-12-11
AI Technical Summary
Existing compiler optimization techniques lack generality when generating applications, and application upgrades and maintenance are difficult.
By annotating runtime information on the source code, runtime information is obtained and stored to generate annotated source code, allowing developers to modify and compile it, and guiding compiler optimization.
It improves the versatility of applications, reduces the difficulty of upgrading and maintaining them, and increases code development efficiency.
Smart Images

Figure CN2025071230_11122025_PF_FP_ABST
Abstract
Description
Code processing method, device and computing device cluster
[0001] The present application claims priority to the Chinese patent application No. 202410716101.2, filed on June 4, 2024, and entitled "Code processing method, device and computing device cluster", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the field of information technology (IT), and in particular, to a code processing method, device and computing device cluster. BACKGROUND
[0003] A compiler is a tool that converts a high-level programming language into executable machine code for a central processing unit (CPU). The compiler can optimize the source code and generate an executable program. The optimization capability of the compiler will directly affect the efficiency of the application program generated by the compiler in terms of CPU computing resources and memory usage resources.
[0004] In related technologies, feedback optimization techniques such as profile-guided optimization (PGO) and automatic feedback-directed optimization (AutoFDO) are commonly used to improve the optimization capability of the compiler. Although these techniques can improve the optimization effect of the compiler to some extent, there are still problems such as insufficient generalization of the generated application program, and difficulty in upgrading and maintaining the application program. SUMMARY
[0005] The present application provides a code processing method, device, computing device cluster, computer storage medium and computer product, which can improve the generalization of the application program generated by the compiler, and reduce the difficulty of upgrading and maintaining the application program.
[0006] In a first aspect, the present application provides a code processing method, comprising: receiving a first command, the first command being used to instruct to mark runtime information on a first source code; obtaining runtime information of a first application program, the first application program being compiled based on the first source code; reading the first source code from a storage, and marking the obtained runtime information on the first source code to obtain a second source code; and storing the second source code to the storage.
[0007] In this way, by labeling the runtime information on the source code, the source code labeled with the runtime information is obtained, so that the subsequent developers can directly view the relevant runtime information from the source code, and make generalization modification based on their own needs, thereby improving the generalization. In addition, the runtime information has been labeled on the source code, so that in the case that the source code is upgraded and the source code is changed little, the source code labeled with the runtime can be directly used to compile the program, so that the performance analysis data does not need to be additionally obtained after the source code is upgraded, and the code development efficiency is improved.
[0008] In a possible implementation, after the second source code is stored to the memory, the method further includes: in response to a detected first operation, displaying the second source code, the first operation being used to view the second source code; in response to a second operation, updating the runtime information labeled on the second source code to obtain third source code, the second operation being used to modify the runtime information labeled on the second source code; and storing the third source code to the memory. In this way, the developer can modify the runtime information in the source code based on the use scenario of the application program (i.e., make generalization modification), so that the modified runtime information conforms to the use scenario of the application program, thereby improving the generalization of the application program.
[0009] In a possible implementation, the method further includes: receiving a second command; reading the target code from the memory; and compiling the target code based on the runtime information labeled on the target code to obtain an application program or a hot patch related to the target code. In this way, the runtime information in the target code can guide the compiler to compile the target code, thereby improving the compilation effect. For example, the second command can be used to instruct to compile the target code. In other words, the target code is labeled with the runtime information.
[0010] In a possible implementation, the target code is the second source code, or is a sub-code in the second source code. In other words, the developer can choose to compile the complete source code, or can choose to compile part of the source code, thereby reducing the difficulty of upgrading the application program.
[0011] In a possible implementation, the runtime information can include, but is not limited to, one or more of the following: branch probability, memory access information, and function heat.
[0012] In a second aspect, the present application provides a code processing apparatus, comprising: a receiving module and a processing module. The receiving module is configured to receive a first command, the first command being used to indicate to mark runtime information on a first source code. The processing module is configured to obtain runtime information of a first application, the first application being compiled based on the first source code. The processing module is further configured to read the first source code from a memory, and mark the obtained runtime information on the first source code to obtain a second source code; and store the second source code to the memory.
[0013] In a possible implementation, the compiling apparatus further comprises a display module. The display module can be configured to display the second source code in response to a detected first operation after the processing module stores the second source code to the memory, the first operation being used to view the second source code. At this time, the processing module is further configured to update the runtime information marked on the second source code to obtain a third source code in response to a detected second operation, the second operation being used to modify the runtime information marked on the second source code; and store the third source code to the memory.
[0014] In a possible implementation, the receiving module is further configured to receive a second command. The processing module is further configured to read target code from the memory. The processing module is further configured to compile the target code based on the runtime information marked on the target code to obtain an application or a hot patch related to the target code.
[0015] In a possible implementation, the target code is the second source code, or a sub-code in the second source code. Of course, the target code can also be the third source code or a sub-code in the third source code.
[0016] In a possible implementation, the runtime information comprises one or more of branch probability, memory access information and function hotness.
[0017] In a third aspect, the present application provides a code processing apparatus, comprising at least one processor and an interface; the at least one processor obtains program instructions through the interface; and the at least one processor executes the program instructions to implement the method described in the first aspect or any possible implementation of the first aspect. Exemplarily, the code processing apparatus can be but is not limited to a chip.
[0018] In a fourth aspect, the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; and the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method described in the first aspect or any possible implementation of the first aspect.
[0019] In a fifth aspect, the present application provides a computer readable storage medium, including computer program instructions, when the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect or any possible implementation manner of the first aspect. Illustratively, the computing device cluster can include one or more computing devices.
[0020] In a sixth aspect, the present application provides a computer program product including instructions, when the instructions are run by a computing device cluster, the computing device cluster executes the method described in the first aspect or any possible implementation manner of the first aspect. Illustratively, the computing device cluster can include one or more computing devices.
[0021] It can be understood that the beneficial effects of the above-mentioned second aspect to sixth aspect can refer to the related description in the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0022] FIG. 1 is a flow diagram of a code processing method according to an embodiment of the present application;
[0023] FIG. 2 is a schematic diagram of annotating runtime information on source code according to an embodiment of the present application;
[0024] FIG. 3 is a schematic diagram of modifying the annotated runtime information on source code according to an embodiment of the present application;
[0025] FIG. 4 is a schematic diagram of obtaining second source code by annotating runtime information on first source code according to an embodiment of the present application;
[0026] FIG. 5 is a schematic diagram of obtaining third source code by modifying the annotated runtime information on second source code according to an embodiment of the present application;
[0027] FIG. 6 is a schematic diagram of interface changes when modifying the annotated runtime information on source code according to an embodiment of the present application;
[0028] FIG. 7 is a schematic diagram of compiling application program or hot patch based on source code annotated with runtime information according to an embodiment of the present application;
[0029] FIG. 8 is a structural diagram of a code processing apparatus according to an embodiment of the present application;
[0030] FIG. 9 is a structural diagram of a computing device according to an embodiment of the present application;
[0031] FIG. 10 is a structural diagram of a computing device cluster according to an embodiment of the present application;
[0032] FIG. 11 is a structural diagram of another computing device cluster according to an embodiment of the present application;
[0033] FIG. 12 is a structural schematic diagram of another code processing apparatus provided by the embodiments of the present application. DETAILED DESCRIPTION
[0034] The term "and / or" used in this document is used to describe an association relationship of associated objects, which means that there can be three relationships, for example, A and / or B can mean that there are three cases of A alone, A and B together, and B alone. The symbol " / " in this document means an or relationship of associated objects, for example, A / B means A or B.
[0035] The terms "first" and "second" and the like in the description and claims of this document are used to distinguish different objects, and are not used to describe a specific order of the objects. For example, the first response message and the second response message are used to distinguish different response messages, and are not used to describe a specific order of the response messages.
[0036] In the embodiments of the present application, the words "exemplary" or "for example" are used to mean serving as an example or illustration. Any embodiment or design presented as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or advantageous than other embodiments or design solutions. Rather, the use of "exemplary" or "for example" is intended to present concepts in a concrete manner.
[0037] In the description of the embodiments of the present application, unless otherwise specified, "a plurality of" means two or more, for example, a plurality of processing units means two or more processing units, and the like; a plurality of elements means two or more elements, and the like.
[0038] Generally, in the application compilation process, the source code (i.e. the original code in the software development process) can be first compiled by a compiler to obtain a patched program. Then, the patched program is run in a typical user scenario to obtain performance analysis (profile) data. The profile data contains runtime information of the program, such as branch probability, function hotness, or memory access information. Branch probability refers to the probability that a branch (such as a conditional statement, a loop, etc.) is executed during the execution of the application program. Function hotness refers to the frequency or number of times that each function is called or executed during the execution of the application program. Memory access information refers to the statistics and records of the memory access during the execution of the application program; these information usually includes the number of memory accesses, access mode (read or write), access address range, etc. Then, the compiler uses the profile data to analyze the performance of the program in actual operation, and identifies performance bottlenecks and hot code. Finally, the compiler can compile the source code again according to the analysis results to generate the final application program.
[0039] In addition, in the application program compiling process, the source code can also be compiled into a program by a compiler first. Then, the program compiled by the compiler is run in a typical user scenario, and sampling is performed by a tool such as perf to obtain a sampling file containing runtime information of the program. Then, the sampling file can be converted into profile data, and the source code is compiled again by using the profile data by the compiler to generate a final application program.
[0040] It can be known through the above two application program compiling processes that the profile data is obtained by relying on a specific user scenario in both of the two processes, but these scenarios often have certain differences from the real use scenario of the application program, so that the performance gain of the compiled application program is small, and the generalization is poor.
[0041] In view of this, an embodiment of the present application provides a code processing method, which can mark the runtime information contained in the profile data on the source code. In this way, the developer can view the relevant runtime information from the source code, and can modify the runtime information based on the own needs, so that the modified runtime information is consistent with the product use environment expected by the developer, and the performance generalization of the application program generated from the source code is enhanced.
[0042] The technical solution provided by the present application will be described in detail below in combination with FIG. 1. Exemplarily, FIG. 1 shows a flowchart of a code processing method provided by an embodiment of the present application. As shown in FIG. 1, the code processing method can include the following steps:
[0043] S1, a step of obtaining a second source code by marking runtime information on a first source code.
[0044] In the embodiment, the runtime information can be marked on the first source code to obtain the second source code. The runtime information is the runtime information of an application program compiled based on the first source code. For example, referring to FIG. 2, when the first source code and the runtime information are the source code and the runtime information shown in (A) of FIG. 2, the second source code can be as shown in (B) of FIG. 2. When the first source code and the runtime information are the source code and the runtime information shown in (C) of FIG. 2, the second source code can be as shown in (D) of FIG. 2. When the first source code and the runtime information are the source code and the runtime information shown in (E) of FIG. 2, the second source code can be as shown in (F) of FIG. 2.
[0045] It should be noted that S1 is not a necessary step of the method. That is, S1 is not executed every time in the execution of the method. Alternatively, S1 can also be executed every time in the execution of the method.
[0046] S2, a step of obtaining third source code by modifying the runtime information marked on the second source code.
[0047] In this embodiment, after obtaining the second source code, the developer can modify the runtime information marked on the second source code based on his own needs. After the developer completes the modification and confirms the submission of the code, the second source code can be updated to obtain the third source code. After obtaining the third source code, the second source code can be deleted or can be continued to be retained, which is not limited here. For example, referring to FIG. 3, when the first source code is the source code shown in (A) of FIG. 3, the developer can modify the runtime information to obtain the source code shown in (B) of FIG. 3.
[0048] It should be noted that S2 is not a necessary step of the method. That is, S2 is not executed every time in the execution of the method. Alternatively, S2 can be executed every time in the execution of the method.
[0049] S3, a step of compiling the source code marked with the runtime information to obtain an application program or a hot patch.
[0050] In this embodiment, the source code can be compiled based on the runtime information marked in the source code to obtain an application program. The sub-code in the source code can be compiled based on the runtime information marked in the source code to obtain a hot patch. For example, in the compilation process, the source code can be optimized based on the runtime information marked in the source code, such as basic block rearrangement, cold and hot partitioning, branch prediction, function inlining, etc.
[0051] In this way, in the program compilation process, the runtime information is marked on the source code, so that the developer can view the relevant runtime information from the source code and modify the runtime information based on his own needs, and the compilation of the source code can be guided according to the runtime information modified by the developer in the future, thereby achieving the enhancement of the performance generality of the application program generated from the source code. In addition, the runtime information is directly marked on the source code, and the runtime information can be modified according to the actual situation in the future, so that it is not necessary to maintain the profile data separately, the problem of difficult maintenance of the profile data is solved, and the resources and time for retraining the generation of the profile data every time the code is upgraded are saved.
[0052] The method shown in FIG. 1 is described in detail below in combination with FIG. 4. By way of example, FIG. 4 shows a schematic diagram of a step of obtaining the second source code by annotating the runtime information on the first source code according to an embodiment of the present application. It can be understood that the method can be executed by any device, apparatus, platform or cluster of devices having computing and processing capabilities. For ease of description, a compiler is taken as an execution subject in the following description. As shown in FIG. 4, the step of obtaining the second source code by annotating the runtime information on the first source code can include the following steps.
[0053] S11, receiving a first command, the first command being used to instruct to annotate the runtime information on the first source code.
[0054] In the embodiment, the developer can open a command line window on the computing device or the compiler, and input the first command in the window. The first command is used to instruct to annotate the runtime information on the first source code. Of course, the developer can also input the first command on the computing device or the compiler by other manners, for example, by a configuration file, etc., which is not limited herein. The compiler can receive the command after the developer completes the command input and confirms the issuance of the command. By way of example, the first command can include one or more of the path of the first source code, the path of the compiler, the parameter for specifying to annotate the runtime information on the first source code, and the output directory. In some embodiments, the first command can also be issued by other devices or apparatuses, which can be determined according to actual conditions, and is not limited herein.
[0055] S12, obtaining the runtime information of the program compiled based on the first source code.
[0056] In the embodiment, the compiler can perform the instrumentation compilation on the first source code to obtain the instrumented program. Then, the instrumented program is run to obtain the profile data. Finally, the compiler can parse the profile data to obtain the runtime information of the instrumented program. By way of example, the runtime information can include one or more of the branch probability, the memory access information and the function hotness.
[0057] In addition, the compiler can first compile the first source code into a program. Then, the program is run, and sampling is performed by using a performance analysis tool such as perf, and the sampled file is converted into the profile data. Finally, the compiler can parse the profile data to obtain the runtime information of the application program. It should be understood that in the scenario of obtaining the runtime information, when the program compiled from the first source code already exists and is running, the performance analysis tool such as perf can be directly used to perform sampling.
[0058] S13, annotating the obtained runtime information on the first source code to obtain the second source code.
[0059] In this embodiment, the compiler can first read the first source code from the memory. Then, the compiler can mark the obtained runtime information to the first source code to obtain the second source code. For example, the compiler can use the program analysis technology to process the first source code to obtain an abstract syntax tree (AST) of the first source code. Then, the compiler can add the obtained runtime information to the abstract syntax tree of the first source code. Finally, the compiler can use the program analysis technology to process the abstract syntax tree of the first source code to which the runtime information is added to obtain the source code marked with the runtime information (i.e., the second source code).
[0060] S14, store the second source code into the memory.
[0061] In this embodiment, after obtaining the second source code, the compiler can store the second source code into the memory. For example, the second source code can be stored under the output directory included in the first command. When the storage paths of the first source code and the second source code are the same, the second source code can be used to overwrite the first source code, i.e., the first source code is replaced. When the storage paths of the first source code and the second source code are different, the first source code and the second source code can be stored simultaneously, or the second source code can be stored and the first source code can be deleted. The specific implementation can be determined according to actual conditions, which is not limited herein.
[0062] In this way, through the process shown in FIG. 4, the source code marked with the runtime information can be obtained, so that the subsequent developers can directly view the relevant runtime information from the source code, and make generalization modification based on their own needs, thereby improving the generalization. In addition, the runtime information has been marked to the source code, so that in the case that the source code is upgraded and the change of the source code is small, the source code marked with the runtime information can be directly used to compile the program, so that the profile data does not need to be additionally obtained after the source code is upgraded, and the efficiency of code development is improved.
[0063] Next, S2 in the method shown in FIG. 1 will be described in detail with reference to FIG. 5. For example, FIG. 5 shows a step diagram for obtaining the third source code by modifying the runtime information marked on the second source code. It can be understood that the method can be executed by any device, apparatus, platform, device cluster having computing and processing capabilities. For ease of description, the computing device is taken as the execution subject in the following description. As shown in FIG. 5, the step of obtaining the third source code by modifying the runtime information marked on the second source code can include:
[0064] S21, in response to the detected operation of viewing the second source code, display the second source code.
[0065] In this embodiment, the developer can view the second source code stored in the storage on the computing device. After the developer finishes the operation of viewing the second source code, the computing device can detect the operation and display the second source code. For example, after the developer finishes the operation of viewing the second source code, the computing device can display the interface as shown in (A) of FIG. 6. The operation of viewing the second source code can also be referred to as a “first operation” for example.
[0066] S22, detecting an operation of modifying the runtime information annotated on the second source code.
[0067] In this embodiment, the developer can modify the runtime information annotated on the second source code based on his own needs, such as the use scenario of the product. After the developer modifies the runtime information annotated on the second source code, the computing device can detect the operation of the developer modifying the runtime information annotated on the second source code. For example, as shown in FIG. 6, the developer can modify the runtime information annotated on the source code in (A) of FIG. 6, in which the developer can modify the probability of executing branch A from 60% to 40%, modify the probability of executing branch B from 20% to 50%, and modify the probability of executing branch C from 20% to 10%. The operation of modifying the runtime information annotated on the second source code can also be referred to as a “second operation” for example.
[0068] S23, updating the runtime information annotated on the second source code to obtain a third source code in response to the modifying operation.
[0069] In this embodiment, after the computing device detects the modifying operation of the developer, the computing device can update the runtime information annotated on the second source code according to the modification of the developer, so as to obtain the third source code. For example, continuing to refer to FIG. 6, during the process of the developer modifying the source code shown in (A) of FIG. 6, the computing device can update the runtime information annotated on the second source code in real time, so as to obtain the source code shown in (B) of FIG. 6.
[0070] S24, storing the third source code into the storage in response to the detected code submission operation.
[0071] In this embodiment, after the developer completes the modification of the second source code, the developer can perform a code submission operation. After the developer completes the code submission operation, the computing device can detect the operation and store the third source code into the storage. The third source code can exist simultaneously with the second source code, or only the third source code can be saved, which is not limited herein. For example, after the developer completes the code submission operation, the computing device can request the developer to select a storage path of the third source code, so as to store the third source code into a path desired by the developer. For example, referring to FIG. 6, in (B) of FIG. 6, after the developer selects the control 61, the computing device can display an interface as shown in (C) of FIG. 6.
[0072] In this way, the developer can adaptively modify the runtime information in the source code based on the use scenario of the application program, so that the modified runtime information conforms to the use scenario of the application program.
[0073] Next, S3 in the method shown in FIG. 1 is described in detail with reference to FIG. 7. For example, FIG. 7 shows a step diagram of compiling the application program or the hot patch based on the source code marked with the runtime information according to an embodiment of the present application. It can be understood that the method can be executed by any device, apparatus, platform, or device cluster having computing and processing capabilities. For ease of description, a compiler is taken as an execution subject for description. As shown in FIG. 7, the step of compiling the application program or the hot patch based on the source code marked with the runtime information can include the following steps.
[0074] S31, receiving a second command.
[0075] In this embodiment, the developer can input the second command on the computing device in a command line window or a configuration file, and the like. After the developer completes the command input and confirms the issuance of the command, the compiler can receive the command. The second command can be used to instruct the compilation of the target code. The target code is marked with the runtime information. For example, the target code can be the second source code or a sub-code in the second source code, or the third source code or a sub-code in the third source code. That is, the developer can select to compile the complete source code, or can select to compile a part of the source code. For example, the second command can include one or more of the path of the target code, the path of the compiler, and the output directory. In some embodiments, the second command can also be issued by other devices or apparatuses, which can be determined according to actual conditions, and is not limited herein.
[0076] S32, reading the target code from the storage.
[0077] In this embodiment, after receiving the second command, the compiler can read the target code from the memory by the compiler. Illustratively, after reading the target code, the compiler can parse the target code to obtain the runtime information marked in the target code.
[0078] S33, based on the runtime information marked on the target code, the target code is compiled to obtain an application program or a hot patch related to the target code.
[0079] In this embodiment, the compiler can compile the target code based on the runtime information marked on the target code to obtain an application program or a hot patch related to the target code. Illustratively, during the compilation, the compiler can perform basic block rearrangement, cold and hot partitioning, branch prediction, function inlining and other optimizations on the target code based on the runtime information marked on the target code. When the target code is a complete source code, the compilation result is an application program related to the target code. When the target code is a sub-code in the source code, the compilation result is a hot patch related to the target code.
[0080] In this way, the runtime information in the target code can guide the compiler to compile the target code and improve the compilation effect.
[0081] It can be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. In addition, each step described in the above embodiments can be executed in whole or in part, which can be determined according to the actual situation, and this place does not make any limitation. In addition, the technical features described in the above embodiments or related to the embodiments can be combined according to the actual situation, and the combined scheme is still within the protection scope of the present application.
[0082] Based on the method in the above embodiments, the present embodiment further provides a compiling device.
[0083] Illustratively, FIG. 8 shows a structural schematic diagram of a code processing device provided by the present embodiment. As shown in FIG. 8, the code processing device 800 includes a receiving module 810 and a processing module 820. The receiving module 810 is configured to receive a first command, the first command being used to indicate marking of runtime information on a first source code. The processing module 820 is configured to obtain runtime information of a first application program, the first application program being compiled based on the first source code. The processing module 820 is further configured to read the first source code from a memory, mark the obtained runtime information on the first source code to obtain a second source code, and store the second source code to the memory.
[0084] In some embodiments, the compiling apparatus 800 further includes a display module (not shown in the figure). The display module can be configured to display the second source code in response to a detected first operation for viewing the second source code after the processing module 820 stores the second source code into the memory. At this time, the processing module 820 is further configured to update the runtime information marked on the second source code to obtain the third source code in response to a detected second operation for modifying the runtime information marked on the second source code, and store the third source code into the memory.
[0085] In some embodiments, the receiving module 810 is further configured to receive a second command. The processing module 820 is further configured to read the target code from the memory. The processing module 820 is further configured to compile the target code based on the runtime information marked on the target code to obtain an application or a hot patch related to the target code.
[0086] In some embodiments, the target code is the second source code, or a sub-code in the second source code. Of course, the target code can also be the aforementioned third source code or a sub-code in the third source code.
[0087] In some embodiments, the runtime information includes one or more of branch probability, memory access information, and function hotness.
[0088] In some embodiments, the receiving module 810 and the processing module 820 shown in FIG. 8 can be implemented by software or by hardware. For example, the implementation of the receiving module 810 is described as follows. Similarly, the implementation of the processing module 820 can refer to the implementation of the receiving module 810.
[0089] As an example of a software functional unit, the receiving module 810 can include code running on a computing instance. The computing instance can include at least one of a physical host (computing device), a virtual machine, and a container. Further, the computing instance can be one or more. For example, the receiving module 810 can include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers for running the code can be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers for running the code can be distributed in the same availability zone (AZ) or in different AZs, and each AZ includes one data center or multiple data centers with similar geographical locations. Generally, one region can include multiple AZs.
[0090] Likewise, the multiple hosts / virtual machines / containers for running the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Among them, usually one VPC is set in one region, and a communication gateway needs to be set in each VPC for cross-region communication between two VPCs in the same region or between VPCs in different regions, and the interconnection between VPCs is realized through the communication gateway.
[0091] As an example of a hardware functional unit, the receiving module 810 can include at least one computing device, such as a server, etc. Alternatively, the receiving module 810 can also be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), etc. Among them, the above-mentioned PLD can be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0092] The multiple computing devices included in the receiving module 810 can be distributed in the same region or in different regions. The multiple computing devices included in the receiving module 810 can be distributed in the same AZ or in different AZs. Likewise, the multiple computing devices included in the receiving module 810 can be distributed in the same VPC or in multiple VPCs. Among them, the multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, and GALs, etc.
[0093] It should be noted that in other embodiments, the receiving module 810 can be used to perform any step of the code processing method described in the above embodiments, and the processing module 820 can also be used to perform any step of the code processing method described in the above embodiments. In addition, the receiving module 810 can also be combined with the processing module 820 to be responsible for performing any step of the code processing method described in the above embodiments. In addition, the steps implemented by the receiving module 810 and the processing module 820 can also be specified as needed, and the receiving module 810 and the processing module 820 respectively implement different steps of the code processing method described in the above embodiments to realize the entire function of the code processing apparatus 800 shown in FIG. 8.
[0094] The application also provides a computing device 900. As shown in FIG. 9, the computing device 900 includes a bus 902, a processor 904, a memory 906, and a communication interface 908. The processor 904, the memory 906, and the communication interface 908 communicate with each other through the bus 902. The computing device 900 can be a server or a terminal device such as a personal computer. For example, the computing device 900 can be, but is not limited to, configured with an integrated development environment (IDE). The IDE is an application program for providing a program development environment. Of course, the computing device 900 can also be, but is not limited to, configured with a compiler. It should be understood that the number of processors and memories in the computing device 900 is not limited.
[0095] The bus 902 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one line is shown in FIG. 9, but it does not mean that there is only one bus or only one type of bus. The bus 904 can include a path for transmitting information between various components (e.g., the memory 906, the processor 904, the communication interface 908) of the computing device 900.
[0096] The processor 904 can include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP), etc.
[0097] The memory 906 can include a volatile memory such as a random access memory (RAM). The processor 904 can also include a non-volatile memory such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0098] The executable program code stored in the memory 906 is executed by the processor 904 to implement the functions of the receiving module 810 and the processing module 820 shown in FIG. 8 respectively, so as to implement the code processing method described in the above embodiments. That is, the memory 906 stores instructions for executing the code processing method described in the above embodiments. Alternatively, the executable program code stored in the memory 906 is executed by the processor 904 to implement the functions of the code processing apparatus 800 shown in FIG. 8 respectively, so as to implement the code processing method described in the above embodiments. That is, the memory 906 stores instructions for executing the code processing method described in the above embodiments. Alternatively, the memory 906 can also store source code, for example, one or more of the first source code, the second source code, or the third source code described above.
[0099] The communication interface 908 uses a transceiver module such as, but not limited to, a network interface card and a transceiver, to implement communication between the computing device 900 and other devices or communication networks.
[0100] The embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, for example, a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a notebook computer, or a smart phone.
[0101] As shown in FIG. 10, the computing device cluster includes at least one computing device 900. The memory 906 in one or more computing devices 900 in the computing device cluster can store the same instructions for executing the code processing method described in the above embodiments.
[0102] In some possible implementations, the memory 906 of one or more computing devices 900 in the computing device cluster can also respectively store partial instructions for executing the code processing method described in the above embodiments. In other words, the combination of one or more computing devices 900 can collectively execute the instructions for executing the code processing method described in the above embodiments.
[0103] It should be noted that the memory 906 in different computing devices 900 in the computing device cluster can store different instructions for respectively executing part of the functions of the code processing apparatus 800 shown in FIG. 8. That is, the instructions stored in the memory 906 in different computing devices 900 can implement the functions of one or more of the receiving module 810 and the processing module 820.
[0104] In some possible implementation manners, one or more of the computing devices in the computing device cluster can be connected through a network. The network can be a wide area network, a local area network, or the like. FIG. 11 shows one possible implementation manner. As shown in FIG. 11, two computing devices 900A and 900B are connected through a network. Specifically, the computing devices are connected to the network through communication interfaces in the computing devices. In this kind of possible implementation manner, the memory 906 in the computing device 900A stores instructions for performing the functions of the receiving module 810. Meanwhile, the memory 906 in the computing device 900B stores instructions for performing the functions of the processing module 820.
[0105] It should be understood that the functions of the computing device 900A shown in FIG. 11 can also be completed by a plurality of computing devices 900. Similarly, the functions of the computing device 900B can also be completed by a plurality of computing devices 900.
[0106] Embodiments of the present application further provide another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to the connection manners of the computing device clusters described with reference to FIG. 10 and FIG. 11. The difference is that the memory 906 in one or more of the computing devices 900 in the computing device cluster can store the same instructions for performing the method in the foregoing embodiments.
[0107] In some possible implementation manners, the memory 906 in one or more of the computing devices 900 in the computing device cluster can also respectively store partial instructions for performing the foregoing code processing method. In other words, the combination of one or more of the computing devices 900 can collectively execute the instructions for performing the foregoing code processing method.
[0108] Based on the method in the foregoing embodiments, embodiments of the present application further provide a code processing apparatus. Please refer to FIG. 12, which is a structural schematic diagram of another code processing apparatus provided by embodiments of the present application. As shown in FIG. 12, the code processing apparatus 1200 includes one or more processors 1201 and interface circuit 1202. Optionally, the code processing apparatus 1200 can also include a bus 1203. Wherein:
[0109] The processor 1201 can be an integrated circuit chip having a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware or the instruction in the form of software in the processor 1201. The processor 1201 described above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method and step disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor.
[0110] The interface circuit 1202 can be used for transmitting or receiving data, instructions or information. The processor 1201 can process the data, instructions or other information received by the interface circuit 1202, and can send the processed information out through the interface circuit 1202.
[0111] Optionally, the code processing device 1200 further includes a memory, which can include a read-only memory and a random access memory, and provides operation instructions and data for the processor. Part of the memory can also include a non-volatile random access memory (NVRAM).
[0112] Optionally, the memory stores executable software modules or data structures, and the processor can execute corresponding operations by calling operation instructions stored in the memory (which can be stored in an operating system). Alternatively, the memory can also store source code, such as one or more of the first source code, the second source code or the third source code described above.
[0113] Optionally, the interface circuit 1202 can be used to output the execution result of the processor 1201.
[0114] It should be noted that the functions of the processor 1201 and the interface circuit 1202 respectively can be realized by hardware design, software design or a combination of hardware and software, which is not limited here.
[0115] Based on the method in the above embodiments, the embodiments of the present application provide a computer readable storage medium, which includes computer program instructions, when the computer program instructions are executed by a computing device cluster including at least one computing device, so that the computing device cluster executes the method in the above embodiments. Illustratively, the computer readable storage medium can be any available medium that the computing device can store or a data storage device including one or more available media, such as a data center. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk) and the like.
[0116] Based on the method in the above-mentioned embodiments, the embodiments of the present application provide a computer program product containing instructions, which, when executed by a computing device cluster containing at least one computing device, enable the computing device cluster to perform the method in the above-mentioned embodiments.
[0117] It should be understood that each step of the above-mentioned method embodiments can be completed by a logic circuit in the form of hardware in a processor or by instructions in the form of software.
[0118] It can be understood that the processor in the embodiments of the present application can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor.
[0119] The method steps in the embodiments of the present application can be implemented in the form of hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), a flash memory, a read-only memory (ROM), a programmable read-only memory (PROM), an erasable PROM (EPROM), an electrically EPROM (EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor, so that the processor can read information from and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC.
[0120] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in or transmitted by a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0121] It can be understood that various numerical numbers involved in the embodiments of the present application are only distinguished for convenience of description, and are not used to limit the scope of the embodiments of the present application.
[0122] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the protection scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of code processing, characterized by, The method comprises: receiving a first command, the first command being used to indicate to mark runtime information on a first source code; obtaining runtime information of a first application, the first application being compiled based on the first source code; reading the first source code from a memory, and marking the obtained runtime information on the first source code to obtain a second source code; storing the second source code to the memory.
2. The method of claim 1, wherein, After the second source code is stored to the memory, the method further comprises: in response to a detected first operation, displaying the second source code, the first operation being used to view the second source code; in response to a detected second operation, updating the runtime information marked on the second source code to obtain a third source code, the second operation being used to modify the runtime information marked on the second source code; storing the third source code to the memory.
3. The method according to claim 1 or 2, characterized in that, The method further comprises: receiving a second command; reading a target code from the memory; compiling the target code based on the runtime information marked on the target code to obtain an application or a hot patch related to the target code.
4. The method of claim 3, wherein, The target code is the second source code, or a sub-code in the second source code.
5. The method according to any of claims 1 to 4, characterized in that, The runtime information comprises one or more of branch probability, memory access information and function heat.
6. A code processing apparatus, characterized by comprising: Comprise: a receiving module, configured to receive a first command, the first command being used to indicate to mark runtime information on a first source code; a processing module, configured to obtain runtime information of a first application, the first application being compiled based on the first source code; the processing module is further configured to read the first source code from a memory, and mark the obtained runtime information on the first source code to obtain a second source code; the processing module is further configured to store the second source code to the memory.
7. The apparatus of claim 6, wherein, Further comprise: a display module, configured to, after the processing module stores the second source code to the memory, in response to a detected first operation, display the second source code, the first operation being used to view the second source code; wherein the processing module is further configured to, in response to a detected second operation, update the runtime information marked on the second source code to obtain a third source code, the second operation being used to modify the runtime information marked on the second source code, and store the third source code to the memory.
8. The apparatus according to claim 6 or 7, characterized in that, the receiving module is further configured to receive a second command; the processing module is further configured to read the target code from the memory; the processing module is further configured to compile the target code based on the runtime information marked on the target code to obtain an application or a hot patch related to the target code.
9. The apparatus of claim 8, wherein, The target code is the second source code, or a sub-code in the second source code.
10. The apparatus of any of claims 6-9, wherein, The runtime information comprises one or more of branch probability, memory access information and function heat.
11. A code processing apparatus, characterized by comprising: Comprise at least one processor and an interface; The at least one processor obtains program instructions via the interface; The at least one processor executes the program instructions to implement the method of any one of claims 1-5.
12. A cluster of computing devices, characterized in that, comprise at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device executes instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method of any one of claims 1-5.
13. A computer-readable storage medium, characterized in that, comprise computer program instructions that, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the method of any one of claims 1-5, wherein the cluster of computing devices comprises at least one computing device.
14. A computer program product comprising instructions, characterized in that, comprise computer program instructions that, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the method of any one of claims 1-5, wherein the cluster of computing devices comprises at least one computing device.
Citation Information
Patent Citations
Application program compiling method and device, computer terminal, and data processing method
CN109542443A
Code compiling method and device, computer readable medium and electronic equipment
CN114416103A
Source code processing method and device, electronic equipment and storage medium
CN114756279A
Methods and apparatuses for selective code coverage
US20110047532A1
Optimized compilation using an auto-tuned compiler as a service
US20170123773A1
Cited By
A workflow generation method, system, device and computer readable storage medium
CN122390692A