Patent ID: 8726248

Claim:
A method for enregistering memory locations, comprising: receiving object code for a program, wherein the object code executes using a specified number of registers associated with a first hardware implementation; translating the object code to execute on a second hardware implementation, wherein translating the object code comprises determining that the second hardware implementation includes more registers than the first hardware implementation; identifying a memory access in the object code, wherein the memory access is associated with a memory location; rewriting one or more instructions associated with the memory access to access a data value for the program from an extra available register in the second hardware implementation instead of from the memory location, wherein the extra available register is associated with a first thread; and moderating accesses to the memory location to preserve the memory model semantics of the first hardware implementation by detecting an attempt by a second thread to access the memory location, wherein detecting the attempt comprises: during the attempted memory access, comparing an identifier for the first thread with an identifier for the second thread, wherein the identifier for the first thread is associated with a memory page containing the memory location; and when the identifier for the first thread and the identifier for the second thread do not match, performing at least one of: writing a current value that is stored in the extra available register to the memory location, and rewriting the one or more instructions to access the memory location instead of accessing the extra available register.