[Prev][Next][Index][Thread]
PL seminar - Bob Burger
Programming Languages Seminar
Friday, Sept.27, 1996
8am-9am, LH 101
Profile-Driven Dynamic Recompilation in Scheme
Bob Burger
Compilers can use profile data to improve code generation. For
example, basic blocks can be reordered to reduce the number of
mispredicted branches. Although there are various heuristic
algorithms that estimate branch behavior statically, research has
demonstrated that profile-based prediction is significantly more
effective. Up to now the instrumentation for profiling and the
subsequent recompilation have not been done at run time. Instead,
programmers use a tedious compile-profile-recompile cycle.
This talk presents an infrastructure for dynamic recompilation in
Scheme. It capitalizes on the property that all the references to a
given Scheme object can be found and relocated during garbage
collection. Suppose a given procedure has been recompiled at run
time. The garbage collector can then relocate all references to the
original procedure so that they now refer to the recompiled one.
During collection, the original procedure is completely and
transparently replaced by the recompiled one.
As a proof of concept, edge-count profile data is used to reorder
basic blocks and to optimize profile counter placement. The profiler
properly handles non-local exit and re-entry by Scheme's call/cc. In
addition, the profile data can be graphically associated with the
original source to provide useful feedback to programmers.