Patent ID: 7739674

Claim:
In a virtual machine executing on a host processor, a method for selectively optimizing interpreted language code, comprising: receiving interpreted language code comprising interpreted language instructions; partitioning the interpreted language code into a performance-crucial block and a non-performance crucial block; and partitioning the interpreted language code of the performance-crucial block into a plurality of blocks based on a complexity of each of the interpreted language instructions, wherein the complexity of the interpreted language instructions is related to dependencies on virtual machine services and unrelated to execution frequency of the interpreted language instructions; identifying a first block of the plurality of blocks as a block to be compiled based on the first block including one or more simple instructions that are independent of virtual machine services and a second block of the plurality of blocks as a block to be interpreted based on the second block being dependent on virtual machine services; creating mixed code, said mixed code comprising native instructions and interpreted language instructions, wherein creating said mixed code comprises: compiling the first block before run-time; appending the compiled first block to the mixed code, wherein the compiled first block includes a plurality of native instructions that, when executed, do not depend on the virtual machine services; and appending the second block to the mixed code, wherein the second block comprises a plurality of interpreted language instructions wherein one or more of the plurality of interpreted language instructions depend on the virtual machine services, wherein run-time compilation of the first block is never required when using this method, and wherein, in the mixed code, the interpreted language instructions are in-line with the native instructions.