Safeness of Make-Based Incremental Recompilation Niels Jørgensen Roskilde University, Denmark.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Advertisements

Semantics Static semantics Dynamic semantics attribute grammars
Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
1 Dependent Types for Termination Verification Hongwei Xi University of Cincinnati.
Formal Semantics of Programming Languages 虞慧群 Topic 5: Axiomatic Semantics.
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Logic.
Efficient Query Evaluation on Probabilistic Databases
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
CS 355 – Programming Languages
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
1 Basic abstract interpretation theory. 2 The general idea §a semantics l any definition style, from a denotational definition to a detailed interpreter.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Computer Science CS425/CS6258/23/20011 The Architecting Phase Class diagrams are further refined in this phase of development Object diagrams are created.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Purpose of Database Systems View of Data Data Models Data Definition.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Describing Syntax and Semantics
Dr. Kalpakis CMSC 461, Database Management Systems Introduction.
Research in Compilers and How it Relates to Software Engineering Part III: Relation to SE Tomofumi Yuki EJCP 2015 June 22, Nancy.
Formal Methods 1. Software Engineering and Formal Methods  Every software engineering methodology is based on a recommended development process  proceeding.
PROGRAMMING LANGUAGES The Study of Programming Languages.
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
Chapter 1 : Introduction §Purpose of Database Systems §View of Data §Data Models §Data Definition Language §Data Manipulation Language §Transaction Management.
Chapter 13 Programming in the Large Dr. Jiung-yao Huang Dept. Comm. Eng. Nat. Chung Cheng Univ. TA: 鄭筱親 陳昱豪.
Formal Semantics of Programming Languages 虞慧群 Topic 3: Principles of Induction.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Purpose of Database Systems View of Data Data Models Data Definition.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
Verification of behavioural elements of UML models using B Truong, Ninh-Thuan and Souquieres, Jeanine In Proceedings of the 2005 ACM Symposium on.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
ISBN Chapter 3 Describing Semantics.
Semantics In Text: Chapter 3.
Syntax and Semantics CIS 331 Syntax: the form or structure of the expressions, statements, and program units. Semantics: the meaning of the expressions,
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
Specifying Languages Our aim is to be able to specify languages for use in the computer. The sketch of an FSA is easy for us to understand, but difficult.
Programming Fundamentals Lecture No. 2. Course Objectives Objectives of this course are three fold 1. To appreciate the need for a programming language.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Reasoning about the Behavior of Semantic Web Services with Concurrent Transaction Logic Presented By Dumitru Roman, Michael Kifer University of Innsbruk,
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
Programming Language Descriptions. What drives PL Development? Computers are “in charge” of extremely important issues Execute a program literally. Exercise.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
Multiple File Compilation and linking By Bhumik Sapara.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Announcements Assignment 1 will be regraded for all who’s score (not percentage) is less than 6 (out of 65). If your score is 6 or higher, but you feel.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Introduction to DBMS Purpose of Database Systems View of Data
SDN Network Updates Minimum updates within a single switch
Chapter 8: Concurrency Control on Relational Databases
Chapter 1: Introduction
Daniel Amyot and Jun Biao Yan
Programming Languages and Compilers (CS 421)
Programming Languages 2nd edition Tucker and Noonan
Semantics In Text: Chapter 3.
Introduction to DBMS Purpose of Database Systems View of Data
Chapter 1: Introduction
Programming Languages and Compilers (CS 421)
Chapter 1: Introduction
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

Safeness of Make-Based Incremental Recompilation Niels Jørgensen Roskilde University, Denmark

Plan of talk What is make ? The safeness problem The result ● Criteria for rules: completeness, fairness, and soundness ● Editing constraints ● Applications The formal model & related work Questions for further work

What is make ? pgm library.a codegen.oparser.o parser.c parser.ydefinitions.hcodegen.c The purpose of make is to support incremental recompilation ● only dependent-on files are recompiled ● "cascading" recompilation (along chains of dependency) ● crude approach, change of comment spurs recompilation

What is make ? make = the make program ● reads and executes makefiles make can be defined by ● the syntax of makefiles ● the semantics of their execution make is widely used in large software projects ● syntax and semantics is as in late 70s

