Primitive Sequences in General Purpose Forth Programs
David P. Gregg, John T. Waldron · 2002
Instruction dispatch is responsible for most of the running time of Forth interpreters, especially on modern pipelined processors. Superinstructions are an important optimisation to reduce the number of instruction dispatches. Superinstructions have been used for many years to optimise interpreters, but an open problem is the choice of superinstructions to include in the interpreter. In this paper we propose a number of heuristics for choosing superinstructions, and evaluate them for general purpose Forth programs. We find that static measures of frequency perform well for superinstruction selection. As few as eight superinstructions can reduce the number of instruction dispatches by an average of 15%, and reductions of up to 45 % are possible with large numbers of superinstructions. 1