Patent ID: 7451437
Filing Date: 2008-11-11
Classification: G06F

Abstract:
1. A compiler device for optimizing a program which manipulates a character string, the compiler device comprising: a processor including at least an append instruction detection unit for detecting an append instruction to append a character string to a string variable for storing a character string, in the program; the processor further including a store code generation unit for generating, as a substitute for each of a plurality of the append instructions detected by the append instruction detection unit, a store code for storing data of an appendant character string to be appended to the string variable by the append instruction into a buffer, the plurality of append instructions appending the character strings to the same string variable; and the processor further including an append code generation unit for generating an append code for appending a plurality of the appendant character swings to the string variable, at a position to be executed before an instruction to refer to the string variable in the program; and the processor further including a reference instruction detection unit for detecting a reference instruction which first refers to the string variable after the character strings have been appended to the string variable by the plurality of append instructions, wherein the append code generation unit generates the append code at a position to be executed after the store codes and before the reference instruction; wherein the append instruction detection unit detects, as the append instruction, a combination of: an instruction to convert an immutable string variable in which a process of appending a character string is not allowed, into a mutable string variable in which a process of appending a character string is allowed; an instruction to append the appendant character string to the mutable string variable; and an instruction to convert the mutable string variable into the immutable string variable.