CN114115990A - Program migration method, system and storage medium for dynamic and static combined binary translation - Google Patents

Program migration method, system and storage medium for dynamic and static combined binary translation Download PDF

Info

Publication number
CN114115990A
CN114115990A CN202111458787.2A CN202111458787A CN114115990A CN 114115990 A CN114115990 A CN 114115990A CN 202111458787 A CN202111458787 A CN 202111458787A CN 114115990 A CN114115990 A CN 114115990A
Authority
CN
China
Prior art keywords
program
dynamic
code
static
migrated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111458787.2A
Other languages
Chinese (zh)
Inventor
张义磊
张雪玉
黄波
郭健美
周烜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
East China Normal University
Original Assignee
East China Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by East China Normal University filed Critical East China Normal University
Priority to CN202111458787.2A priority Critical patent/CN114115990A/en
Publication of CN114115990A publication Critical patent/CN114115990A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention relates to a program migration method, a system and a storage medium for dynamic and static combined binary translation. The method comprises the following steps: pre-compiling the program to be migrated by adopting a static binary translator and generating an intermediate result file; establishing a mapping relation between the intermediate result file and the program to be migrated; and executing the program to be migrated, and calling a dynamic binary translator when the program to be migrated does not use the platform code, wherein the dynamic binary translator loads an intermediate result file corresponding to the program to be migrated based on the mapping relation to execute. The invention completes the high-efficiency series connection between the dynamic binary translator and the static binary translator, and ensures the feasibility of program translation and the diversity of platforms.

Description

