Using Compilers to Automatically Improve Software Quality and Performance
Compilers play an essential role in software development: besides generating machine code, they analyze programs for errors and optimize programs for better performance. But as software systems have become more sophisticated, traditional compilers no longer provide the support that programmers need. First, compilers do not detect any of the critical errors that plague modern systems, such as protocol errors and security vulnerabilities. Second, compiler optimizations have, to a large extent, already reached the limit of their ability to speed up programs. The root cause of these deficiencies is that traditional compilers operate at the wrong level of abstraction. They continue to focus on low-level language primitives, while the most important errors and the most significant optimization opportunities are found at higher levels of abstraction. In this talk I present two techniques that push compilers beyond these limitations.
First, I present the Broadway compiler, a new kind of configurable compiler that leverages the semantics of libraries to perform high- level program analysis and optimization. Using Broadway we can detect a significant class of programming errors that result from the improper or insecure use of system libraries. In addition, we introduce a new analysis algorithm, called client-driven analysis, which achieves high accuracy at a low cost by automatically adapting its precision. Second, I describe recent work on compiler-assisted memory management for Java. Modern programming languages include sophisticated run-time systems, such as garbage collectors, that can have a dramatic effect on program performance. We introduce a new cooperative optimization called dynamic object colocation, which uses compiler analysis to gather information about a program's data structures and pass it to the garbage collector. This information allows the allocator to place connected objects together in memory, reducing garbage collection time by 50% to 75%.