CA2200812A1 - Optimizing compilation of pointer variables - Google Patents

Optimizing compilation of pointer variables

Info

Publication number
CA2200812A1
CA2200812A1 CA002200812A CA2200812A CA2200812A1 CA 2200812 A1 CA2200812 A1 CA 2200812A1 CA 002200812 A CA002200812 A CA 002200812A CA 2200812 A CA2200812 A CA 2200812A CA 2200812 A1 CA2200812 A1 CA 2200812A1
Authority
CA
Canada
Prior art keywords
pointer
alias
graph
program
universal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
CA002200812A
Other languages
French (fr)
Inventor
Roch Georges Archambault
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
IBM Canada Ltd
Original Assignee
IBM Canada Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by IBM Canada Ltd filed Critical IBM Canada Ltd
Priority to CA002200812A priority Critical patent/CA2200812A1/en
Priority to US08/956,416 priority patent/US6173444B1/en
Priority to JP10053063A priority patent/JPH10269088A/en
Publication of CA2200812A1 publication Critical patent/CA2200812A1/en
Abandoned legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • G06F8/434Pointers; Aliasing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Abstract

Effective use of optimizing techniques during compilation is difficult in programs that make liberal use of pointers or indirect function calls. The indirection often means that the compiler cannot precisely determine the set of objects pointed to by a pointer at a specific location in the program, and therefore cannot efficiently eliminate pointer redundancies in the code. The present invention provides an optimising method that reduces the size of alias sets associated with program pointers.
During an initial compilation phase, intraprocedural information about pointer variables referenced in each function of the program is gathered and saved in a data structure called the pointer alias graph. In the middle phase, the pointer alias graphs from all the compilation units for the program are combined to form a universal pointer alias graph and then transitive closure is performed on the universal pointer alias graph to produce a reduced graph containing the list of objects that each pointer variable can point to. In the final phase, all the files are re-compiled using the universal pointer alias graph as input, resolving all occurrences where pointer variables are de-referenced.

Description

~ ~ O 0 8 ~ 2 .

OPTIMIZING COMPILATION OF POINTI~R VARIABLES

Field of the Invention This invention is directed to compiler optimizations, and in particular to a technique for reducing 5 redlmcl~nt pointer information.

Background of the Invention Compilation is a process used for tr~n~l~ting high level l~n~l~ge statements in a computer program into machine instructions executable by the target computer. Optimization is a general term for 10 modifications applied to source code, object code or any intermediate code present during compilation, in order to improve the P.ffici~ncy of the program being compiled. Usually optimization either:
a) aims to overcome pessimi~tic assumptions implied by l~n~l~ge rules that can cause redundancies in the compiled code. This can result in unnecessary memory allocation for the 15 additional (that is, re~hln~nt) code; or b) exploits a particular hardware for di~erenl environments.
The present invention is directed to an optimization technique of the first type.

Compilation may, broadly speaking, be divided into a front end phase in which the source code 20 program is tr~n~l~te~l, through steps of lexical, syntactic and semantic analysis, into an intermediate representation, and a back end phase in which the intermediate representation is tr~n.cl~te~l for output in object code modules, called compilation units, for linking into e~ecut~ble files. Optimization may take place at various stages during this compilation process, but generally speaking, occurs in the back end.
Usually opLil.lizaLion algorithms work on a representation of the aspect of the program to be optimised. This representation is usually produced by a pre-compilation step or by the first pass of a two-pass compiler. For example, U. S. Patent No. 5,107,418 for "Method for Representing Scalar Z~008 1 2 Data Dependencies for an Ol~l ;" ~i7.;~g Compiler" describes a method for creating a local scalar data dependence graph for eaGh basic block of the program. This local analysis is used to form a global data dependence graph that shows data dependencies in the context of a control flow graph within a single function that can be used for later optimizations in the compiler.

Most modern prog,~ll" llillg languages offer the capability to access a data object, or function object in the case of object oriented prog~ g languages like C~, indirectly through the use of a pointer variable . A pointer is a reference to the location or address of some region in memory where the data or function is stored. Typically, the value of the pointer variable is the object's address in l O storage. Because the reference to the object is indirect, through the pointer, calls that use function pointers are referred to as indirect calls.

Pointer references are particularly useful in complex programs where the exact number of elements in di~t;relll types of data structures may not be ascertainable at compilation time. The number may 15 vary with the program's actions as it is running. The use of pointer references allows individual pieces of storage to be allocated as needed, so that the required amount of storage is available at any given moment during program execution.

When used, the pointer variable is first initialised to the address of the specific object, and then de-20 referenced in order to access the object. Some l~n~l~ges permit the user to modify or copy pointervariables for the purpose of traversing an aggregate object, such as an array. Pointers may also be modified or copied for dynamically selecting an object to be operated upon.

