发明名称 Dynamic code injection
摘要 Embodiments of the present invention disclose an approach for inserting code into a running thread of execution. A computer sets a first set of bits to a first value, wherein the first value indicates that a first set of instructions should be inserted onto a stack. The computer executes a second set of instructions associated with a first safepoint, wherein the second set of instructions comprises one or more instructions to determine if the first set of bits is set to the first value. The computer determines that the first set of bits is set to the first value, and the computer inserts the first set of instructions onto the stack.
申请公布号 US9384019(B2) 申请公布日期 2016.07.05
申请号 US201414224178 申请日期 2014.03.25
申请人 International Business Machines Corporation 发明人 Dawson Michael H.;Johnson Graeme;Li San Hong
分类号 G06F9/44;G06F9/455;G06F11/36;G06F9/48;G06F9/50 主分类号 G06F9/44
代理机构 代理人 Sharkan Noah A.
主权项 1. A computer program product for inserting code into a running thread of execution, the computer program product comprising: one or more non-transitory computer-readable storage media and program instructions stored on the one or more non-transitory computer-readable storage media, the program instructions comprising: program instructions to set a first set of bits to a first value, wherein the first value indicates that a first set of instructions should be inserted onto a stack of a thread; program instructions to, responsive to determining that a first method was called, set a second set of bits to a second value, wherein the second value indicates that no set of instructions should be inserted onto the stack until the second set of bits is set to a third value; program instructions to, at a first safepoint in execution of the thread, execute a second set of instructions to determine if the first set of bits is set to the first value; program instructions to, responsive to determining that the first set of bits is set to the first value, set a third set of bits to a fourth value, wherein the fourth value indicates that the first set of instructions should be inserted onto the stack, based at least in part on execution of a third set of instructions at a second safepoint in execution of the thread; program instructions to, responsive to determining that a second method was called, set the second set of bits to the third value, wherein the third value indicates that the thread can safely execute the third set of instructions associated with the second safepoint and insert the first set of instructions onto the stack; and program instructions to, at the second safepoint in execution, execute the third set of instructions and insert the first set of instructions onto the stack.
地址 Armonk NY US