1. A non-transitory computer-readable storage medium storing program instructions executable by one or more processors to implement: a compiler configured to compile program code for execution on a software transactional memory system, wherein the compilation comprises: recognizing by the compiler that a group of data structures is accessed together within one or more atomic memory transactions defined in the program code; and in response to the compiler recognizing that the group of data structures is accessed together within one or more atomic memory transactions defined in the program code, the compiler creating an executable version of the program code, wherein said compiler creating the executable version includes the compiler inserting a clustering code in the executable version of the program code, wherein the clustering code is executable to associate the data structures in the group with a same software transactional memory lock, wherein the lock is usable by the software transactional memory system to coordinate concurrent transactional access to the group of data structures by multiple concurrent threads.