Program migration method, system and storage medium for dynamic and static combined binary translation
Technical Field
The invention relates to the technical field of software migration, in particular to a program migration method, a program migration system and a storage medium for dynamic and static combined binary translation.
Background
The processor technology is the core technology of the information industry, and the design quality of the processor plays a decisive role in the efficiency and the energy consumption of the computer. Processor design also takes into account the variety of application scenarios. Various large chip vendors have had various understandings on how to design processors that fit different application scenarios, and have proposed different Instruction Set Architectures (ISAs) and corresponding products. In the personal computer field, there are intel based on the core series processor of X86 architecture, Apple based on the M1 series processor of Arm architecture, Chinese academy computing based on the Loongson series processor of MIPS architecture, etc.; in the server field, there are a spread-family processor based on the Arm architecture, an intel-family processor based on the X86 architecture, and so on; in the embedded field, there are kylin series processors based on Arm architecture, and ferruginous series processors based on RISC-V architecture. Because of different instruction set architectures, software on one instruction set architecture platform cannot be directly run on another instruction set architecture platform, and different versions of the same instruction set architecture cannot be compatible sometimes. In order to solve the compatibility problem of the program at the software level and reduce the burden on the hardware design, binary translation (binary translation) has been developed.
The binary translation technology can translate a program on one instruction set architecture platform to another instruction set architecture platform to be executed under the condition of no source code, and migration of the program is realized. The technology is an important means for solving the problem of software compatibility after the same instruction set architecture platform is upgraded and the problem of program migration among different instruction set architectures. Binary translation techniques can be divided into static binary translation (static binary translation) and dynamic binary translation (dynamic binary translation). Static binary translation is an off-line compilation technology, can pre-compile a program to be migrated, does not occupy running time, and performs deep optimization, but needs to solve the problems of code discovery, code positioning, code and data mixing, self-modification of codes and the like. The dynamic binary translation is a real-time compiling technology, and can solve the problems of code discovery, code positioning, code and data mixing, self-modification of codes and the like which are difficult to solve by static binary translation by starting a runtime environment and simultaneously translating and operating, but only can implement optimization with lower expenditure due to the fact that the runtime is occupied for translation. The dynamic binary translator can acquire the dynamic behavior of the translated program during running, and some optimizations which cannot be done in static binary translation can also be performed in the dynamic binary translation process.
Dynamic binary translation and static binary translation have advantages and disadvantages, and in order to fully utilize the advantages of the dynamic binary translation and the static binary translation, a dynamic and static combined binary translation technology can be used. The dynamic and static combined binary translation technology is used for processing the difficult problems which are difficult to solve in static binary translation, such as code discovery, code positioning, code and data mixing, self-modification of codes and the like, on the basis of off-line compiling of the static binary translation, and realizes efficient translation of a program by combining the runtime environment of the dynamic binary translation.
The conventional patent document CN1716202A discloses a processing method for incomplete static information in dynamic and static combined binary translation, but the method is deficient in feasibility and platform diversity, and is specifically represented as follows: (1) aiming at memory data which can be accessed by both static binary translated codes and codes needing dynamic binary translation, the memory data lack a mechanism which can ensure the consistency of memory access addresses after translation; (2) the method comprises the steps of processing the address mapping relation between a source platform code translated by a static binary system and a translated target platform code by using a static code entry information table and dynamic contour information, wherein the method needs to dynamically translate a target program firstly, collect jump addresses which cannot be speculated by static translation in the dynamic translation process, and statically translate the target program again according to the collected addresses, so that the method causes the overhead of first-pass operation, and static precompilation and dynamic translation can be performed on different platforms in the current cloud service scene, and the interaction realization difficulty of the method is high; (3) how to solve the problem of mixing of source platform codes and data is not proposed, so that the platform diversity of the patent is deficient.
Disclosure of Invention
The invention aims to provide a program migration method, a system and a storage medium for dynamic and static combined binary translation, which ensure the feasibility of program translation and the diversity of platforms.
The technical scheme adopted by the invention for solving the technical problems is as follows: the program migration method for dynamic and static combined binary translation comprises the following steps:
(1) pre-compiling the program to be migrated by adopting a static binary translator and generating an intermediate result file; the intermediate result file comprises a first code block and a second code block, the first code block is a code block which can be translated by the static binary translator, the second code block is a code block which cannot be translated by the static binary translator, and a mark is arranged at a connecting point of the first code block and the second code block;
(2) establishing a mapping relation between the intermediate result file and the program to be migrated;
(3) executing the program to be migrated, when the program to be migrated does not use the platform code, calling a dynamic binary translator, loading an intermediate result file corresponding to the program to be migrated based on the mapping relation by the dynamic binary translator for execution, directly executing the first code block by adopting an execution engine according to the identifier during execution, and executing the second code block by using a translation engine after the translation of the translation engine.
The static binary translator can identify and mark code blocks that cannot be translated for processing by the dynamic binary translator; the reasons for the inability to translate statically are caused by code discovery problems, code location problems, code and data mixing problems, or self-modifying code problems.
The step (1) of performing pre-compilation on the program to be migrated by adopting the static binary translator specifically comprises the following steps: and the static binary translator reads the program to be migrated, disassembles the program to be migrated by taking a basic block as a unit, decodes the program to be migrated into an assembly code of a source platform, analyzes the decoded assembly code to generate a control flow graph, and promotes the assembly code of the source platform into an intermediate representation.
The program migration method for dynamic and static combined binary translation further comprises the step of optimizing the intermediate representation, and specifically comprises the following steps: and the static binary translator performs various types of optimization based on the intermediate representation and performs target platform-related optimization when target codes are generated.
And (2) the static binary translator in the step (1) pre-compiles the program to be migrated in an off-line stage.
The intermediate result file also comprises a first address mapping relation and a second address mapping relation, wherein the first address mapping relation is the address mapping relation between a source platform instruction and a translated target platform instruction, and the second address mapping relation is the address mapping relation between the source platform and the target platform of memory data accessed by a program; and (3) the dynamic binary translator utilizes the first address mapping relation and the second address mapping relation to ensure consistency of access to memory data in the dynamic binary translation process and access to the same memory address in the static binary translation.
The intermediate result file also comprises description information, and the description information is used for describing which code blocks in the program to be migrated are the code blocks translated by the static binary translator and which code blocks are the code blocks not translated by the static binary translator.
The dynamic binary translator in the step (3) further comprises a dynamic optimization step in the execution process, and the dynamic optimization step specifically comprises the following steps: the dynamic binary translator links code blocks in a code cache region, and presets a code cache region replacement algorithm to ensure efficient utilization of the code cache region.
And (3) dynamically optimizing the code by the dynamic binary translator by collecting dynamic images of program behaviors during execution.
The technical scheme adopted by the invention for solving the technical problems is as follows: the program migration system for dynamic and static combined binary translation is characterized in that the program migration method for dynamic and static combined binary translation is realized when the processor executes the program.
The technical scheme adopted by the invention for solving the technical problems is as follows: there is also provided a computer-readable storage medium having stored thereon a computer program which is executed by a processor to implement the program migration method of dynamic and static combined binary translation described above.
Advantageous effects
Due to the adoption of the technical scheme, compared with the prior art, the invention has the following advantages and positive effects:
according to the method, the program to be migrated is precompiled by adopting static binary translation, an intermediate result file is generated, the result and related information of the static binary translator are stored, and are stored in a specified directory of a target platform according to corresponding specifications, and the mapping relation with the program to be migrated is established. And when the program to be migrated is executed, calling the dynamic binary translator to execute the intermediate result file corresponding to the program to be migrated. In the execution process, when a translated code block is encountered, the dynamic binary translator directly executes the translated code in the intermediate result file, and the design greatly reduces the dynamic binary translation overhead of the program to be migrated. The intermediate result file not only contains translated target platform codes and source platform codes which cannot be translated, but also records the address mapping relation between the source platform codes and the translated target platform codes, the address mapping relation of memory data accessed by a program between the source platform and the target platform, description information of translated code segments and untranslated code segments and the like. The information ensures the feasibility of program translation and the diversity of platforms, and realizes the efficient connection of the static binary translator and the dynamic binary translator.
Compared with the existing dynamic and static combined binary translation, the dynamic and static combined binary translation system has the advantages that the organization mode is more efficient when dynamic and static binary translators are connected in series, the recorded information is more comprehensive, and the problems which cannot be solved by the existing dynamic and static combined binary translation system, such as the translation problem under the condition of mixing codes and data, the code address mapping problem before and after static translation, the address mapping problem of memory data accessed by a program between a source platform and a target platform, and the like, are solved.
Drawings
FIG. 1 is a block diagram of an embodiment of the present invention;
FIG. 2 is a schematic diagram of the structure of an intermediate result file in an embodiment of the invention;
FIG. 3 is a diagram illustrating description information of an intermediate result file in an embodiment of the invention;
FIG. 4 is a flow chart of the execution of a program in an embodiment of the present invention;
FIG. 5 is a timing diagram illustrating alternate translation processes in accordance with an embodiment of the present invention;
FIG. 6 is a schematic diagram of an implementation of example 1 of the invention;
fig. 7 is a schematic diagram of an implementation scheme of embodiment 2 of the invention.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.
The embodiment of the invention relates to a program migration method for dynamic and static combined binary translation. The method adopts a static binary translator to pre-compile a program to be migrated in an off-line stage, and generates an intermediate result file, wherein the generated intermediate result file can be managed by a file system and is loaded and executed by a dynamic binary translator when the program to be migrated is executed. The method fully utilizes the characteristics that the static binary translator offline compilation does not occupy the running time and can carry out deep optimization, carries out the precompilation on the program to be migrated, and can greatly reduce the overhead when the program to be migrated carries out the dynamic binary translation. The invention translates the codes which cannot be translated by the static binary translator in the runtime through the dynamic binary translator, thereby ensuring the integrity of program translation. The embodiment designs an intermediate result file, which stores the result of the static binary translator, and the result is read by the dynamic binary translator when the program runs, so that the efficient series connection between the dynamic binary translator and the static binary translator is completed.
As shown in fig. 1, the method specifically comprises the following steps:
the method comprises the following steps: and (5) performing precompilation. And the static binary translator reads the source platform binary file in an off-line stage, disassembles the source platform binary file by taking the basic block as a unit, decodes the disassembly code into assembly code of the source platform, and analyzes the decoded assembly code to generate a control flow graph. And after the control flow graph is generated, the assembly code of the source platform is promoted into an intermediate representation, and the intermediate representation is higher-level abstraction than the assembly code, so that deep optimization is facilitated. In the several stages, problems which are difficult to solve by static binary translation may be encountered, such as code discovery, code positioning, code and data mixing, self-modifying code and the like, the method puts an untranslated code block (which may contain one or more instructions) into a generated intermediate result file, and inserts a special identifier (which may be a dynamic translation help function, for example) at a connection point of the static binary translated code block and the static binary translated code block to implement execution of the static binary translated code and seamless switching of the dynamic binary translation. It should be noted that the identification in this embodiment may also be implicit.
In this step, the intermediate representation may also be optimized in the static binary translation process, and target platform-related optimizations, such as instruction selection, instruction scheduling, register allocation, and the like, may be performed when the target code is generated. The optimization process not only comprises the optimization of code logic, but also comprises the optimization of translation instruction selection. The static binary translator can select instructions with high running efficiency and low cost on the target platform as far as possible to replace the instructions of the source platform, and finally generates an executable binary file on the target platform.
In order to ensure the normal operation of the translated program, the address mapping relationship between the source platform instruction and the translated target platform instruction, the address mapping relationship between the memory data accessed by the program and the source platform and the target platform, and the like, also need to be recorded in the translation process. These mappings are all collected in the static binary translator and written to the intermediate result file (see FIG. 2).
In order to facilitate the dynamic binary translator to distinguish which code of the program to be migrated has been statically translated and which code needs to be dynamically translated, the pre-compilation stage also generates description information of the source platform binary file that clearly describes which code segments of the source platform binary file have been successfully statically translated and which code segments need to be dynamically translated (see fig. 3), and this description information can be stored in the intermediate result file as a special section.
Step two: and managing an intermediate result file. And the generated intermediate result file is stored in an appointed file directory of the target platform according to the corresponding specification, and the mapping relation between the intermediate result file and the binary program of the source platform to be migrated is established.
Step three: and (6) executing. As shown in fig. 4, when executing a program, an operating system on a target platform determines whether a current executable file uses a code of the platform, if so, the current executable file is normally executed, and if not, a dynamic binary translator is invoked to load a precompiled intermediate result file corresponding to the program, and the dynamic binary translator is responsible for executing the result file.
When the dynamic binary translator is responsible for executing, the dynamic binary translator reads the intermediate result file and sends the translated target platform code in the intermediate result file to the execution engine. And the execution engine alternates back and forth between the execution of the statically translated codes and the dynamic binary translation according to the description of whether the static binary translation of the source platform execution file codes is successful or not in the intermediate result file, so that the execution of the program to be migrated is completed. As shown in fig. 5, the code that has been statically translated is directly executed, and after a piece of statically translated code is executed, the execution is switched to the dynamic translation engine when the identifier is encountered. The dynamic translation engine solves the problem that part of source platform codes cannot be translated statically by using a runtime environment, and sends the translated target platform executable codes to the execution engine for execution after the translation is completed.
In this step, the dynamic binary translator also detects an exception in the running process and performs corresponding processing. In order to ensure efficient operation of the code cache region, the dynamic binary translator can link (linking) code blocks in the code cache region, and a code cache region replacement algorithm is preset to ensure efficient utilization of the code cache region.
In some cases, dynamic translation may be more effective than static translation, such as a loop with a high number of iterations, and a dynamic binary translator may be configured to allow collection of a dynamic representation of program behavior at runtime to dynamically optimize code. For code that has been successfully translated through static binary translation, the dynamic binary translator can also collect a running program behavior dynamic representation during execution, and further perform binary sub-optimization on the code based on static translation optimization.
The invention is further illustrated below with reference to two specific examples. In the following embodiments, there are multiple computing platforms A, B, C based on different instruction set architectures, which may be Arm, x86, MIPS, PowerPC, RISC-V, etc., or different versions of the same instruction set architecture, which may be Arm V7, Arm V8, Arm V9, etc. The processors based on the current version instruction set architecture are adopted on different computing platforms, for example, the computing platform based on the Arm instruction set architecture may adopt an kylin series processor, the computing platform based on the x86 instruction set architecture may adopt a strong series processor, and the computing platform based on the RISC-V instruction set architecture may adopt a ferruginous series processor. It is also possible that processors based on the Arm instruction set architecture may employ different versions of the same family of processors, such as the kylin 920 processor and the kylin 985 processor.
Example 1: the precompilation and dynamic translation of the program to be migrated are implemented on the same platform.
A binary executable p is on computing platform a that adapts to the current platform instruction set architecture x, which is now scheduled to be migrated to computing platform B for execution.
As shown in fig. 6, the migration of the cross-platform program is implemented according to the method in the above embodiment, and the executable binary program p on the computing platform a is first sent to the computing platform B. On the computing platform B, the static binary translator performs pre-compiling on the program p to be migrated in an off-line stage, generates an intermediate result file and stores the intermediate result file on the computing platform B.
When the computing platform B executes the program p to be migrated, the precompiled intermediate result file is processed by using a dynamic binary translator, the statically translated code is executed by using an execution engine, and the translation engine is called to solve the problem that part of the code cannot be statically translated by virtue of a runtime environment. Through the process of continuous circulation, the complete translation of the program is finally realized. By this time, program p on computing platform A has been successfully migrated to computing platform B.
Example 2: the precompilation and dynamic translation of the program to be migrated are implemented on different platforms.
A binary executable p is on computing platform a that adapts to the current platform instruction set architecture x, which is now scheduled to be migrated to computing platform B for execution.
As shown in fig. 7, the method according to the above embodiment implements migration of a cross-platform program, calls a static binary translator on a computing platform a, pre-compiles a binary executable program p to be migrated at an offline stage, generates an intermediate result file, and stores the intermediate result file on the computing platform a. And then sending the pre-compiled intermediate result file to a computing platform B.
The different platform may also be a third party platform independent of the source platform of the program to be migrated. Such as computing platform C of fig. 7. A binary executable program p which is adapted to the instruction set architecture x corresponding to the computing platform A is arranged on the computing platform C, and the precompiled binary executable program p is sent to the computing platform B through the computing platform C.
When the computing platform B executes the program p to be migrated, a dynamic binary translator is called to process the precompiled intermediate result file, the statically translated code is executed through the execution engine, and the problem that part of the code cannot be statically translated is solved by the aid of the runtime environment through the translation engine. Through the process of continuous circulation, the complete translation of the program is finally realized. By this time, program p has been successfully migrated to computing platform B.
Therefore, in order to realize cross-platform migration of a program and improve the execution performance of a source platform program on a target platform, a program to be migrated is precompiled by a static binary translator, a result and related information of the static binary translator are stored by defining an intermediate result file and are stored in a specified directory of the target platform according to corresponding specifications, and a mapping relation with the program to be migrated is established. And when the program to be migrated is executed, calling the dynamic binary translator to execute the intermediate result file corresponding to the program to be migrated. In the execution process, when a translated code block is encountered, the dynamic binary translator directly executes the translated code in the intermediate result file, and the design greatly reduces the dynamic binary translation overhead of the program to be migrated. The intermediate result file also comprises code segments which cannot be statically translated, and the runtime environment of the dynamic binary translator can be solved, so that the integrity of cross-platform program migration is ensured.
The intermediate result file set by the invention not only contains translated target platform codes and source platform codes which cannot be translated, but also records the address mapping relation between the source platform codes and the translated target platform codes, the address mapping relation of memory data accessed by a program between the source platform and the target platform, the description information of translated code segments and untranslated code segments and the like. The information ensures the feasibility of program translation and the diversity of platforms, and realizes the efficient connection of the static binary translator and the dynamic binary translator. The invention also makes full use of the advantages of the dynamic binary translator, and obtains a good balance between the dynamic optimization overhead and the execution efficiency of the optimized code.
Compared with the prior static binary translation system, the invention can ensure the integrity of program translation; compared with the traditional dynamic binary translation system, the translated code has higher quality and lower operation cost; compared with the prior dynamic and static combined binary translation system, the dynamic and static combined binary translation system has the advantages that the organization mode is more efficient when dynamic and static binary translators are connected in series, the recorded information is more comprehensive, and the problems which cannot be solved by the conventional dynamic and static combined binary translation system, such as the translation problem under the condition of mixing codes and data, the code address mapping problem before and after static translation, the address mapping problem of memory data accessed by a program between a source platform and a target platform, and the like, are solved.
It should be noted that the program migration method of the above embodiments in combination with binary translation may be implemented by computer program instructions, for example, by a special program, which may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, and may be executed by the processor of the computer or other programmable data processing apparatus to create a unit or component for implementing the functions/operations specified in the flowchart and/or block diagram and/or flowchart block or blocks.
Also, these computer program instructions may be stored in a computer-readable memory that can direct a computer or other programmable processor to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function/act specified in the flowchart and/or block diagram block or blocks.
It should also be noted that, in some alternative implementations, the functions/acts noted in the blocks may occur out of the order noted in the flowcharts. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved.
It should be noted that the elements (including flow charts and block diagrams in the figures) disclosed and depicted herein mean logical boundaries between elements. However, in accordance with software or hardware engineering practices, the depicted elements and their functions may be executed on a machine by a computer-executable medium having a processor capable of executing program instructions stored thereon as a single-chip software structure, as stand-alone software modules, or as modules using external programs, code, services, etc., or any combination of these, and all such implementations may fall within the scope of the present disclosure.
While different non-limiting embodiments have components specifically illustrated, embodiments of the present invention are not limited to these specific combinations. It is possible to use some of the components or features from any non-limiting embodiment in combination with features or components from any other non-limiting embodiment.

