Skip to content

sebmarchand/syzygy

Repository files navigation

Syzygy is a suite of tools to perform post-link instrumentation and optimization of 32-bit Windows binaries. It consists of the following components:

  • The instrumenter tool reads a 32-bit PE image file and its symbol information, and writes an instrumented version of the image file to disk.
  • The various agents export hooks that are called by the instrumented binaries for various purpose. This can be for gathering function- or basic-block-level profile data, or for finding memory bugs.
  • The agent_logger is a high throughput blocking (no data is lost) RPC-based logging service that agents use to get data out of an instrumented process.
  • The grinder tools aggregates log files, and analyzes them to produce summary results. This may consist of code coverage results, a heat map, memory usage stats, etc.
  • The orderer tool processes function-entry log files and generates a function-level ordering of the image, designed to minimize page loads.
  • The relinker and optimizer tools use aggregate input generated by grinder and orderer and apply them to generate an optimized version of the input binary.

By capturing and processing a full trace of the functions invoked and their process/thread affinity, the ordering generator can discover not only temporal function relationships, but also process or thread specific clusterings. For Chrome in particular, it stands to reason that the browser process will behave very differently than a renderer process which will again behave differently than a plugin host process.

By doing post-link reordering of the binaries, Syzygy gains full control over the order of the final image file, which allows the toolchain to attain the best possible results. This comes at the cost of some implementation complexity; see the detailed design for details.