WO2024169933A1 - Système et procédé d'optimisation d'espace vectoriel d'exception de programme, dispositif et support - Google Patents
Système et procédé d'optimisation d'espace vectoriel d'exception de programme, dispositif et support Download PDFInfo
- Publication number
- WO2024169933A1 WO2024169933A1 PCT/CN2024/076971 CN2024076971W WO2024169933A1 WO 2024169933 A1 WO2024169933 A1 WO 2024169933A1 CN 2024076971 W CN2024076971 W CN 2024076971W WO 2024169933 A1 WO2024169933 A1 WO 2024169933A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- program
- module
- code
- allocation
- space
- Prior art date
Links
- 239000013598 vector Substances 0.000 title claims abstract description 149
- 238000000034 method Methods 0.000 title claims abstract description 34
- 238000005457 optimization Methods 0.000 title claims abstract description 20
- 230000004048 modification Effects 0.000 claims abstract description 70
- 238000012986 modification Methods 0.000 claims abstract description 70
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 38
- 230000002159 abnormal effect Effects 0.000 claims description 24
- 230000004044 response Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 6
- 238000012790 confirmation Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 description 17
- 238000010586 diagram Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 9
- 230000006870 function Effects 0.000 description 6
- 239000011800 void material Substances 0.000 description 6
- 238000013507 mapping Methods 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 2
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 2
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000011156 evaluation Methods 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 230000010354 integration Effects 0.000 description 2
- 230000005012 migration Effects 0.000 description 2
- 238000013508 migration Methods 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012552 review Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/72—Code refactoring
Definitions
- the present application belongs to the field of computers, and specifically relates to a program exception vector space optimization system, system, device and non-volatile readable storage medium.
- the link address which is the address of the program when it is linked after compilation. This address generally corresponds to the address stored in the image file one by one; the other is called the running address, which is the address during the program running process. Most of the time, the addresses of the two are consistent, but this will lead to a problem: in order to ensure that the link address and the running address match one by one, the program image file will fill the empty space with 0, which will increase the image file size.
- compression technology in order to reduce the size of the program image file and achieve the purpose of accelerating the loading of the program, compression technology will be used, such as adding the at (absolute position variable identifier in the embedded field, which can set the memory address of the target variable in the C program, and the form of "variable name __at__" keyword to the link file, which indicates that the actual running address of the program is the parameter of the at keyword, and the code and data are arranged in sequence in the image file.
- the binary code or data is moved to the running address.
- the link address is inconsistent with the running address.
- the program loading time is reduced, the program running time is increased. Therefore, the loading time and running time of the program seem to be a pair of contradictions.
- the loading time increases; and when the running time is reduced, the loading time increases.
- the present application proposes a program exception vector space optimization system, including a code analysis module, a hole space allocation module, and a code modification module, wherein:
- the code analysis module is configured to analyze the output file after the program is compiled to determine the hole space in the exception vector space corresponding to the program and the target variable after the program is compiled;
- the hole space allocation module is configured to generate an allocation strategy for allocating target variables to the hole space in the exception vector space through a predetermined algorithm, and send the allocation strategy to the code modification module;
- the code modification module is configured to modify the target variables in the source code of the program based on the allocation strategy to generate a target code file.
- the code analysis module includes:
- the first text search module is configured to determine, in the output file after the program is compiled, a description part corresponding to the abnormal vector space and a target variable in the output file.
- the code analysis module further includes:
- the redundant code analysis module is configured to determine redundant data existing in the description part based on a preset abnormal vector space template.
- the code analysis module further includes:
- a hole space confirmation module is configured to analyze the redundant data of the description part determined by the first text search module and/or the description part determined by the redundant code analysis module, and determine the available hole space in the abnormal vector space corresponding to the description part.
- the code analysis module further includes:
- the sorting module is configured to sort the target variable based on the data size of the target variable.
- the hole space allocation module includes:
- the allocation strategy module is configured to generate an allocation strategy for allocating target variables to the hole space in the abnormal vector space through multiple allocation algorithms.
- the hole space allocation module further includes:
- the hole space management module is configured to save the allocation strategy generated by the allocation algorithm corresponding to the allocation strategy module, and restore the initial state of the hole space to the next allocation algorithm for allocation operation when the next allocation algorithm runs.
- the hole space allocation module further includes:
- the optimal solution output module is configured to obtain allocation strategies generated by multiple allocation algorithms from the void space management module, and determine the optimal solution of the allocation strategy in a predetermined manner based on the allocation strategies generated by the multiple allocation algorithms.
- the code modification module includes:
- the second text search module is configured to find the position of the variable related to the allocation strategy in the source code of the program according to the allocation strategy.
- the code modification module further includes:
- the exception vector modification module is configured to delete the code corresponding to the redundant data in the exception vector space analyzed by the code analysis module for the program in the program source code.
- the code modification module further includes:
- the data area variable modification module is configured to replace the variable of the target variable in the program source code with the corresponding pointer according to the allocation strategy, and point the pointer to the corresponding address in the exception vector space allocated in the allocation strategy.
- the data area variable modification module is further configured to:
- the variable corresponding to the target variable in the program source code is placed in the label representing the exception vector space by means of the label of the assembly code.
- the code modification module further includes:
- the intermediate result update module is configured to save the modifications made to the program source code by the data area variable modification module and the exception vector modification module.
- system further comprises:
- the exception vector template module is configured to provide the code analysis module with a corresponding exception vector space template according to the hardware architecture of the program.
- system further comprises:
- the merging module is configured to merge the user-permitted content in the target code file into the source code of the program according to the user's operation.
- the merging module is further configured to:
- the merging module is further configured to:
- the merged source code of the program is compiled into an executable file.
- Another aspect of the present application provides a method for optimizing a program exception vector space, comprising:
- An allocation strategy for allocating target variables to a hole space in anomaly vector space is generated by a predetermined algorithm
- the target variables in the source code of the program are modified based on the allocation strategy to generate a target code file.
- Another aspect of the present application also provides a computer device, comprising:
- the memory stores computer instructions executable on the processor, and when the instructions are executed by the processor, the steps of any one of the methods in the above-mentioned implementation manner are implemented.
- Another aspect of the present application further provides a computer non-volatile readable storage medium, which stores a computer program.
- a computer program When the computer program is executed by a processor, the steps of any one of the methods in the above-mentioned embodiments are implemented.
- the program data is stored in the exception vector space, thereby reducing the size of the program image file, which can effectively reduce the storage space occupied by the program image file.
- the program loading time will also be shortened; at the same time, the present application avoids the problem of inconsistency between the link address and the running address caused by the use of the at keyword technology in the link script.
- FIG1 is a schematic diagram of the structure of a program exception vector space optimization system provided by an embodiment of the present application.
- FIG2 is a schematic diagram of a flow chart of a method for optimizing a program exception vector space provided in an embodiment of the present application
- FIG3 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application.
- FIG4 is a schematic diagram of the structure of a computer non-volatile readable storage medium provided in an embodiment of the present application.
- FIG5 is a schematic diagram of the structure of a code analysis module provided in an embodiment of the present application.
- FIG6 is a schematic diagram of the structure of a void space allocation module provided in an embodiment of the present application.
- FIG7 is a schematic diagram of the structure of a code modification module provided in an embodiment of the present application.
- FIG8 is a schematic diagram of the structure of a program exception vector space optimization system provided by an embodiment of the present application.
- FIG9 is a schematic diagram of data distribution in an exception vector space corresponding to an exception processing in an exception vector space based on the ARMv8 architecture provided in an embodiment of the present application.
- This application aims to solve the problem of device storage space waste in the process of handling exceptions when an exception occurs during program operation under the traditional program compilation method, especially in some terminal IOT (Internet of Things) devices, such as wearable devices such as bracelets, home electrical appliances and other networked devices. Since these devices themselves are designed with business and cost factors in mind, low-power, low-performance chip platforms are generally selected as the hardware basis, which leads to the limited computing speed and storage space capacity of these devices themselves. However, in terms of application, it is hoped that the technical effects of fast startup or fast response can be achieved on these platforms. Therefore, how to achieve fast startup and response on low configuration has become an urgent problem to be solved.
- IOT Internet of Things
- the present application proposes a program exception vector space optimization system, including a code analysis module 1, a hole space allocation module 2, and a code modification module 3, wherein:
- the code analysis module 1 is configured to analyze the output file after the program is compiled to determine the hole space in the abnormal vector space corresponding to the program and the target variable 2 after the program is compiled;
- the hole space allocation module 2 is configured to generate an allocation strategy for allocating the target variable to the hole space in the abnormal vector space through a predetermined algorithm, and send the allocation strategy to the code modification module 3;
- the code modification module 3 is configured to modify the target variables in the source code of the program based on the allocation strategy to generate a target code file.
- a general program image file is divided into a code segment and a data segment; the data segment is further divided into an all-0 data segment and a non-zero data segment; the optimization of the code segment is extremely complex and is not considered in this patent; the all-0 data segment, that is, the bss segment (Block Started by Symbol, a memory segment used to store uninitialized global variables and static variables), actually only stores the starting position and size of the data segment, so there is no room for optimization; and the non-zero data segment, that is, the data segment (data segment), is often stored independently of the code. This arrangement often causes a gap between the data segment and the code segment.
- the compiler will generate a program image file here. In some empty spaces, 0-filling operations are performed; in addition, since some code segments also have alignment operations, they will also be sampled and filled with 0, which will increase the program image file. Considering that there are some segments in the program image file that have fixed positions and low utilization rates, this application is to fill the empty spaces that are filled with 0 with more meaningful data, which can not only reduce the loading time of the program image, but also reduce the running time of the program. The most representative segment among them is the data segment where the exception vector space is located. The exception vector space refers to the data space when exception handling is performed when the program is abnormal.
- Figure 9 shows the data space distribution corresponding to the exception vector space distribution of the ARMv8 processor.
- the space represented by the 128 bytes of 0x080 ⁇ 0x180 in the figure is the interrupt space for executing IRQ (Interrupt Request)/vIRQ (Vector Interrupt) under Current El with SP0.
- this 128-byte data space mainly stores the register data of the exception handling operation (the specific content varies depending on the logic of the program, more or less), and the exception handling vector mainly operates in the following steps:
- the vector space will save the data needed in the above process to the space represented by 128 bytes of 0x080 ⁇ 0x180 according to the binary data instructions after the program is compiled (assuming that the exception processing is an IRQ interrupt).
- the program cannot fully utilize the exception vector space after compilation. Therefore, the compiler will fill the unused data with 0 as a placeholder during compilation.
- the exception vector space of a program is the way to handle exceptions after the program source code is compiled into an executable program, that is, the exception handling scheme of the program is implemented after the program is compiled. This is a mechanism designed by the program and hardware to maintain the stable operation of the program. Even if a program that only prints "hello world" is written in any language, there will be a mechanism to handle exceptions in the program after it is compiled, and there will be a corresponding exception vector space. The same program may have different exception vector spaces after compilation due to different hardware platforms (processor architectures).
- the output files include: a symbol table, a disassembly file, an address mapping table file, and an executable program file.
- the code analysis module 1 analyzes the output file and finds the exception vector space corresponding to the program in the executable program and the target variable that can be stored in the exception vector space according to the compiler tool used and the hardware platform.
- the part of the exception vector space filled with 0 by the compiler is determined according to the content recorded in the exception vector space, and the part filled with 0 is regarded as a hole space and sent to the hole space allocation module 2 together with the target variable.
- the hole space allocation module 2 generates an allocation strategy for adding the target variable to the hole space through a variety of allocation algorithms, and sends the allocation strategy to the code modification module 3.
- the code modification module 3 modifies the scope of some variables corresponding to the target variables in the source code of the program according to the allocation strategy to add these variables to the exception vector space. For example, these variables are originally stored in the memory after the program is run, and are changed to the register corresponding to the exception vector space. This generates the optimized target code for the program and saves it as a target code file.
- the code analysis module 1 includes:
- the first text search module 11 is configured to determine, in the output file after the program is compiled, a description part corresponding to the abnormal vector space and a target variable in the output file.
- the code analysis module includes a first text search module 11, which mainly searches for the content in the output file after the program is compiled, and parses the content in the compiled output file according to the compilation tool and hardware platform used by the program, and finds the description part of the exception vector space corresponding to the exception handling of the program in the output file. Based on the description part, the exception vector space of the program is determined, and all variable information of the program is obtained through the disassembly file and the address mapping table file, and the corresponding global variables and variables that will not change during the program operation are determined as target variables.
- a first text search module 11 which mainly searches for the content in the output file after the program is compiled, and parses the content in the compiled output file according to the compilation tool and hardware platform used by the program, and finds the description part of the exception vector space corresponding to the exception handling of the program in the output file. Based on the description part, the exception vector space of the program is determined, and all variable information of the program is obtained through the disassembly file and the address mapping
- the code analysis module 1 further includes:
- the redundant code analysis module 12 is configured to determine redundant data existing in the description part based on a preset abnormal vector space template.
- the code analysis module 1 also includes a redundant code analysis module 12, which is based on determining the exception vector space and comparing the exception vector space of the program according to a pre-set or selected exception vector space template, to determine the data that is redundant in the exception vector space compared to the exception vector space module, and to use the redundant data in the exception vector space as redundant data.
- a redundant code analysis module 12 which is based on determining the exception vector space and comparing the exception vector space of the program according to a pre-set or selected exception vector space template, to determine the data that is redundant in the exception vector space compared to the exception vector space module, and to use the redundant data in the exception vector space as redundant data.
- the content in the exception vector space template only includes the address of the exception handling process and the address of the process executed before the exception is returned, and the sizes of the two data addresses are 64 bits, i.e., 8 bytes.
- the other data is redundant data with respect to the selected vector space template and needs to be marked.
- the code analysis module 1 further includes:
- the hole space confirmation module 13 is configured to analyze the redundant data of the description part determined by the first text search module 11 and/or the description part determined by the redundant code analysis module 12, and determine the available hole space in the abnormal vector space corresponding to the description part.
- the code analysis module 1 also includes a hole space confirmation module 13, which analyzes the zero-filled part and redundant data in the exception vector space included in the description part, determines the corresponding data address range and uses the corresponding address range as the hole space available in the program exception vector space.
- the code analysis module 1 further includes:
- the sorting module 14 is configured to sort the target variables based on the data size of the target variables.
- the sorting module in the code analysis module 1 sorts the target variables according to the data size of the variables, and sends the sorted target variables to the hole space allocation module.
- the hole space allocation module 2 includes:
- the allocation strategy module 21 is configured to generate an allocation strategy for allocating the target variable to the hole space in the abnormal vector space through a plurality of allocation algorithms.
- the allocation strategy module 21 allocates the target variable to the hole space according to the hole space and the target variable sent by the code analysis module through dynamic programming, greedy algorithm, backpack algorithm and other algorithms, that is, fills the hole space according to the data size of the target variable.
- the hole space allocation module 2 further includes:
- the hole space management module 22 is configured to save the allocation strategy generated by the allocation algorithm corresponding to the allocation strategy module, and restore the initial state of the hole space to the next allocation algorithm for allocation operation when the next allocation algorithm runs.
- the hole space allocation module 2 is further provided with a hole space management module 22.
- the hole space management module 22 provides vector space initialization work for each algorithm in the allocation strategy module 21, and saves the allocation strategy given by each algorithm.
- the hole space allocation module 2 further includes:
- the optimal solution output module 23 is configured to obtain allocation strategies generated by multiple allocation algorithms from the void space management module, and determine the optimal solution of the allocation strategy in a predetermined manner based on the allocation strategies generated by the multiple allocation algorithms.
- the optimal solution output module 23 obtains the allocation strategies given by each allocation algorithm and the remaining unallocated target variables from the void space management module 22, and evaluates the remaining unallocated target variables and the number of target variables allocated to the abnormal vector space and the data size of the target variables allocated to the abnormal vector space to obtain the optimal solution.
- the corresponding evaluation tendency is selected according to the characteristics of the hardware platform on which the program runs and the scheduling mechanism when the program is running. For example, if the storage space of the hardware platform is small and data access is frequent, the target variables with larger data volume are preferentially allocated to the allocation strategy.
- the data size of the remaining unallocated target variables is used as the main judgment basis.
- the allocation scheme of the algorithm with the smaller data size of the remaining target variables is the optimal solution.
- the number of times the target variable is used in the program is used as an evaluation basis for whether the target variable is allocated to the exception vector space. If the target variable is frequently called in the program, the smaller the number of unallocated target variables is, the better the allocation scheme of the algorithm with the smaller number of remaining target variables is, and it is considered to be the optimal solution.
- the code modification module 3 includes:
- the second text search module 31 is configured to find the location of the variable related to the allocation strategy in the source code of the program according to the allocation strategy.
- a second text search module 31 is provided in the code modification module 3.
- the second text search module 31 finds the position of the corresponding target variable allocated to the exception vector space in the source code of the program according to the optimal allocation scheme given in the hole space allocation module 2.
- the code modification module 3 further includes:
- the exception vector modification module 32 is configured to delete the code corresponding to the redundant data in the exception vector space analyzed by the code analysis module 1 on the program in the program source code.
- the exception vector modification module 32 selects the optimal allocation scheme from the code analysis module The corresponding codes of the redundant data of the abnormal vector space given in 1 in the program source code are clear.
- the code modification module 3 further includes:
- the data area variable modification module 33 is configured to replace the variable of the target variable in the program source code with a corresponding pointer according to the allocation strategy, and point the pointer to the corresponding address in the exception vector space allocated in the allocation strategy.
- the data area variable modification module 33 replaces the variable at the corresponding position in the program source code in the form of a pointer according to the position of the target variable determined by the second text search module 31, and points the pointer to the address of the corresponding exception vector space in the allocation strategy, so as to add the target variable to the empty space of the exception vector space after compilation.
- the data area variable modification module 33 is further configured to:
- the variable corresponding to the target variable in the program source code is placed in the label representing the exception vector space by means of the label of the assembly code.
- attribute tags are added to the corresponding variables in the program source code, and the attribute tags are added to the corresponding exception vector space.
- the corresponding target variable is added to the connection file corresponding to "section name” through “attribute((section("section name”))” in C language.
- the code modification module 3 further includes:
- the intermediate result updating module 34 is configured to save the modifications made to the program source code by the data area variable modification module and the exception vector modification module.
- the code modification module 3 is also provided with an intermediate result update module for storing the source code modification result.
- the target code modified by the code modification module 3 because the target code modified by the code modification module 3 is established in a branching manner, it needs to be merged into the original branch after modification, and the user needs to confirm whether to agree to the modification during the merging. Therefore, it is necessary to save the target code file modified by the code modification module 3 each time as an intermediate result.
- system further comprises:
- the exception vector template module 4 is configured to provide the code analysis module with a corresponding exception vector space template according to the hardware architecture of the program.
- the exception vector template module records the most simplified exception vector space under each architecture, such as the most common ARM architecture, RISCV (Reduced Instruction Set Computer-V) architecture and MIPS (Microprocessor without Interlocked Pipeline Stages) architecture, etc., and is called by the code modification module.
- the corresponding exception vector space template is provided for the code analysis module.
- system further comprises:
- the merging module 5 is configured to merge the user-permitted content in the target code file into the source code of the program according to the user's operation.
- the merging module 5 is used to generate the target code modified by the code modification module 3. Provide it to programmers for review, and users confirm which modifications can be merged into the main branch and which modifications cannot be merged into the main branch.
- the integration module 5 is further configured to:
- the merging module 5 determines whether the modified target code in the merged code is fully agreed to be merged into the main branch by the user according to the merging scheme confirmed by the user (programmer). If not fully agreed, it means that there will still be empty space in the exception vector space. Therefore, it is necessary to go through another round of analysis, allocation, and modification.
- the merging module sends the source code of the program confirmed by the user to the compiling module 6, and sets corresponding parameters to output various types of output files (disassembly files, address mapping table files, etc.).
- the code analysis module 1 performs analysis and starts the next round of optimization.
- the merging module is further configured to:
- the merged source code of the program is compiled into an executable file.
- the merging module will send the source code confirmed by the user directly to the compilation module 6 to compile the executable file of the program.
- This embodiment takes the exception vector space of the ARMv8 architecture as an example to implement the program exception vector space optimization system proposed in this application.
- each EL Embedded Language
- IRQ Interrupt Request
- FIQ Fast Interrupt Request
- SError Software Error
- Synchronous Depending on whether an EL-level migration will occur when an exception is triggered and whether the AArch64 or AArch32 (ARM Architecture 32-bit) instruction set is used when the migration is generated, there are four different areas.
- each entry in ARMv8 is 0x80 bytes, so more code can be placed in the vector table.
- the classification of the entire 16 entries and the offset relationship in the vector table are shown in Figure 9.
- the entire exception vector space is 0x800 bytes in size, or 2048 bytes; there are three such vector tables in the AArch64 architecture, so the total exception vector space is 6144 bytes, or 6KB in size.
- the structure diagram of the program exception vector space optimization system implemented in this embodiment is shown in Figure 8, including a code analysis module 1, a hole space allocation module 2 and a code modification module 3.
- Compilation module 5 The main function of this module is to select the appropriate tool chain according to the hardware architecture, call the compilation tool chain to complete the code compilation, and generate the files required for subsequent modules, such as: symbol table, disassembly file, address mapping table, etc.
- Code analysis module 1 Analyze whether there is redundant code in the exception vector space according to the generated executable file and the disassembled code.
- the main operations of the exception handling vector are as follows:
- Step 1 Push the necessary registers onto the stack, often referred to as saving the scene;
- Step 2 Jump to the exception handling process
- Step 3 Restore the registers saved in the stack, which is often called restoring the scene;
- Step 4 Return to the execution before the exception.
- the processing flow of the exception vector does not actually require special parameter passing, such as the interrupt processing flow: that is, in the ARMv8 architecture, the CPU obtains the interrupt number by operating the GIC (Generic Interrupt Controller), finds the corresponding interrupt processing function and then executes it. Therefore, in the above process, in step 2, when jumping from assembly to C language, theoretically only the registers to be used need to be saved; similarly, for exceptions, the CPU also decides how to handle the exception by reading the exception registers.
- GIC Generic Interrupt Controller
- the code analysis module 1 analyzes the exception vectors to reduce unnecessary operations in the exception handling vectors as much as possible. After the analysis is completed, the analysis results are recorded in the intermediate process file; at the same time, the actual size of each exception handling vector needs to be recorded.
- the code analysis module 1 also needs to use the address mapping table file generated by the compilation module 6 to analyze the space occupied by each variable stored in the data segment, sort this information and output it so that subsequent allocation activities can be carried out reasonably.
- code analysis module 1 the main functions of code analysis module 1 are as follows:
- the hole space allocation module 2 allocates the content of the data area to the interrupt vector table space according to the output of the code analysis module 1 according to a preset algorithm such as dynamic programming or greedy algorithm, and records the information, and is configured to update the output of the code analysis module, that is, the intermediate result output by the hole space management module, and outputs the optimal solution of this round after completion.
- the code modification module is called to modify the variable attributes to complete the work of allocating the data area variables to the exception vector space.
- the code modification module 3 first deletes the redundant code in the exception vector space according to the output of the code analysis module 1, and then performs further analysis according to the exception vector space pre-set in the exception vector template to determine whether the exception vector space in the exception vector template can be used for replacement, and modifies the processing function in the template to the processing function actually called in the program.
- the code modification module 3 also needs to modify the properties of the code corresponding to the variables stored in the data area according to the output of the void space allocation module 2, and complete the operation of actually allocating the content of the data area to the exception vector space; it can also add a label in the assembly code, put the initial value of the corresponding variable into the space following the label, and set the label to the global type (global variable or global object), indicating that the label is a global variable, so that the global variable can be used in the C code, which can also complete the operation of allocating the variables in the data area to the exception vector space.
- the compilation module is called again for compilation, and the subsequent process is started.
- the merging module 5 presents the content modified by the code modification module, and prompts the user according to the modified content which modifications may have risks, and finally the user decides whether to merge the modifications into the main branch of the code. After the merging is completed, run this process again to view the results. For the content of the data area that ultimately fails to be allocated to the exception vector space, this module gives a prompt to inform the user of the reason for the failure to merge, as well as feasible suggestions.
- the exception vector template 4 records the most concise exception vector space under each architecture, such as the most common ARM architecture, RISCV architecture and MIPS architecture, etc., and is called by the code modification module.
- the program data is stored in the exception vector space, thereby reducing the size of the program image file, which can effectively reduce the storage space occupied by the program image file.
- the program loading time will also be shortened; at the same time, the present application avoids the problem of inconsistency between the link address and the running address caused by the use of the at keyword technology in the link script.
- FIG. 2 another aspect of the present application proposes a program exception vector space optimization method, including:
- Step S1 analyzing the output file after program compilation to determine the hole space in the abnormal vector space corresponding to the program and the target variable after program compilation;
- Step S2 generating an allocation strategy for allocating the target variable to the hole space in the abnormal vector space through a predetermined algorithm
- Step S3 modify the target variable in the source code of the program based on the allocation strategy to generate a target code file.
- FIG. 3 another aspect of the present application further provides a computer device, comprising:
- the memory 22 stores computer instructions 23 that can be executed on the processor 21.
- the instructions 23 are executed by the processor 21, the steps of any one of the methods in the above-mentioned implementation manner are implemented.
- FIG. 4 another aspect of the present application further provides a computer non-volatile readable storage medium 401, a computer non-volatile readable storage medium 401 stores a computer program 402, and when the computer program 402 is executed by a processor, the steps of any one of the methods in the above-mentioned implementation manners are implemented.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
La présente invention concerne le domaine des ordinateurs, et en particulier, un système et un procédé d'optimisation d'espace vectoriel d'exception de programme, un dispositif et un support de stockage lisible non volatil. Le système comprend : un module d'analyse de code qui analyse un fichier de sortie obtenu après qu'un programme est compilé pour déterminer un espace de trou dans un espace vectoriel d'exception correspondant au programme et une variable cible après que le programme est compilé ; un module d'attribution d'espace de trou qui génère, à l'aide d'un algorithme prédéterminé, une stratégie d'attribution pour attribuer la variable cible à l'espace de trou dans l'espace vectoriel d'exception, et envoie la stratégie d'attribution à un module de modification de code ; et le module de modification de code qui modifie la variable cible dans un code source du programme sur la base de la stratégie d'attribution pour générer un fichier de code cible. Selon le système d'optimisation d'espace vectoriel d'exception de programme selon la présente invention, l'espace vectoriel d'exception est utilisé pour stocker des données de programme pour réduire la taille d'un fichier d'image de programme, de telle sorte que l'espace de stockage occupé par le fichier d'image de programme peut être efficacement réduit.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310128388.2 | 2023-02-17 | ||
CN202310128388.2A CN115826946B (zh) | 2023-02-17 | 2023-02-17 | 一种程序异常向量空间优化系统、方法、设备及介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024169933A1 true WO2024169933A1 (fr) | 2024-08-22 |
Family
ID=85521738
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2024/076971 WO2024169933A1 (fr) | 2023-02-17 | 2024-02-08 | Système et procédé d'optimisation d'espace vectoriel d'exception de programme, dispositif et support |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115826946B (fr) |
WO (1) | WO2024169933A1 (fr) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115826946B (zh) * | 2023-02-17 | 2023-05-12 | 苏州浪潮智能科技有限公司 | 一种程序异常向量空间优化系统、方法、设备及介质 |
CN118363644A (zh) * | 2024-06-19 | 2024-07-19 | 华能信息技术有限公司 | 一种基于字节增强技术的微服务纳管方法及系统 |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050010722A1 (en) * | 2003-07-11 | 2005-01-13 | Chih-Wei Chen | Multi-volume disk array management method and system |
CN102419734A (zh) * | 2010-09-27 | 2012-04-18 | 北京中星微电子有限公司 | 一种数据存储的方法及装置 |
CN106126360A (zh) * | 2016-06-28 | 2016-11-16 | 青岛海信电器股份有限公司 | 地址空洞屏蔽方法及装置 |
CN107085548A (zh) * | 2016-02-16 | 2017-08-22 | 阿里巴巴集团控股有限公司 | 一种监控应用程序内存的方法、装置及电子设备 |
CN109271206A (zh) * | 2018-08-24 | 2019-01-25 | 晶晨半导体(上海)股份有限公司 | 一种异常现场的内存压缩和保存方法 |
CN111309329A (zh) * | 2020-01-19 | 2020-06-19 | 苏州浪潮智能科技有限公司 | 一种指令地址自适应重定位方法及程序编译方法 |
CN111475168A (zh) * | 2020-04-14 | 2020-07-31 | 中国人民解放军战略支援部队信息工程大学 | 一种代码编译方法及装置 |
CN114416481A (zh) * | 2022-01-13 | 2022-04-29 | 广联达科技股份有限公司 | 日志分析方法、装置、设备及存储介质 |
WO2022237610A1 (fr) * | 2021-05-10 | 2022-11-17 | 阿里巴巴(中国)有限公司 | Procédé de compilation de programme et procédé de chargement de programme |
CN115826946A (zh) * | 2023-02-17 | 2023-03-21 | 苏州浪潮智能科技有限公司 | 一种程序异常向量空间优化系统、方法、设备及介质 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102043659A (zh) * | 2010-12-08 | 2011-05-04 | 上海交通大学 | 消除内存访问冲突的编译装置及其实现方法 |
CN104267999B (zh) * | 2014-09-26 | 2018-09-18 | 浙江中控技术股份有限公司 | 一种对控制程序进行编译的方法和装置 |
CN110168548B (zh) * | 2017-01-05 | 2023-05-26 | 皇家飞利浦有限公司 | 编译设备和方法 |
CN109918903B (zh) * | 2019-03-06 | 2022-06-21 | 西安电子科技大学 | 一种基于llvm编译器的程序非控制数据攻击防护方法 |
CN113220236B (zh) * | 2021-05-17 | 2024-01-30 | 北京青云科技股份有限公司 | 一种数据管理方法、系统及设备 |
-
2023
- 2023-02-17 CN CN202310128388.2A patent/CN115826946B/zh active Active
-
2024
- 2024-02-08 WO PCT/CN2024/076971 patent/WO2024169933A1/fr unknown
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050010722A1 (en) * | 2003-07-11 | 2005-01-13 | Chih-Wei Chen | Multi-volume disk array management method and system |
CN102419734A (zh) * | 2010-09-27 | 2012-04-18 | 北京中星微电子有限公司 | 一种数据存储的方法及装置 |
CN107085548A (zh) * | 2016-02-16 | 2017-08-22 | 阿里巴巴集团控股有限公司 | 一种监控应用程序内存的方法、装置及电子设备 |
CN106126360A (zh) * | 2016-06-28 | 2016-11-16 | 青岛海信电器股份有限公司 | 地址空洞屏蔽方法及装置 |
CN109271206A (zh) * | 2018-08-24 | 2019-01-25 | 晶晨半导体(上海)股份有限公司 | 一种异常现场的内存压缩和保存方法 |
CN111309329A (zh) * | 2020-01-19 | 2020-06-19 | 苏州浪潮智能科技有限公司 | 一种指令地址自适应重定位方法及程序编译方法 |
CN111475168A (zh) * | 2020-04-14 | 2020-07-31 | 中国人民解放军战略支援部队信息工程大学 | 一种代码编译方法及装置 |
WO2022237610A1 (fr) * | 2021-05-10 | 2022-11-17 | 阿里巴巴(中国)有限公司 | Procédé de compilation de programme et procédé de chargement de programme |
CN114416481A (zh) * | 2022-01-13 | 2022-04-29 | 广联达科技股份有限公司 | 日志分析方法、装置、设备及存储介质 |
CN115826946A (zh) * | 2023-02-17 | 2023-03-21 | 苏州浪潮智能科技有限公司 | 一种程序异常向量空间优化系统、方法、设备及介质 |
Also Published As
Publication number | Publication date |
---|---|
CN115826946A (zh) | 2023-03-21 |
CN115826946B (zh) | 2023-05-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2024169933A1 (fr) | Système et procédé d'optimisation d'espace vectoriel d'exception de programme, dispositif et support | |
US7103881B2 (en) | Virtual machine to provide compiled code to processing elements embodied on a processor device | |
CN103069385B (zh) | 用于动态加载基于图的计算的系统和方法 | |
US8832672B2 (en) | Ensuring register availability for dynamic binary optimization | |
US7992141B2 (en) | Method and apparatus for building executable computer programs using compiled program libraries | |
US9495136B2 (en) | Using aliasing information for dynamic binary optimization | |
JP3299611B2 (ja) | 資源割付装置 | |
US8549502B2 (en) | Compiler with user-defined type inference rules | |
US5842021A (en) | Optimizer | |
US7100154B2 (en) | Dynamic compiler apparatus and method that stores and uses persistent execution statistics | |
CN111078279A (zh) | 字节码文件的处理方法、装置、设备及存储介质 | |
Aslam et al. | Optimized java binary and virtual machine for tiny motes | |
CN105447285A (zh) | 一种提高OpenCL硬件执行效率的方法 | |
CN116775127A (zh) | 一种基于RetroWrite框架的静态符号执行插桩方法 | |
US11886839B2 (en) | Non-transitory computer-readable recording medium, function generation method, and information processing device | |
US20020073133A1 (en) | Register allocation method and software development method for various execution environments and LSI for executing developed software | |
CN113721899A (zh) | 面向gpdsp的轻量级高效汇编代码编程方法及系统 | |
CN109857380B (zh) | 一种工作流文件编译方法及装置 | |
EP4204960A1 (fr) | Structure de retour à filetage local pour machine à états asynchrones | |
JP4125056B2 (ja) | ログ取得方法 | |
JP3767666B2 (ja) | ワークフロー管理システム | |
CN114866451B (zh) | iOS端路由通信改进方法、装置、存储介质和设备 | |
CN113535142A (zh) | 自动生成Bean拷贝代码的方法及装置 | |
CN117193780A (zh) | 基于arm架构云平台的基因数据处理方法及系统 | |
JP2001202252A (ja) | プログラム処理方法および記録媒体 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24756305 Country of ref document: EP Kind code of ref document: A1 |