Claims (11)

1. A program migration method for dynamic and static combined binary translation is characterized by comprising the following steps:
(1) pre-compiling the program to be migrated by adopting a static binary translator and generating an intermediate result file; the intermediate result file comprises a first code block and a second code block, the first code block is a code block which can be translated by the static binary translator, the second code block is a code block which cannot be translated by the static binary translator, and a mark is arranged at a connecting point of the first code block and the second code block;
(2) establishing a mapping relation between the intermediate result file and the program to be migrated;
(3) executing the program to be migrated, when the program to be migrated does not use the platform code, calling a dynamic binary translator, loading an intermediate result file corresponding to the program to be migrated based on the mapping relation by the dynamic binary translator for execution, directly executing the first code block by adopting an execution engine according to the identifier during execution, and executing the second code block by using a translation engine after the translation of the translation engine.
2. The program migration method for dynamic and static combined binary translation according to claim 1, wherein the static binary translator is capable of identifying and marking code blocks which cannot be statically translated for handing over to the dynamic binary translator; the reasons for the inability to translate statically are caused by code discovery problems, code location problems, code and data mixing problems, or self-modifying code problems.
3. The program migration method according to claim 1, wherein the step (1) of pre-compiling the program to be migrated by using the static binary translator specifically comprises: and the static binary translator reads the program to be migrated, disassembles the program to be migrated by taking a basic block as a unit, decodes the program to be migrated into an assembly code of a source platform, analyzes the decoded assembly code to generate a control flow graph, and promotes the assembly code of the source platform into an intermediate representation.
4. The program migration method for dynamic and static combined binary translation according to claim 3, further comprising a step of optimizing the intermediate representation, specifically: and the static binary translator performs various types of optimization based on the intermediate representation and performs target platform-related optimization when target codes are generated.
5. The program migration method according to claim 1, wherein the static binary translator in step (1) pre-compiles the program to be migrated at an offline stage.
6. The program migration method according to claim 1, wherein the intermediate result file further includes a first address mapping relationship and a second address mapping relationship, the first address mapping relationship is an address mapping relationship between a source platform instruction and a translated target platform instruction, and the second address mapping relationship is an address mapping relationship between a source platform and a target platform for memory data accessed by the program; and (3) the dynamic binary translator utilizes the first address mapping relation and the second address mapping relation to ensure consistency of access to memory data in the dynamic binary translation process and access to the same memory address in the static binary translation.
7. The program migration method according to claim 1, wherein the intermediate result file further includes description information, and the description information is used to describe which code blocks in the program to be migrated are code blocks translated by the static binary translator and which code blocks are code blocks not translated by the static binary translator.
8. The program migration method for dynamic and static combined binary translation according to claim 1, wherein the dynamic binary translator in the step (3) further comprises a dynamic optimization step in an execution process, specifically: the dynamic binary translator links code blocks in a code cache region, and presets a code cache region replacement algorithm to ensure efficient utilization of the code cache region.
9. The program migration method according to claim 1, wherein the dynamic binary translator in step (3) dynamically optimizes the code by collecting dynamic pictures of program behavior during execution.
10. A program migration system for dynamic and static binary translation, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the program migration method for dynamic and static binary translation according to any one of claims 1 to 9 when executing the program.
11. A computer-readable storage medium on which a computer program is stored, the program being executed by a processor to implement the program migration method of dynamic and static binary translation according to any one of claims 1 to 9.
CN202111458787.2A 2021-12-02 2021-12-02 Program migration method, system and storage medium for dynamic and static combined binary translation Pending CN114115990A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111458787.2A CN114115990A (en) 2021-12-02 2021-12-02 Program migration method, system and storage medium for dynamic and static combined binary translation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111458787.2A CN114115990A (en) 2021-12-02 2021-12-02 Program migration method, system and storage medium for dynamic and static combined binary translation

