A tool is provided for modifying the code of a multi-threaded computer
program undergoing testing. The program executes in an environment that
has a governing memory model. It is assumed that there is a global heap
and a thread-local heap, which are synchronized from time to time. The
modifications are of two types: (1) code instructions are reordered while
remaining in compliance with the memory model; and (2) thread-local
variables are added to functions, together with inserted heap
synchronizing instructions. The modified programs are then used by a test
generator to prepare test cases for execution. The modifications have the
effect of changing the interleavings that occur among different threads,
and increase the likelihood of exposing flaws that may become evident
under different memory models.