What is make : syntax of makefiles Makefile = ● makefile rules ● plus more which is omitted from model (macros, directives..) Syntax of a makefile rule: G : D 1 D 2.. D n C list of dependency targets command derived target

What is make : Semantics of makefile execution G : D 1 D 2.. D n C If file G is older than one or more of the files D 1 D 2.. D n (i.e. rule is unsatisfied) then execute command C (i.e. rule "fires") Bottom-up order ● a rule is evaluated after the rules defining its dependencies

The basic problem: when is make 's optimization safe ? "safeness of make -based incremental recompilation" = Assume ● there is an initial brute-force compilation Then, after editing, ● make -based incremental recompilation is "as good as" a (second) brute-force compilation. Given the semantics of make, what criteria apply to ● formulation of makefile rules (cf. Mozilla) ? ● editing of source files, and makefile ● generically, independent of C Not addressed previously

The basic problem: Software developers do not trust make For example, the Mozilla browser is built twice - incrementally and brute-force: ".. to make sure our dependencies are right, and out of sheer paranoia.. " ( May )

The result: rules of thumb for the makefile programmer Build rules must be: Complete: ● The rule's dependency list D 1 D 2.. D n must contain all the files that the rule's target G depends on Fair: ● Executing the rule's command C may not create or update any target other than the rule's own Sound: ● Upon executing C, the rule must be satisfied, and its parent rules must be unsatisfied G : D 1 D 2.. D n C

The result: criteria for editing Incremental recompilation is desirable not only after editing of source files but also when the makefile is modified (although rare) Deletion of a makefile rule is safe ● always Addition of a makefile rule is safe ● if the new rule's target does not exist Modifying a rule if safe ● cf. deletion + addition ● or if change is restricted to dependency list Any combination is permitted

The result: example pgm library.a codegen.o parser.o parser.c parser.ydefinitions.hcodegen.c functions.o functions.c Modification: ● part of codegen.c moved to new file functions.c ● add rule defining functions.o + modify rule defining pgm

The result: precise criteria for makefiles For example, completeness: Rule R is complete in state S iff for any state S' equivalent to S on (D 1 D 2.. D n ): (exec C S' G) is equivalent to (exec C S G) where (roughly) ● a state is the current state of file system ● equivalence is defined in terms of file contents, not time stamps Completeness is with respect to a given state ● verification that a makefile for e.g. a C program is correct requires knowledge of the source files ● i.e., all recursively included header files G : D 1 D 2.. D n C R =

Formal model & related work: level of abstraction Formal make -model abstracts away: ● any knowledge of the effect of execution of rule commands ● details of satisfiability (e.g., t < t' or t =< t') Related work on incremental recompilation requires knowledge of language under compilation ● smart recompilation (Pascal) (Tichy, 86) ● variant of s.r. in ML Kit with Regions compiler (Elsman, 86) ● syntax directed editors (Deters + Reps + Teitelbaum, 81) Such language-specific approach is more fine-grained ● e.g., modification of comments do not lead to recompilation

Formal model & related work: semantics of make Semantics of make resembles (propositional) logic programming ● query driven ● no global variables Denotational definition of make resembles definition given for (constraint) logic programs (Marriott + Søndergaard, 88)

Formal model: anatomy of proofs Goal is to prove equivalence of incremental and brute-force compilation, i.e. of various ● sequences of command executions ● interleaved with editing Under appropriate conditions, ● commands are idempotent: (exec C) equiv. (exec C; C) ● commands commute: (exec C C') equiv. (exec C' C) ● this is combined to show equivalence of complex sequences Editing is required to preserve "partial safeness" ● for any rule, the files are unedited or else the rule must fire

Conclusion and future work Criteria for safeness have been established, provide basis for ● guidelines for makefile programmers ● verification of makefile tools Practical benefit: ● slightly improved use, of widely used tool Future work on the make model ● can (part of) the formal model be seen as an instance of an existing formalism ? ● is it possible to weaken the criteria for safeness, e.g. the definition of rule completeness ? ● error handling: upon abort of make due to compilation failure, is incremental recompilation safe ?