Publications (1)

Publication Number Publication Date
CN114115990A true CN114115990A (en) 2022-03-01

Family

ID=80365740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111458787.2A Pending CN114115990A (en) 2021-12-02 2021-12-02 Program migration method, system and storage medium for dynamic and static combined binary translation

Country Status (1)

Country Link
CN (1) CN114115990A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114461227A (en) * 2022-04-13 2022-05-10 飞腾信息技术有限公司 Method and device for running software and machine-readable storage medium
CN114995832A (en) * 2022-06-28 2022-09-02 湖南卡姆派乐信息科技有限公司 Dynamic and static combined binary program translation method
CN115794123A (en) * 2023-02-13 2023-03-14 湖南大学 Extensible framework for program cross-architecture migration and program cross-architecture migration method
CN116126350A (en) * 2023-04-17 2023-05-16 龙芯中科技术股份有限公司 Binary translation method, binary translator and electronic equipment
US11900087B1 (en) * 2022-03-23 2024-02-13 Amazon Technologies, Inc. Application binary replatforming as a service

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11900087B1 (en) * 2022-03-23 2024-02-13 Amazon Technologies, Inc. Application binary replatforming as a service
CN114461227A (en) * 2022-04-13 2022-05-10 飞腾信息技术有限公司 Method and device for running software and machine-readable storage medium
CN114461227B (en) * 2022-04-13 2022-07-12 飞腾信息技术有限公司 Method and device for running software and machine-readable storage medium
CN114995832A (en) * 2022-06-28 2022-09-02 湖南卡姆派乐信息科技有限公司 Dynamic and static combined binary program translation method
CN114995832B (en) * 2022-06-28 2023-03-21 湖南卡姆派乐信息科技有限公司 Dynamic and static combined binary program translation method
CN115794123A (en) * 2023-02-13 2023-03-14 湖南大学 Extensible framework for program cross-architecture migration and program cross-architecture migration method
CN116126350A (en) * 2023-04-17 2023-05-16 龙芯中科技术股份有限公司 Binary translation method, binary translator and electronic equipment
CN116126350B (en) * 2023-04-17 2023-09-12 龙芯中科技术股份有限公司 Binary translation method, binary translator and electronic equipment

