Optimizing Squeak
johnm at wdi.disney.com
johnm at wdi.disney.com
Wed Feb 24 22:09:20 UTC 1999
Carl Watts <Carl at AppliedThought.com> wrote:
> Not if the bytecode is used to index into a 256 element jump-table. In this case there is no need for an array-bounds check and there are no conditional branches so no branch mispredictions can occur.
You are right, Carl, most compiler generate an unneeded bounds-check
in Squeak's bytecode dispatch loop (which is a 256-way case statement). It is
pretty easy to write a small patch program in Squeak that finds the instruction
sequence for the bytecode dispatch and patches out the unneeded check. We've
written such a program for the PPC, but I don't believe there are patchers
for most of the other Squeak platforms. As I recall, patching out the
bounds check speeds up the PPC VM by about 15-20% on bytecode-heavy
benchmarks. Folks maintaining other VM's might want to look into this
technique. (It only takes a few hours of studying assembly code listings to
figure out how to do this for a new architecture. See
Interpreter class>patchInterp:
for an example of how to do it.
-- John
More information about the Squeak-dev
mailing list
|