主权项 |
1. A method comprising:
loading loop instructions, associated with a loop process, into a code cache; identifying a branch instruction of the loop process in the code cache; detecting a suspension event; in response to detecting the suspension event, replacing the branch instruction in the code cache with a jump instruction for jumping to an interpreter configured to execute one or more suspension instructions associated with the suspension event; continuing program execution until the jump instruction is reached; when the jump instruction is reached, executing the jump instruction by jumping to the interpreter; in response to the executing of the jump instruction, restoring the branch instructions in the code cache, and executing, by the interpreter, the one or more suspension instructions, wherein the restoring of the branch instruction in the code cache is performed before completion of the executing of the one or more suspension instructions; and returning to execution of the loop process after the executing of the one or more suspension instructions. |