Patent ID: 8117605

Claim:
A method for improving operations in an object-oriented, multithreaded computer system that uses transactional memory, the method comprising: compiling a program by a compiler, the compiling including: identifying at least one code fragment in the program which accesses a plurality of objects, wherein a respective access-mode is maintained for each object at runtime that indicates whether the corresponding object is certainly visible to only one thread; creating multiple versions of the code fragment, wherein each version is specialized to a different sharing pattern or particular combination of the access-modes for the plurality of objects; and generating selection code for the code fragment that determines which of the multiple versions to execute at runtime; executing the compiled program by a computer, the executing including: in response to program execution reaching the selection code, checking the respective access-mode for each object in a subset of the objects and selecting one of the versions of the code fragment, wherein the selecting is dependent on the respective access-mode for each object in the subset of the objects; and executing the selected version of the code fragment, wherein any accesses to any of the plurality of objects which are certainly visible to only one thread are performed by the selected version of the code fragment using non-transactional program code.