1. An optimization apparatus for optimizing a program by reusing an execution result of a subclass test function included in an execution-target program, the optimization apparatus comprising: a storage device; a reusability determining unit configured to determine reusability of code called by a function call of said subclass test function included in said execution-target program on the basis of whether or not access to a global memory within said code includes only access for reading out type information specified in said function call and information traceable from said type information; a profiling unit configured to store an execution result of code determined to be reusable and specified information specified in said function call of said code in a storage device as profile information of said code, in association with type information actually accessed within said code; a reuse processing unit configured to read out, in response to detection of a function call of a subclass test function that calls said code determined to be reusable, the profile information of said code from said storage device, and configured to reuse said execution result of said profile information provided that the specified information of said profile information matches specified information specified in said detected function call; and a monitoring unit configured to monitor said type information associated with said execution result included in said profile information stored in said storage device, and configured to prohibit, in response to a change made to said type information, reuse of said execution result associated with said type information, wherein to prohibit the reuse of the execution result, said monitoring unit deleting the profile information associated with the change made to the type information and inserting an instruction sequence that invalidates the reuse of the execution result.