These types of manipulations of pointer variables can lead to situations where the compiler cannot 25 precisely determine the set of objects (data or function objects) pointed to by a pointer variable at a specific location in the program. In these situations, the compiler must use safe assumptions to determine the scope of the pointer's object set. These assumptions, called aliasing assumptions, are usually specified by the l~n~l~ge being compiled. Aliasing assumptions are often very pes~imi~tic.

They drastically reduce the level of optimization that can be performed by reducing the level of redundancies which can be elimin~ted This problem can be illustrated using the following simple code example in which the use of *p and 5 *q indicate de-referencing of the pointers p and q, respectively:

sl: p=&a;
s2: q=&b;
......
......
s5: ..=*p+2;
......
s7: *q=..
......
s9: .. =*p+2;
The compiler can trace the values of p and q, and determine that they are handles to different objects by keeping track ofthe set of objects associated with a pointer variable. This set of objects is the alias set associated with the pointer variable.
However, the compiler cannot normally tell if statement s7 invalidates the value of the expression in statement s5, and as a result, it cannot assume that the same expression found in st~tement s9 iS
redundant. It must generate code which will recompute the value of the expression *p+2 for statement s9.
While the ~x~mple illustrates only a single redund~ncy, the m~gnit~lde of the problem can be realised over a large program of thousands of lines of code.

One way to reduce the size of the alias sets is to provide the user with alias assertion options giving 30 direct control over the aliasing assumptions. However, correct use ofthese options requires great skill and time on the part of the user, and increased program complexity makes it much more difficult ~ ~ ~ 00 8 1 2 to generalise appl Opl iate aliasing assumptions.

The pl t;r~ d approach is to develop an automatic solution to the problem, and to that end, a number oftechniques have been developed for computing the approximate set of objects that a pointer can 5 point to at any specific point in the program, such as the following:
1) "Efflcient context-sensitive pointer analysis for C programs", Robert Wilson and Monica Lam, SIGPLAN'95;
2) "Points-to analysis in almost linear time", Bjarne Steensgaard, Technical Report MSR-TR-95-08, Microsoft Corporation;
3) "A safe approximate algorithm for interprocedural pointer aliasing", William Landi and Barbara Ryder, SIGPLAN '92;
4) "Almost linear time points-to analysis", William Landi, in POPL '95;
5) "Context-sensitive interprocedural points-to analysis in the presence of function pointers", Maryam Emami, Rakesh Ghiya and Laurie Hendren, SIGPLAN '94;
6) "Interprocedural may-alias analysis for pointers: Beyond k-limiting", Alain Deutsch International Conference on Computer l~n~ges, IEEE '92; and 7) "Efficient flow-sensitive interprocedural computation of pointer-induced aliases and side effects", Jong-Deok choi, Michael Burke and Paul Carini, SIGPLAN '93.

20 Many of the existing techniques are computationally expensive and don't provide a solution for programs that contain indirect calls.

Summary of the Invention Accordingly, it is an object of the present invention to provide a general use technique for re~ cin~
25 the size of alias sets in production compilers that is precise enough to improve optimization.

It is also an object ofthe present invention to provide an alias set u~ ion that is efficient in terms of computation time and memory usage.

2~008 1 ~

A further object of the invention is to provide an alias set reduction technique for all pointer references, including indirect calls that use pointer references.

Therefore, the present invention provides a method for optimi~ing a program con~ining indirect 5 function calls. The method, implemented during compilation, incl~lde~ the steps of constructing, in each compilation unit, a data set of in~el~rocedural definitions for each referenced pointer in the compilation unit. The data sets from all compilation units are combined to construct a universal data set and transitive closure is pelro~ ed to çlimin~te redlm-l~nt definitions and reduce the universal data set. The program is recompiled using the reduced universal data set.
Preferably each data set consists of a set of objects associated with a pointer variable for each reference to that pointer variable. Further, each data set consists of a pointer alias graph developed through data flow graphing.

15 The invention also provides a computer program product consisting of a computer usable medium having computer readable program code means embodied thereon for progl~ "il~g a computer to perform the method of the invention described herein.

Brief Description of the Drawings 20 Embodiments of the invention will now be described in detail in association with the accompanying drawings, in which Figures 1 and 2 are flow diagrams illustrating the application of in~l aprocedural analysis to the uses and definitions of all pointer variables within the scope of a single function. Specifically, Figure 1 is a flow diagram ofthe initial compilation phase to gather h.Ll~procedural information about pointer variables; and 22008 ~ 2 Figure 2 is a flow diagram illustrating the steps for resolving all values of local pointer variables in the pointer alias graph to develop a pointer alias graph which summarizes the function.

