130 likes | 515 Views
Incremental Compilation. Jonathan Bachrach MIT AI Lab. Problem. Do less work than full recompile Produce same result as full recompile. Solution. Change something in source Change all output that would be different Leave others alone Track dependencies between output and source.
E N D
Incremental Compilation Jonathan Bachrach MIT AI Lab
Problem • Do less work than full recompile • Produce same result as full recompile
Solution • Change something in source • Change all output that would be different • Leave others alone • Track dependencies between output and source
Fun-O-Dylan Approach • Source broken up into source records • Compiler takes source records in and produces bits out
Source Records • Source is broken up into sequence of source records • Each source record contains some contiguous source text • File • Top-level-form
Compilation Phases • Parsing => forms + bindings • Modeling => compile-time models • Conversion => IR • Optimization => IR (method dispatch …) • Code Gen => bits • Linking => bits
Compilation Records • Contain compilation products • One compilation record per source record
Top Level Forms • Object-oriented and syntactic representation of programmatic forms occurring at top level • init-world(); -- top level call • define method … end; -- method definition • define class … end; -- class definition • Registered in compilation records in order • Contains all information for each form • Signatures • Superclasses • Defined bindings • Definitions are binding defining top-level-forms
Bindings • Objects representing global variables • Contain • Name • Home module • Defining definitions • Dependencies
Dependencies • Record bindings for given stage depended on
Incremental Recompilation • Remembers last source records • Computes source record diff to say which source records have changed or been added • When source record diffs • Compile it and • Rerun any phases of records dependent on it • by examining deps on all bindings defined by it • Can increase precision by decreasing size of record • From say file to top-level-form size
Other Systems • SmallEiffel • Eiffel to C compiler • Most time is spent in C compilation • Recompute all C each time • Only recompile C that diffs
Interactive Compilation • Live incremental compilation • Must patch running system • Difficult in the face of optimization