Patent ID: 8336039

Claim:
An apparatus for optimizing a Java object, comprising: a storage unit for storing a value of said object and management information on said object in association with each other; a code generation unit for generating, from said target computer program, optimized code that is optimized on the condition that said value of said object is constant, and unoptimized code that is to be executed in a case where said value of said object is changed; a switching unit for switching from executing said target computer program by using said optimized code to executing said target computer program by using said unoptimized code in response to an event in which said value of said object is written while said target computer program is executed by using said optimized code; and a management unit for managing said object by accessing said management information by a non-detection write operation in which writing to said object is performed without being detected; wherein when switching to executing said target computer program by using said optimized code, said switching unit places said object into an unprivileged write-disabled area of said storage unit where writing by a privileged write instruction is allowed to be performed without being detected while writing by an unprivileged write instruction is detected; said code generation unit translates said writing to said value of said object by said target computer program into said unprivileged write instruction; and said management unit processes said writing to said management information on said object by using said privileged write instruction; and wherein when switching to executing said target computer program by using said unoptimized code, said switching unit places said object into a write-enabled area of said storage unit where writing by said privileged write instruction and said unprivileged write instruction are allowed to be performed without being detected.