Similar Documents

Publication Publication Date Title
CN114115990A (en) Program migration method, system and storage medium for dynamic and static combined binary translation
US7757221B2 (en) Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints
US7398521B2 (en) Methods and apparatuses for thread management of multi-threading
US9977664B2 (en) Information processing device and information processing method in heterogenous multi-cores having different architectures
KR101381274B1 (en) Register mapping techniques for efficient dynamic binary translation
US7856618B2 (en) Adaptively generating code for a computer program
US8276131B2 (en) Method and system for dynamic loop transfer by populating split variables
US20070033592A1 (en) Method, apparatus, and computer program product for adaptive process dispatch in a computer system having a plurality of processors
CN101299192B (en) Non-aligning access and storage processing method
US7069412B2 (en) Method of using a plurality of virtual memory spaces for providing efficient binary compatibility between a plurality of source architectures and a single target architecture
US20070294679A1 (en) Methods and apparatus to call native code from a managed code application
US20040255279A1 (en) Block translation optimizations for program code conversation
MXPA01012308A (en) Migration of different source languages to an executing medium.
CN104246695A (en) Nested emulation and dynamic linking environment
KR20080023728A (en) Selective pre-compilation of virtual code to enhance emulator performance
CN113867832B (en) Method, system, computer equipment and medium for dynamically modifying business data logic
WO2022237098A1 (en) Heterogeneous program execution method and apparatus, and computing device and readable storage medium
CN110609689A (en) Application installation and operation method and device
CN111625279A (en) Dynamic and static fusion binary translation method and system based on dynamic link library
CN114115964B (en) Hot updating method and device for Unity, computing equipment and computer-readable storage medium
CN110659088B (en) Method and system for expanding program under embedded environment
US20160011890A1 (en) Compatibility method and apparatus
EP2182433A1 (en) Indirect branching program, and indirect branching method
JP4684571B2 (en) Direct instructions to implement emulation computer technology
CN111596970A (en) Dynamic library delay loading method, device, equipment and storage medium

Legal Events

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