摘要 |
In one embodiment, a set of lock and unlock instructions in a read phase of a computer-readable program is replaced with a first set of tracking instructions, wherein the first set of tracking instructions track a set of locked objects identifying objects that would have been locked by executing the set of lock and unlock instructions. A second set of tracking instructions is inserted into the read phase of the computer-readable program, wherein the second set of tracking instructions track a set of read objects indicating versions of objects that are read. Validation instructions are inserted into the computer-readable program, wherein the validation instructions validate that the versions of objects in the set of read objects have not changed since they were last read and lock the set of locked objects that would have been locked upon completing execution of the set of lock and unlock instructions. Update instructions are added to an update phase of the computer-readable program, where the update instructions increment a current version of an object each time a value of the object is updated or a lock of the object is released. |
主权项 |
1. A method, comprising:
replacing, by a processor, a set of lock and unlock instructions in a read phase of source code with a first set of tracking instructions, wherein the first set of tracking instructions track a set of locked objects identifying objects that would have been locked by executing the set of lock and unlock instructions; inserting, by a processor, a second set of tracking instructions into the read phase of the source code, wherein the second set of tracking instructions track a set of read objects indicating versions of objects that are read; inserting, by a processor, validation instructions into the source code, wherein the validation instructions lock objects in the set of locked objects and validate that the versions of objects in the set of read objects have not changed since they were last read; and adding, by a processor, update instructions to an update phase of the source code, wherein the update instructions increment a current version of an object each time a value of the object is updated or a lock of the object is released. |