Type Specialiser

Specialisation is an optimisation whereby code is modified to make it less general but faster for certain cases. In order to work well specialisation relies on what is called "Type stability", which is the assumption that the types (classes) of objects seen when the code is traced will be the same as the actual types encountered when the code is executed next time.

By making this assumption, general code, say for multiplication, can be replaced by more specialised code, for example for floating point multiplication. These specialised operations are usually much faster.

In order to operate correctly, guards must be included in the code, so that when th code encounters an object for which it is not specialised it can correctly fall back on the original, unoptimised code.

The specialised bytecode is then passed to the Deferred Object Creation pass.