Figure 3 is a fiow diagram illustrating the steps in interprocedural analysis for developing a universal 5 pointer alias graph for use in a optimized recompilation, according to the invention.

Detailed Description of the Preferred Embodiments In summary, the pr~lled method ofthe invention includes:
~ an initial compilation phase in which hlLl~pl-ocedural information about pointer variables l~r~lellced in each function ofthe program is gathered and saved in a data structure called the pointer alias graph;
~ a middle phase in which the pointer alias graphs from all the compilation units for the program are combined to form a universal pointer alias graph, and then transitive closure is performed on the universal pointer alias graph to produce a reduced graph cont~ining the list of objects that each pointer variable can point to, and ~ a final phase in which all the files are re-compiled using the universal pointer alias graph as input, resolving all occurrences where pointer variables are de-referenced.

The preferred embodiment is described as it applies to pointer variables in C, a progl i. " " ~ g l~ngll~ge 20 that, in general, makes liberal use of pointer variables. However, it will be understood by those skilled in the art that the method of the invention applies to other progr;1"""il-g l~n~l~ges that support pointer use, including C++ and FORTRAN.

Conventional optimization techniques are generally hl~l~plocedural; summary information for each 25 procedure is collected during a first pass performed at compile time. The present invention also utilises interprocedural analysis, a second pass performed at link time, in which the collected aLion is merged and used to compute an interprocedural solution. The application is then re-built (re-compiled) using the interprocedural solution to optimize the application. A full discussion 2~008 ~ 2 of a two-pass interprocedural analysis system can be found in Canadian Patent Application No.
2,102,089 titled "Recompilation of Computer Programs for Enhanced Opli~ Lion", which is commonly assigned and incorporated herein by reference. This application was laid open on April 30, 1995.

Referring to the drawings associated with the present disclosure, Figures 1 and 2 illustrate the steps taken through the initial hl~l~locedural analysis phase to develop a pointer alias graph for each function for later use in the middle interprocedural analysis phase illustrated in Figure 3.

Terms used in this description ofthe pler~lled embodiment have the following definitions:

the l-val of an object is its address. This includes the addresses of functions and of nameless data object (for example, from heap or stack storage). Heap or stack storage acquired by a call to the malloc or alloca ~;NSI C library routine is given a global name. In the invention, the l-val of heap or stack storage is treated in the same manner as the l-val of a named object;

~ the r-val of an object is its value at a given execution point in the program. For the purposes of the present invention, only the r-val of certain classes of pointer variables are used:
function calls (or local pointer variables), external or file scope variables function formal or actual arguments and function return values. Most C implementations permit pointer variables to be converted to and from integers. Therefore, any integer variable that could possibly contain an address is also included in the definition of r-val; and ~ the universal object represents the list o~ all l-vals in the entire program, once program closure is reached. The universal object represents the r-val of certain classes of pointer variables not included in the above definition of r-val. These classes of pointer variables include multiple levels of pointer de-referencing (one r-val dependent on another r-val, as in the reference, in C, to **p where p is declared as a pointer to a pointer), pointer variables ~2008 ~

whose addresses have already been taken (I-vals already exist), and pointer variables that are structurally aliased, such as in a C union or array construct.

Referring first to Figure 1, a pointer alias graph is built for each function based on the information 5 gathered in the first h~ pr~cedural pass of the compiler (block 10). Standard data flow gathering techniques are used to develop the pointer alias graph. The nodes in the graph represent either a definition of a pointer variable or a use of a pointer variable, and each node has an associated alias set. The initial alias sets for the nodes of this graph are defined (block 12) as follows: the initial alias set for definition nodes is the right hand side of the pointer variable assignment operation, and the 10 initial alias set for use nodes is the value of the object at that execution point (the r-val). Location information, the basic block number (relative to the lqow graph) and position within the basic block, is saved for each node (block 14).

In order to provide a complete representation of pointer use in the function for the interprocedural 15 analysis to follow, global unique names, called pseudo pointer variables, are assigned to each formal argument, function return value and global (or file scope) variable. Corresponding nodes and alias sets are created on the pointer alias graph (block 16).

Several actions follow, as illustrated in blocks 18 through 30 of Figure 1. However, it should be 20 pointed out that the sequence of steps illustrated in these blocks of the flow diagram are not intended to suggest temporality. Rather, the representations of function calls, function pointer calls and the return value for the function are created as these values are encountered in the code.

For each function call encountered in the current function (blocks 18 and 22), new nodes for the 25 pointer graph and alias sets are created (block 20). Each argument in the function call is represented by a definition node ofthe formal argument with an alias set initi~ ed to the actual argument (either an r-val or l-val), and the return value for the function is represented by a definition node of a local pseudo pointer variable representing the function's return value at this call point and an alias set 22008 ~2 initi~ ed to the r-val of a global pseudo pointer variable which represents the resolved return value.

Indirect call points (calls through function pointers) are also represented (blocks 24 and 28), each by a definition node of a global pseudo pointer variable. The alias set for this node is initialised to 5 the r-val of the actual pointer variable specified on the indirect call (block 26).

In addition, the return value of the current function is represented by a definition node with an alias set which is the union of all return points. The pseudo pointer variable being def ned represents the resolved return value (block 30).
The resulting alias graph includes nodes and alias sets for all of the pointer uses in the function, and this is then subjected to further analysis, following the steps set out in Figure 2, for resolution of the alias sets of all of the pointer variables of local scope.

15 As illustrated in the flow diagram of Figure 2, for each node with an r-val element in its alias set (block 40), the immediate reaching definitions for the r-val elements are computed (block 42).
Defining immediate reaches, or the value each element has reached at particular points in the program, is a common data flow problem, and a number of di~~ approaches for calcul~ting immediate reaches in local pointer analysis exist in the prior art. What is important is that the 20 algorithm used traverses all of the intervening reaching definitions. This can be illustrated using the following example:

q=&y;
if( ) P=q;
else p=&w;
~--P;

2 2 0 0 8 ~ 2 ~CA9-96-013 This short code segment has two branches; pl =q and p2-&w. The expression r=p; is the join point.
The reaching definition of r=p; is the set {p=q; 1 I p=&w; }, and r can simply be redefined as:

r=(pl 1¦ p2) Each r-va~ element in the node's alias set is replaced with the union of alias sets of all reaching definitions (block 44), as illustrated by the following example:

C program Initial graph nodes After immediate reaches 1 1 Ipl=&a; Ipl-I<={&a} Ipl-l<={&a}
2 l Ip2=&b; Ip2-2<={&2} Ip2-2<={&b}
10 1 if (. . .j 11 l Ip3=lpl +I; Ip3-11<={1PI } Ip3-11<={lpl-1}
12 l el~
13 1 Ip3=lp2+j; 1p3-13<={1P2} 1p3-13<={1P2-2}
.
20 1 Ip4=lp3+k; lp2420~={1P3} lp420<={lp3-ll,lp3-13}
. . .
30 l *Ip4=3; Ip430<-->{1P4} 1p430<=~{1P420}

Once all nodes with local r-val elements have been resolved (block 46), transitive closure, the 25 ~ ;on of intervening logic st~t~ nt~, is pelro-llled on the alias sets of the local pointer variables (block 48). A transitive relationship may best be described as If a=b and b=c, then a=c Transitive closure is the iterative process of propagating transitive relationships until the alias sets are stable and there is no possibility of the addition of further values. The closure process is referred to 30 as iterative because some of the relationships may be cyclic.

In the method of the invention, alias sets of global pointer variables, formal arguments and return values are not propagated at this stage because the interprocedural information for them is not yet 22008~2 ~CA9-96-0 1 3 available.

Using the example set out above, after transitive closure, the nodes are as follows:

Ipl-1<={&a}
Ip2-2c=,f &b}
lp3-ll<={&a}
Ip3-13<=1,&b}
Ip4-20<={&a, &b}
Ip430~ ,&a, &b}

The alias set for each use or de-reference of a local pointer variable now contains only l-val elements and is resolved. The alias sets computed by the front end of the compiler for inll ~procedural analysis are replaced with the resolved alias sets (block 52). This results in a much smaller alias set because a number of the pes~imi.ctic re~lln~1~ncies have been removed.

In preparation for interprocedural analysis, the pointer alias graph is reduced in size by elimin~ting some of the nodes (block 54). This is done by:

~ removing all definition and use nodes that involve local pointer variables;
~ removing all use nodes of global pointer variables and function return values; and 25 ~ merging all definitions nodes of a specific global pointer variable, formal argument or return value into a single definition (union alias sets). Interprocedural analysis of the pointers will treat these in a flow insensitive manner.

The resulting pointer alias graph contains only definition nodes for global pointer variables, the return 3 0 value of the current function and formal arguments for any called function. The only r-l~al elements contained in the alias sets associated with these definition nodes are of global pointer variables, formal ~CA9-96-013 arguments and return values; the rem~ining pointer values are l-val elements.

The reduced pointer alias graph set is saved (block 56), either to persistent memory or written to a file, for use in the interprocedural analysis described below in conjunction with Figure 3.

Each file of the application is compiled pelrol Illing the same steps of intra procedural analysis illustrated in Figures 1 and 2, and the resulting pointer alias graphs are saved.

The interprocedural analysis illustrated in Figure 3 is essentially an extension of the hlLI ~pl ocedural 10 analysis illustrated in Figures 1 and 2. In summary, all of the pointer graphs developed through the intraprocedural pass are gathered into a universal pointer alias graph for the whole program.
Transitive closure is performed and the resulting reduced graph is used as input to a second interprocedural pass.

15 Referring now to Figure 3, each reduced pointer alias graph is read from memory (block 60). All definition nodes (from the accl-rnlll~ted graphs) for each pointer variable are merged into a single definition node, and the alias sets of each of the nodes are combined (union) to form the universal alias set for a specific pointer variable (block 62).

20 Transitive closure of the alias sets in the universal pointer alias graph is performed (block 64). The transitive closure pelrc,lmed at this stage is similar to the process to create alias sets perforrned during intraprocedural analysis except that alias sets are propagated for all pointer variables in the universal graph.

25 Obtaining transitive closure of all the universal pointer graph may be an iterative process when the application includes indirect calls.

Program closure is a pre-requisite to most interprocedural optimization techniques, including the 2 2 0 0 8 ~ 2 ~CA9-96-013 present one. In order to achieve closure, all edges in a call graph must be resolved. A program contains indirect calls must first be analysed to resolve the indirect calls to reach program closure.
The indirect calls are resolved by tracing through the pointers which functions are being called in order to propagate aliases into (or out of) that function.
s Once transitive closure has been performed of the alias sets (block 64), nodes representing indirect call points are located (blocks 66, 76). For each ofthese, if the call point is resolved, that is, the alias set contains only l-val P.lemçn~.~ (block 68) and the alias set does not contain a universal object (block 70), then the argument is merged into and the value nodes related to the call point are returned to the 10 co~ Jondillg nodes of the actual function which may be called (block 74). If the resolved call point does contain a universal object (block 70), then the argument is merged into and the value nodes related to this call point are returned to the corresponding nodes of each function in the universal object (block 72).

15 If some indirect call points have not been resolved (block 78), the loop is reiterated, beginnin~ with the performance of transitive closure (block 64).

Once no unresolved indirect call point nodes remain in the graph (blocks 76,78), the reduced universal pointer alias graph is saved in pel~lsLe.,~ memory (block 80). Each of the files is recompiled 20 pe~ru~ .ng the intraprocedural algorithm using the final universal pointer alias graph as input (block 82). Since the universal pointer alias graph represents the complete aliasing relationships (following program closure), this pass can propagate aliases involving global pointer variables, leading to a much higher number of resolved alias sets cont~ining only l-val elements.

25 The interprocedural stage of the invention can be illustrated using the following C example:

double * accumulate (double * accumulc~tor, double * arra~, 2 2 0 0 8 1 ~
~CA9-96-013 int num_elements) static double local_accumulator;
5 int index;

if (accumulator == NULL) accumulator = &local_accumulator;

10 for (index = 0; index < num elements; ++index~
* accumulator += array[index~;

return accumulator;

15 double *global~tr;

mainO
double acc;
double arr[10];
global~tr = accumulate (&acc, &arr[O~, 10);

Using this example, an initial global pointer alias graph of accumulate function is constructed following the steps of Figures 1 and 2. Pseudo pointer variables, accumulate-argl, accumulate-arg2 25 and accumulate-return_value are created to represent the formal arguments and the return value for the function. The return value is dependent on the actuals of the first argument. Initially both argument values are empty, but once they are determined, the return value can be computed.
Afcer local pointer analysis at one call point, the relationship of the pseudo variables for accumulate ~ ~ ~ 0 8 ~ 2 .

are as follows:

accumulate-argl -> list if actual values of argl accumulate-arg2 -> list of actual values of arg2 accumulate-return_value-> accumulate-argl, &local accumulator The same steps are taken to define a global alias graph and pseudo pointer variables for the main function. Afcer local pointer analysis, the relationship of the pseudo variables representing the formal arguments and return value are:

accumulate-argl -> &acc accumulate-arg2-> &arr global ptr -~ accumulate-return_value .

These two global pointer alias graphs are combined to form the universal graph (blocks 60, 62, Figure 3) with the following relationship:

accumulate-argl -> &acc accumulate-arg2-> &arr global ptr-> accumulate-return_value accumulate-return_value -> accumulate-argl, &local_accumulator Following transitive closure (block 64), the graph is reduced to:
~5 accumulate-argl -> &acc accumulate-arg2-> &arr global pfr-> &acc, &local_accumulator 2 2 û 0 8 1 2 accumulate-return_value-> &acc, &local accumulator In this simple example, the rem~ining steps in Figure 3 have been dispensed with because there are no nodes ~ g in the graph representing an indirect call point (blocks 66, 76). The information 5 in the reduced graph is saved (block 80) for use in further op~ liz~lion or in re-compilation (block 82).

Further modifications to the invention that would be obvious to those skilled in the art are intended to be covered within the scope of the appended claims.

Claims (8)

1. A method, during compilation, for optimizing a program containing indirect function calls, comprising:
constructing, in each compilation unit, a data set of intraprocedural definitions for each referenced pointer in the compilation unit;
combining the data sets from all compilation units to construct a universal data set;
performing transitive closure to eliminate redundant definitions and reduce the universal data set; and recompiling the program using said reduced universal data set.
2. The method, according to claim ], wherein each data set comprises a set of objects associated with a pointer variable for each reference to that pointer variable.
3. The method, according to claim 2, wherein each data set comprises a pointer alias graph developed through data flow graphing.
4. The method, according to claim 1, further comprising the step of replacing definitions for indirect calls in the reduced universal data set with definitions for direct function calls prior to recompilation.
5. The method, according to claim 1, wherein the step of recompiling the program includes resolving all occurrences where pointers are dereferenced.
6. A program storage device readable by machine tangibly embodying a program of instructions executable by the machine to perform methods steps for optimizing a program containing indirect function calls during compilation, said method steps comprising:

constructing, in each compilation unit, a data set of intraprocedural definitions for each referenced pointer in the compilation unit;
combining the data sets from all compilation units to construct a universal data set;
performing transitive closure to eliminate definitions and reduce the universal data set; and recompiling the program using said reduced universal data set.
7. The program storage device, according to claim 6, wherein said method steps further comprise the step of replacing definitions for indirect calls in the reduced universal data set with definitions for direct function calls prior to recompilation.
8. In a two-pass optimizing compiler adapted to gather intraprocedural function information during an initial compilation pass, a method for reducing pointer alias sets for use in a program recompilation comprising:
construct a local pointer alias graph for each function based on the information gathered in the initial compilation pass wherein nodes in the graph represent all pointer definitions and uses in the function and wherein each node has an associated local pointer alias set;
for any node containing a value that is not an object address, compute immediate reaching definition alias sets and replace that value with a union of the immediate reaching definition alias sets;
perform transitive closure on all local pointer alias sets;
replace local pointer alias sets with resolved local pointer alias sets;
reduce number of nodes in the local pointer alias graph;
merge all definition nodes from all local pointer alias graphs into a single definition node and corresponding pointer alias set to create a universal pointer alias graph for each pointer;
perform transitive closure on each universal pointer alias graph; and resolve indirect callpoints and perform transitive closure on each universal pointer alias graph.
CA002200812A 1997-03-24 1997-03-24 Optimizing compilation of pointer variables Abandoned CA2200812A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CA002200812A CA2200812A1 (en) 1997-03-24 1997-03-24 Optimizing compilation of pointer variables
US08/956,416 US6173444B1 (en) 1997-03-24 1997-10-23 Optimizing compilation of pointer variables in the presence of indirect function calls
JP10053063A JPH10269088A (en) 1997-03-24 1998-03-05 Method for optimizing compile of pointer variable

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CA002200812A CA2200812A1 (en) 1997-03-24 1997-03-24 Optimizing compilation of pointer variables

Publications (1)

Publication Number Publication Date
CA2200812A1 true CA2200812A1 (en) 1998-09-24

Family

ID=4160233

Family Applications (1)

Application Number Title Priority Date Filing Date
CA002200812A Abandoned CA2200812A1 (en) 1997-03-24 1997-03-24 Optimizing compilation of pointer variables

Country Status (3)

Country Link
US (1) US6173444B1 (en)
JP (1) JPH10269088A (en)
CA (1) CA2200812A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2092424A2 (en) * 2006-10-19 2009-08-26 Checkmarx Ltd. Locating security vulnerabilities in source code
US9141806B2 (en) 2010-08-24 2015-09-22 Checkmarx Ltd. Mining source code for violations of programming rules
US11087002B2 (en) 2017-05-10 2021-08-10 Checkmarx Ltd. Using the same query language for static and dynamic application security testing tools
US11836258B2 (en) 2020-07-28 2023-12-05 Checkmarx Ltd. Detecting exploitable paths in application software that uses third-party libraries

Families Citing this family (47)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11237980A (en) * 1998-02-20 1999-08-31 Hitachi Ltd Device and method for generating object-orientated optimized code
US6481007B1 (en) * 1999-06-03 2002-11-12 Oracle Corporation Optimizing parameter passing
US20020010911A1 (en) * 2000-02-16 2002-01-24 Ben-Chung Cheng Compile time pointer analysis algorithm statement of government interest
US6665865B1 (en) * 2000-04-27 2003-12-16 Microsoft Corporation Equivalence class based synchronization optimization
CA2321016A1 (en) * 2000-09-27 2002-03-27 Ibm Canada Limited-Ibm Canada Limitee Interprocedural dead store elimination
US7111283B2 (en) * 2000-11-29 2006-09-19 Microsoft Corporation Program history in a computer programming language
US6925636B2 (en) * 2001-03-20 2005-08-02 International Business Machines Corporation Method and apparatus for refining an alias set of address taken variables
US7062759B2 (en) * 2001-04-19 2006-06-13 Intel Corporation Method and system for interprocedural side effect analysis
US7165245B2 (en) * 2001-04-27 2007-01-16 Intel Corporation Pruning local graphs in an inter-procedural analysis solver
US7237237B2 (en) * 2001-07-24 2007-06-26 The Mathworks, Inc. Designating an object for destruction
US20030074655A1 (en) * 2001-09-27 2003-04-17 Robison Arch D. Method and apparatus for alias analysis for restricted pointers
US20030101442A1 (en) * 2001-09-28 2003-05-29 Youfeng Wu Method, apparatus, and system to formulate regions of reusable instructions
US7117490B2 (en) * 2001-10-11 2006-10-03 Intel Corporation Method and apparatus for doing program analysis
US7257808B2 (en) * 2002-01-03 2007-08-14 Intel Corporation System and method to reduce the size of source code in a processing system
US7127710B2 (en) * 2002-06-24 2006-10-24 Intel Corporation Identifying pure pointers to disambiguate memory references
US7275242B2 (en) * 2002-10-04 2007-09-25 Hewlett-Packard Development Company, L.P. System and method for optimizing a program
US7814467B2 (en) * 2004-01-15 2010-10-12 Hewlett-Packard Development Company, L.P. Program optimization using object file summary information
US7472382B2 (en) * 2004-08-30 2008-12-30 International Business Machines Corporation Method for optimizing software program using inter-procedural strength reduction
US8392900B1 (en) * 2005-03-17 2013-03-05 Hewlett-Packard Development Company, L.P. Methods and systems for barrier reduction in parallel processing systems
US20060250352A1 (en) * 2005-05-05 2006-11-09 Mice Technoligies, Inc. System and method for improved cursor functionality
US7743370B1 (en) * 2005-10-17 2010-06-22 Unisys Corporation System and methods for determination of independence of sub-graphs in a graph-based intermediate representation of program instructions
WO2007085121A1 (en) * 2006-01-26 2007-08-02 Intel Corporation Scheduling multithreaded programming instructions based on dependency graph
US8117604B2 (en) * 2006-07-31 2012-02-14 International Business Machines Corporation Architecture cloning for power PC processors
US8601456B2 (en) * 2006-08-04 2013-12-03 Microsoft Corporation Software transactional protection of managed pointers
US8327327B2 (en) * 2007-03-21 2012-12-04 Carnegie Mellon University Method for statically checking an object-oriented computer program module
US8484629B2 (en) * 2007-05-24 2013-07-09 Microsoft Corporation Programming model for modular development
US8332833B2 (en) * 2007-06-04 2012-12-11 International Business Machines Corporation Procedure control descriptor-based code specialization for context sensitive memory disambiguation
US20090019433A1 (en) * 2007-07-10 2009-01-15 International Business Machines Corporation Method and system for describing whole-program type based aliasing
US8056066B2 (en) * 2007-08-22 2011-11-08 International Business Machines Corporation Method and apparatus for address taken refinement using control flow information
US20100192026A1 (en) * 2009-01-27 2010-07-29 Microsoft Corporation Implementations of program runtime checks
US20110050273A1 (en) * 2009-08-25 2011-03-03 Ssu-Pin Ma Fast testable wafer and wafer test method
US8566944B2 (en) 2010-04-27 2013-10-22 Microsoft Corporation Malware investigation by analyzing computer memory
US10241763B2 (en) * 2014-12-10 2019-03-26 Microsoft Technology Licensing, Llc. Inter-procedural type propagation for devirtualization
US9703537B2 (en) 2015-11-02 2017-07-11 International Business Machines Corporation Method for defining alias sets
US10216496B2 (en) * 2016-09-27 2019-02-26 International Business Machines Corporation Dynamic alias checking with transactional memory
US10108406B2 (en) * 2016-10-24 2018-10-23 International Business Machines Corporation Linking optimized entry points for local-use-only function pointers
US10108404B2 (en) * 2016-10-24 2018-10-23 International Business Machines Corporation Compiling optimized entry points for local-use-only function pointers
US10108407B2 (en) * 2016-10-24 2018-10-23 International Business Machines Corporation Loading optimized local entry points for local-use-only function pointers
US10169016B2 (en) * 2016-10-24 2019-01-01 International Business Machines Corporation Executing optimized local entry points
US10360005B2 (en) * 2016-10-24 2019-07-23 International Business Machines Corporation Local function call tailoring for function pointer calls
US10534593B2 (en) * 2016-10-24 2020-01-14 International Business Machines Corporation Optimized entry points and local function call tailoring for function pointers
US10169011B2 (en) * 2016-10-24 2019-01-01 International Business Machines Corporation Comparisons in function pointer localization
US11184312B1 (en) 2019-09-26 2021-11-23 Joinesty, Inc. Email alias generation
CN110795106B (en) * 2019-10-30 2022-10-04 中国人民解放军战略支援部队信息工程大学 Dynamic and static combined memory alias analysis processing method and device in program vectorization process
US11435987B2 (en) 2019-12-24 2022-09-06 Advanced Micro Devices, Inc Optimizing runtime alias checks
TWI776338B (en) * 2020-12-30 2022-09-01 國立成功大學 Compiler adapted in graph processing unit and non-transitory computer-readable medium
US11924169B1 (en) 2021-01-29 2024-03-05 Joinesty, Inc. Configuring a system for selectively obfuscating data transmitted between servers and end-user devices

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4567574A (en) * 1983-03-14 1986-01-28 International Business Machines Corporation Optimizing cobol object code instruction path length with respect to perform statements
US5448737A (en) * 1992-03-17 1995-09-05 International Business Machines Corporation System and method for optimizing computer code using a compact data flow representation
US5555412A (en) * 1992-12-09 1996-09-10 International Business Machines Corporation Complier and method for alias checking in a complier
JPH06348475A (en) 1993-06-14 1994-12-22 Nec Corp Pointer analyzing system
US5535394A (en) * 1993-10-20 1996-07-09 International Business Machines Corporation Methods for distinguishing dynamically allocated storage along different call paths and for providing a compact representation of alias analysis

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2092424A2 (en) * 2006-10-19 2009-08-26 Checkmarx Ltd. Locating security vulnerabilities in source code
EP2092424A4 (en) * 2006-10-19 2011-11-02 Checkmarx Ltd Locating security vulnerabilities in source code
US9128728B2 (en) 2006-10-19 2015-09-08 Checkmarx Ltd. Locating security vulnerabilities in source code
US9141806B2 (en) 2010-08-24 2015-09-22 Checkmarx Ltd. Mining source code for violations of programming rules
US11087002B2 (en) 2017-05-10 2021-08-10 Checkmarx Ltd. Using the same query language for static and dynamic application security testing tools
US11836258B2 (en) 2020-07-28 2023-12-05 Checkmarx Ltd. Detecting exploitable paths in application software that uses third-party libraries

Also Published As

Publication number Publication date
US6173444B1 (en) 2001-01-09
JPH10269088A (en) 1998-10-09

Similar Documents

Publication Publication Date Title
US6173444B1 (en) Optimizing compilation of pointer variables in the presence of indirect function calls
Briggs et al. Practical improvements to the construction and destruction of static single assignment form
Krall Efficient JavaVM just-in-time compilation
Lhoták et al. Points-to analysis with efficient strong updates
Lee et al. Basic compiler algorithms for parallel programs
Steensgaard Points-to analysis by type inference of programs with structures and unions
US6381738B1 (en) Method for optimizing creation and destruction of objects in computer programs
US7120898B2 (en) Intermediate representation for multiple exception handling models
Wall Global register allocation at link time
Hall Managing interprocedural optimization
Gerndt Updating distributed variables in local computations
Paleczny et al. The java {HotSpot™} server compiler
US6530079B1 (en) Method for optimizing locks in computer programs
Demartini et al. dSPIN: A dynamic extension of SPIN
US6665865B1 (en) Equivalence class based synchronization optimization
USRE38104E1 (en) Method and apparatus for resolving data references in generated code
US20020166115A1 (en) System and method for computer program compilation using scalar register promotion and static single assignment representation
US6009273A (en) Method for conversion of a variable argument routine to a fixed argument routine
US7814467B2 (en) Program optimization using object file summary information
Shao et al. Efficient and safe-for-space closure conversion
US20060107258A1 (en) Program, program code optimization method, program code compile method, program code, and information processing system
Hornof et al. Accurate binding-time analysis for imperative languages: Flow, context, and return sensitivity
Stefanescu et al. An equational framework for the flow analysis of higher order functional programs
Palermo et al. Interprocedural array redistribution data-flow analysis
Zheng et al. Designing the agassiz compiler for concurrent multithreaded architectures

Legal Events

Date Code Title Description
EEER Examination request
FZDE Discontinued