In one embodiment of the present invention an interpreted language, such
as, for example, Java, is selectively optimized by partitioning the
interpreted language code (98) into a plurality of blocks (80-83) based
on the complexity of each of the interpreted language instructions. In
one embodiment of the present invention, each of the plurality of blocks
is identified as either a block to be compiled into native code (80-82)
if the block is simple, or a block to be interpreted (83) if the block is
complex. The compiled and interpreted blocks are appended to form in-line
mixed code (99) that contains both native code (90-92) and interpreted
language code (93). This mixed code is formed before run-time, so that no
further compilation is required at run-time. A processing unit (102) may
be used to execute the native code directly without the use of a Java VM
(10), while also executing, in-line, the interpreted language code (93)
which requires use of the Java VM (10) to interpret the Java bytecodes.