1. A method for parallel execution of programs, comprising: while executing a program in parallel: creating a first program replica for a first thread, wherein the first program replica comprises: a write operation on a first object, a first identifier of the first object specifying whether the first object is thread-local, and wherein the first program replica corresponds to a first copy of the program; modifying the write operation based on a first speculation that the write operation uses only thread-local objects, wherein the write operation executes in a first transaction of the first thread; determining, while executing the first program replica and using the first identifier, that the first object used by the write operation is not thread-local; de-optimizing the write operation by adding instrumentation to implement a software transactional memory (STM) system for the write operation to obtain a de-optimized write operation; performing the de-optimized write operation on the first object to obtain a first result; and storing the first result in a redo log based on the determination that the write operation is performed on the first object which is not thread-local.