A source code file can be compiled to generate bytecode. During
compilation, a first use of a local variable within a set of instructions
of the source code can be detected. A local variable usage list can be
examined for at least one inactive local variable in use by the set of
instructions. An existence of an acceptable type pairing between a type
descriptor corresponding to a local variable and a type descriptor of the
local variable may be determined. When the acceptable type pairing
exists, an index of the local variable array corresponding to the
determined acceptable type pairing for the local variable can be reused.
Otherwise, a new index can be assigned for the local variable. Compiling
bytecode in this manner avoids extraneous class loads that would
otherwise occur during a verification phase of the bytecode, which has
still been optimized to reuse local variable slots.