Efficient locking for thread-safe self-modifying code
Abstract
A locking mechanism for use in a multi-thread environment supporting self-modifying code in which modifications to the code are made at runtime. The locking mechanism having associated helper code accessed by a call from the first instruction address in the code block. The helper code calculating the binary encoding for the call instruction and using an atomic compare and exchange instruction to compare the calculated binary encoding with the actual contents of the first instruction address. Where there is a match, a self loop instruction is written to the first instruction address to lock the specified code block for subsequent threads. The helper code contains instructions to resolve the references in the specified block. The last such instruction is an atomic store operation to replace the self loop instruction at the first instruction address with the appropriate modified instruction.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 16 · Forward citations: 3.
Claims (1 — 1 Independent, 0 Dependent)
- Claim 1Independent Claim
A computer program product comprising a computer usable medium tangibly embodying computer readable program code for defining code to provide a locking mechanism for self-modifying code in a multi-thread environment, the self-modifying code comprising helper code callable to modify instructions in a defined block of the self-modifying code, said computer program product comprising: computer readable program code means for defining an atomic compare and exchange instruction in the locking mechanism, the defined atomic compare and exchange instruction for carrying out a comparison of an unreserv
Technical Overview & Description
Full multi-page specification text is archived at the issuing office. Read complete official specification ↗