1. A method for locked prefetch scheduling in general cyclic regions of a computer program, comprising: receiving source code for the computer program; compiling the source code into intermediate code; performing a trace detection on the intermediate code to identify a cyclic region in the intermediate code; inserting prefetch instructions and corresponding locks into the intermediate code, wherein each prefetch instruction is paired with a lock, and wherein each lock is inserted a number of instructions after a corresponding prefetch instruction, wherein the number of instructions is computed based on at least one of a maximum number of outstanding prefetches allowed and a number of accesses in the cyclic region; and generating executable code from the intermediate code; wherein a lock for a given prefetch instruction prevents subsequent prefetches from being issued until the data value returns for the given prefetch instruction; and wherein the method is implemented by a computer system that comprises a processor and a memory.