For dynamic optimization systems, success is limited by two difficult
problems arising from instruction reordering. Following optimization
within and across basic block boundaries, both the ordering of
exceptions and the observed processor register contents at each
exception point must be consistent with the original code. While
compilers traditionally utilize global data-flow analysis to determine
which registers require preservation, this analysis is often
infeasible in dynamic optimization systems due to both strict
time/space constraints and incomplete code discovery.
This paper presents an approach called Precise Speculation that
addresses these problems. The proposed mechanism is a component of
our vision for Run-time Optimization ARchitecture, or ROAR, to support
aggressive dynamic optimization of programs. It utilizes a hardware
mechanism to automatically recover the precise register states when a
deferred exception is reported, utilizing the original unoptimized
code to perform all recovery. We observe that Precise Speculation
enables a dynamic optimization system to achieve a large performance
gain over aggressively optimized base code, while preserving precise
exceptions. For an 8-issue EPIC processor, the dynamic optimizer
achieves between 3.6% and 57% speedup over a full-strength
optimizing compiler that employs profile-guided optimization.