Efficient software cache accessing with handle reuse
AssigneeInternational Business Machines Corporation
InventorsAlexandre E. Eichenberger, Marc Gonzalez Tallada, John K. O'Brien
Life of this patent
Estimating the term…
Abstract
A mechanism for efficient software cache accessing with handle reuse is provided. The mechanism groups references in source code into a reference stream with the reference stream having a size equal to or less than a size of a software cache line. The source code is transformed into optimized code by modifying the source code to include code for performing at most two cache lookup operations for the reference stream to obtain two cache line handles. Moreover, the transformation involves inserting code to resolve references in the reference stream based on the two cache line handles. The optimized code may be output for generation of executable code.
Claims22
A method, in a data processing system having a software cache, for optimizing memory accesses in source code, comprising:
- grouping memory references in the source code into a reference stream, the reference stream having a size equal to or less than a size of a software cache line;
- transforming the source code into optimized code at least by:
- inserting cache lookup code for performing a cache lookup of a lowest memory reference address in the reference stream to thereby generate a first cache line handle;
- inserting cache lookup code for performing a cache lookup of one of an actual highest memory reference address in the reference stream or a highest possible memory reference address in the reference stream, to thereby generate a second cache line handle;
- and
- for each other memory reference in the reference stream, inserting code for determining whether to use the first cache line handle or second cache line handle as a basis for retrieving data from the software cache corresponding to the memory reference;
- and
- outputting the optimized code for generation of executable code for execution on one or more processors.
A computer program product comprising a non-transitory computer recordable medium having a computer readable program recorded thereon, wherein the computer readable program, when executed on a computing device, causes the computing device to:
- group memory references in source code into a reference stream, the reference stream having a size equal to or less than a size of a Software cache line;
- transform the source code into optimized code at least by:
- inserting cache lookup code for performing a cache lookup of a lowest memory, reference address in the reference stream to thereby generate a first cache line handle;
- inserting cache lookup code for performing a cache lookup of one of an actual highest memory reference address in the reference stream or a highest possible memory reference address in the reference stream, to thereby generate a second cache line handle;
- and
- for each other memory reference in the reference stream, inserting code for determining whether to use the first cache line handle or the second cache line handle as a basis for retrieving data from the software cache corresponding to the memory reference;
- and
- output the optimized code for generation of executable code for execution on one or more processors.
An apparatus, comprising:
- a processor;
- and
- a memory coupled to the processor, wherein the memory comprises instructions which, when executed by the processor, cause the processor to:
- group memory references in source code into a reference stream, the reference stream having a size equal to or less than a size of a software cache line;
- transform the source code into optimized code at least by:
- inserting cache lookup code for performing a cache lookup of a lowest memory reference address in the reference stream to thereby generate a first cache line handle;
- inserting cache lookup code for performing a cache lookup of one of an actual highest memory reference address in the reference stream or a highest possible memory reference address in the reference stream, to thereby generate a second cache line handle;
- and
- for each other memory reference in the reference stream, inserting code for determining whether to use the first cache line handle or the second cache line handle as a basis for retrieving data from the software cache corresponding to the memory reference;
- and
- output the optimized code for generation of executable code for execution on one or more processors.
Dependencies are inferred from the claim text.