Patent ID: 8307354

Claim:
A program generation apparatus, comprising: a non-transitory memory storing a program which when executed by a processor causes the program generation apparatus to operates as: an acquisition unit operable to acquire a 1st program including one or more instructions, the 1st program causing a process by executing the one or more instructions in a predetermined order to obtain a result; a generation unit operable to generate a 2nd program based on the 1st program; and an output unit operable to output the 2nd program, wherein the 2nd program causes a process that is different from a process caused by the 1st program and varies according to current information in order to obtain a result identical to the result of the 1st program, the current information being determined at execution of the 2nd program and varying upon each execution, the generation unit includes: a detection subunit operable to detect a plurality of parallel instructions among the one or more instructions of the 1st program, the plurality of parallel instructions having no dependency on each other; an identity instruction generation subunit operable to generate one or more identity instructions, each of which includes one or more instructions that (i) are different from one or more original instructions among the one or more instructions of the 1st program and (ii) output a result identical to a result output from the one or more original instructions; and a dummy instruction generation subunit operable to generate a dummy instruction that is an instruction having no influence on the result of the 2nd program, and the generation unit generates the 2nd program that causes the process by executing instructions equivalent to the one or more instructions of the 1st program (i) with instructions identical to the parallel instructions executed in an order varying according to the current information, (ii) with either one of the one or more instructions identical to the one or more original instructions or the one or more identity instructions executed, the one of the one or more original instructions and the one or more identity instructions being selected according to the current information, and (iii) in addition to the dummy instruction executed at a timing that varies according to the current information, and the generation unit further includes an identifier assigning subunit operable to assign identifiers to (i) the one or more instructions of the 1 st program, (ii) the one or more identity instructions generated by the identity instruction generation subunit, and (iii) the dummy instruction generated by the dummy instruction generation subunit, each of the identifiers uniquely identifying an instruction, and generates the 2 nd program that obtains instructions identified by identifiers, each of which matches a different element of a random number sequence generated according to the current information.