A Gcc Compiler Server

Per Bothner

Apple Computer


May 2003
Classic compiler structure
Slow compilation
Re-reading header files
Inter-module optimization
This is work-in-progress
Multi-input mode
Server mode
Re-using text, tokens, or trees?
Dependencies and invalidation vs re-use
Inconsistent header file use
Extended one-definition rule
cpplib fragment handling
Remembering and restoring declarations
Fragment/nesting overlap
Non-nesting example
//  fragment 1
extern void F1(T1);

struct St {
  int value;
#ifdef __cplusplus
//  fragment 2
  int getValue() { return value; }
//  fragment 3

extern void F2(T2);
Handling non-nesting
Other complications
Preliminary results
  1. Multiple trivial identical C programs. Each just includes Carbon.h, which includes many of Apple's GUI headers.
    After initial compile, subsequent files 3 times as fast as without server.
  2. Compiling a mix of medium-sized gcc ,c is over 30% faster using client+server.
  3. Compiling 9 Tcl .c files yields similar speed-up.
Conclusion and status