1. A method in a data processing system for optimizing a program, the method comprising the steps of: automatically analyzing a statistical profile of a program execution; and automatically optimizing object code of the program based on at least one of the analysis, information about at least one prior compilation of the program, and information about at least one prior optimization of the program, wherein, said automatically optimizing includes determining that information additional to the statistical profile is required to optimize the object code of the program, performing a first compiling of a portion of the program, executing the first compiled portion of the program, gathering the information additional to the statistical profile, generating and executing diagnostic code based on the information additional to the statistical profile to determine what optimization is required, performing a second compiling of the portion of the program using the results generated from executing the diagnostic code, and selecting, from among a plurality of optimization techniques based on logical relations between said plurality of optimization techniques, a not previously tried one of the plurality of optimization techniques if a previously tried optimization technique was unsuccessful.