1. A method for generating efficient software during compilation for a software transactional memory system, the method comprising: locating an instruction to open a reference for reading which is known to be followed by a first instruction to open the reference for update during execution; and substituting, for the instruction to open the reference for reading, a second instruction to open the reference for update.