Patent ID: 8245206

Claim:
A system for string concatenation in a virtual machine environment, comprising: a computer including a microprocessor; a virtual machine on the computer, for executing a software application, wherein the software application includes one or more operations for concatenating strings; a memory space for storing the software application as bytecode; a string concatenation structure provided as a fixed array having a maximum capacity associated therewith, for use by the virtual machine in concatenating the strings; and a bytecode compiler, comprising a string concatenation sequence detector, wherein the bytecode compiler detects, within the software application, the operations for concatenating strings, and creates, within the fixed array, pointers to string objects that are to be concatenated, including storing each pointer in a next available position within the fixed array, determines that a new concatenated string should be created that includes the strings to be concatenated, iterates through the pointers in the fixed array, and sums the length of those strings pointed thereto, allocates a single allocation for the new concatenated string, and copies the contents of those strings pointed to by the pointers in the fixed array, to the new concatenated string; wherein the bytecode compiler selectively reduces chains of concatenation calls, by detecting during compilation of the software application one or more chains of concatenation calls synthesizing descriptors from a detected chain, starting with a longest possible descriptor, and gradually decreasing a number of arguments until an appropriate append function can be determined, and replacing the chain of concatenation calls with a single concatenation call including the determined append function.