Indirect method invocation of methods that only return constant values is
optimized using fetching operations and return constant tables. Such method calls
can be optimized if all possible method calls via the call site instruction return
a constant value and have no side effects. Each constant return value is loaded
from a return constant table, and method invocation is eliminated. If all possible
target methods in a program result in a constant return value and have no side
effects, an associated virtual function dispatch table (vtable) may be used as
the return constant table. Furthermore, control operation optimization may be applied
to identify type constraints, based on one or more possible type-dependent constant
return values from an indirect method invocation. An optimizer identifies and maps
between a restricted set of values and an associated restricted set of types on
which execution code may operate relative to a given control operation. The type
constraints are used to optimize the associated execution code by filtering propagation
of runtime type approximations for optimization.