二进制翻译是在不同硬件平台之间实现软件迁移的重要手段.在二进制翻译系统中,如何在没有标志位寄存器的目标平台上模拟实现源平台上标志位寄存器的功能,是影响系统性能的关键.现有的标志位分析技术通过对标志位的定值引用进行数据流分析,尽可能多地消除冗余的标志位定值.但是,对于那些会被引用的标志位定值,现有的技术仍然需要进行翻译.这不仅会导致翻译生成代码的膨胀,还会影响二进制翻译系统的性能.提出了一种二进制翻译中基于模式化的标志位翻译方法.该方法在标志位分析技术基础上,通过将源平台上标志位定值指令和引用指令组合成固定的标志位模式,然后根据模式的具体语义选择目标平台上具有相同语义功能的指令组合进行翻译.这种模式化的翻译方法,不仅可以降低因翻译标志位而引入的代码膨胀,还可以提升二进制翻译系统的性能.实验结果表明,对于SPEC CINT2006中的程序,该方法不仅可以使翻译生成的代码量平均减少7.5%,还可以将程序的性能平均提升10%.
Binary translation is an important way for software migration between different hardware platforms. For binary translation systems, how to simulate the flag register on target platform that does not have the function of the flag register, is a key factor affecting system performance. Previous flag analysis techniques delete the unnecessary flag computing via the flow analysis of flag definition and usage during the process of flag translation. However, for the necessary flag computing, these techniques still have to translate for simulation, which can lead to the expanse o{ generated native code and the loss of system performance. A pattern translation method is presented for necessary {lag computing in binary translation system. Based on previous flag analysis techniques, this method makes flag definition instruction and flag usage instruction a flag pattern, and chooses appropriate instruction groups on target platform to translate flag computing based on the semantics of the flag pattern. This method for flag translation can reduce the expanse of generated native code and improve the performance of binary translation system. The experiment results demonstrate that, for the programs in SPEC CINT2006, this method can reduce the amount of generated native code by 7.5% and improve the system performance by 10% on average.