摘要 |
One embodiment of the present invention provides a system that generates prefetch instructions for indexed array references. Upon receiving code to be executed on a computer system, the system analyzes the code to identify candidate references to be prefetched, wherein the candidate references can include indexed array references that access a data array through an array of indices. Next, the system inserts prefetch instructions into the code in advance of the identified candidate references. If the identified candidate references include indexed array references, this insertion process involves, inserting an index prefetch instruction into the code, which prefetches a block of indices from the array of indices. It also involves inserting data prefetch instructions into the code, which prefetch data items in the data array pointed to by the block of indices.
|