主权项 |
1. A computer program product for emulating execution of a group of Guest instructions of a Guest processor architecture with a single semantic routine of Host instructions of a Host processor architecture, the computer program product comprising non-transitory storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method comprising:
monitoring execution of Guest instructions; determining that a group of the monitored Guest instructions have been executed, as a group, a predefined number of times; responsive to the predefined number of times meeting a threshold value criteria, dynamically selecting the group of Guest instructions, the selected group of Guest instructions beginning with a first Guest instruction and ending with a second Guest instruction; Just-In-Time (JIT) compiling the selected group of Guest instructions into a plurality of Host instructions; designating a plurality of Host cells in Host memory, each designated Host cell corresponding to a separate respective single Guest cell of Guest memory, each Host cell addressable based on a Guest program counter value, wherein each Guest cell has a size that is equal to a predetermined Guest cell size, each Host cell has a size that is equal to a predetermined Host cell size, and wherein the predetermined Host cell size is greater than the predetermined Guest cell size; patching a first Host cell of the plurality of Host cells with Host instructions for executing the plurality of Host instructions, the first Host cell corresponding to a first Guest cell of Guest memory, the first Guest cell corresponding to a beginning portion of said first Guest instruction; responsive to the Guest program counter value indicating the first Guest cell corresponding to the first Guest instruction is to be executed, executing the plurality of Host instructions of the patched first Host cell corresponding to the first Guest cell; responsive to the Guest program counter value indicating a second Guest cell corresponding to another Guest instruction is to be executed, executing one or more second Host instructions of a second Host cell corresponding to the second Guest cell to emulate execution of the second Guest instruction, the second Guest cell corresponding to a beginning portion of said second Guest instruction; wherein each of the plurality of Host cells corresponds to a respective lock bit in a bit significant table, and further comprising: before accessing a particular Host cell by the Host processor, determining whether the lock bit corresponding to the particular Host cell in the bit significant table is set to locked; based on the lock bit corresponding to the particular Host cell in the bit significant table being set to locked, waiting by the Host processor until the lock bit corresponding to the particular Host cell is set to unlocked; and based on the lock bit corresponding to the particular Host cell in the bit significant table being set to unlocked, accessing the particular Host cell by the Host processor. |