A method of identifying pseudo-invariant instructions in computer program hot
paths,
comprising the steps of creating an intermediate representation of a hot path in
a software buffer, executing instructions in the program image for the computer
program until a hot path is detected, copying computer machine state and computer
processor register contents to a context in memory, and using this context to compute
an output a plurality of times for each instruction in the hot path using an interpreter
that emulates the computer processor. Results of the interpreter computations are
stored with the frequency count for each unique output in a table that is readable
by a program optimizer. Frequency counts for each instruction are compared with
a pseudo-invariant threshold to classify an instruction as pseudo-invariant.