Systematic Editing: Generating Program Transformations from an Example Na Meng Miryung Kim Kathryn S. McKinley The University of Texas at Austin.

Slides:



Advertisements
Similar presentations
Test Yaodong Bi.
Advertisements

Modular and Verified Automatic Program Repair Francesco Logozzo, Thomas Ball RiSE - Microsoft Research Redmond.
An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
Report on Intrusion Detection and Data Fusion By Ganesh Godavari.
20-Jun-15 Eclipse. Most slides from: 2 About IDEs An IDE is an Integrated Development Environment.
Software Factory Assembling Applications with Models, Patterns, Frameworks and Tools Anna Liu Senior Architect Advisor Microsoft Australia.
PROMPT: Algorithm and Tool for Automated Ontology Merging and Alignment Natalya Fridman Noy and Mark A. Musen.
Demo of Software Refactoring with Eclipse Giriprasad Sridhara CISC 879 Spring 2007 May
Program Slicing for Refactoring Advanced SW Tools Seminar Jan 2005Yossi Peery.
BİL744 Derleyici Gerçekleştirimi (Compiler Design)1.
Automatic Data Ramon Lawrence University of Manitoba
1 Scenario-based Analysis of UML Design Class Models Lijun Yu October 4th, 2010 Oslo, Norway.
Ontology translation: two approaches Xiangkui Yao OntoMorph: A Translation System for Symbolic Knowledge By: Hans Chalupsky Ontology Translation on the.
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
Comparing M2T & M2M Complementary Approaches © 2008 INRIA, University of York & SINTEF Comparing M2T & M2M Complementary Approaches Hugo Bruneliere,
SSIS Over DTS Sagayaraj Putti (139460). 5 September What is DTS?  Data Transformation Services (DTS)  DTS is a set of objects and utilities that.
Reverse Engineering State Machines by Interactive Grammar Inference Neil Walkinshaw, Kirill Bogdanov, Mike Holcombe, Sarah Salahuddin.
Supporting Automatic Model Inconsistency Fixing Yingfei Xiong University of Tokyo, Japan Zhenjiang HuNational Institute of Informatics, Japan Haiyan ZhaoPeking.
Graph Data Management Lab, School of Computer Science gdm.fudan.edu.cn XMLSnippet: A Coding Assistant for XML Configuration Snippet.
PLATFORM INDEPENDENT SOFTWARE DEVELOPMENT MONITORING Mária Bieliková, Karol Rástočný, Eduard Kuric, et. al.
Parser-Driven Games Tool programming © Allan C. Milne Abertay University v
Ohio State University Department of Computer Science and Engineering Automatic Data Virtualization - Supporting XML based abstractions on HDF5 Datasets.
Knowledge and Tree-Edits in Learnable Entailment Proofs Asher Stern, Amnon Lotan, Shachar Mirkin, Eyal Shnarch, Lili Kotlerman, Jonathan Berant and Ido.
Change Impact Analysis for AspectJ Programs Sai Zhang, Zhongxian Gu, Yu Lin and Jianjun Zhao Shanghai Jiao Tong University.
Lase: Locating and Applying Systematic Edits by Learning from Examples Na Meng* Miryung Kim* Kathryn S. McKinley* + The University of Texas at Austin*
Mining and Analysis of Control Structure Variant Clones Guo Qiao.
Reviewing Recent ICSE Proceedings For:.  Defining and Continuous Checking of Structural Program Dependencies  Automatic Inference of Structural Changes.
Report on Intrusion Detection and Data Fusion By Ganesh Godavari.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Applying Clone.
Verification and Validation in the Context of Domain-Specific Modelling Janne Merilinna.
Business Integration Technologies © 2006 IBM Corporation Zurich Research Laboratory - BIT Validation.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University How to extract.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 15: Automated Patch Generation.
Generative Programming. Automated Assembly Lines.
Automatically Repairing Broken Workflows for Evolving GUI Applications Sai Zhang University of Washington Joint work with: Hao Lü, Michael D. Ernst.
Mining Billions of AST Nodes to Study Actual and Potential Usage of Java Language Features Robert Dyer The research activities described in this talk were.
Multiple Code Inheritance in Java Maria Cutumisu Supervisors: Duane Szafron, Paul Lu.
Presented by: Ashgan Fararooy Referenced Papers and Related Work on:
XML Databases by Sebastian Graf Hier beginnt mein toller Vortrag.
Hassen Grati, Houari Sahraoui, Pierre Poulin DIRO, Université de Montréal Extracting Sequence Diagrams from Execution Traces using Interactive Visualization.
Automatic Generation of Programming Feedback: A Data-Driven Approach Kelly Rivers and Ken Koedinger 1.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,
Duplicate code detection using anti-unification Peter Bulychev Moscow State University Marius Minea Institute eAustria, Timisoara.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Automated Patch Generation Adapted from Tevfik Bultan’s Lecture.
Tool Support for proof Engineering Anne Mulhern Computer Sciences Department University of Wisconsin-Madison Madison, WI USA
Implementation of a Relational Database as an Aid to Automatic Target Recognition Christopher C. Frost Computer Science Mentor: Steven Vanstone.
How Can I Use This Method? 2015 IEEE/ACM 37TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING HOW.
The Spoofax Language Workbench Rules for Declarative specification of language and IDEs Lennart C. L. Kats and Eelco Visser Delft University of Technology.
(A comparative study for XML change detection) Grégory Cobéna (INRIA), Talel Abdessalem (ENST), Yassine Hinnach (ENST) Etude comparative sur la détection.
What kind of and how clones are refactored? A case study of three OSS projects WRT2012 June 1, Eunjong Choi†, Norihiro Yoshida‡, Katsuro Inoue†
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
Andrey Karaulov, Alexander Strabykin Institute for System Programming Russian Academy of Sciences SYRCoSE: Spring Young Researchers Colloquium on Software.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Instance Discovery and Schema Matching With Applications to Biological Deep Web Data Integration Tantan Liu, Fan Wang, Gagan Agrawal {liut, wangfa,
Design Pattern Support based on principles of model driven development Zihao Zhao.
BRIEF INTRODUCTION: AND EPID 745, April 3, 2012 Xiaoguang Ma.
Generating Automated Tests from Behavior Models
Critics: An Interactive Code Review Tool for
Ruru Yue1, Na Meng2, Qianxiang Wang1 1Peking University 2Virginia Tech
Accurate and Efficient Refactoring Detection in Commit History
Lecture 12: Data Wrangling
: Clone Refactoring Davood Mazinanian Nikolaos Tsantalis Raphael Stein
CSc4730/6730 Scientific Visualization
Masatomo Hashimoto Akira Mori Tomonori Izumida
ClDiff: Generating Concise Linked Code Differences
Lec00-outline May 18, 2019 Compiler Design CS416 Compiler Design.
Automatically Diagnosing and Repairing Error Handling Bugs in C
Fine-grained and Accurate Source Code Differencing
Presentation transcript:

Systematic Editing: Generating Program Transformations from an Example Na Meng Miryung Kim Kathryn S. McKinley The University of Texas at Austin

Motivating Scenario A old A new B old B new C old C new Pat needs to update database transaction code to prevent SQL injection attacks 2

Systematic Editing Similar but not identical changes to multiple contexts Manual, tedious, and error-prone Refactoring engines automate pre-defined semantic preserving edits Source transformation tools require describing edits in a formal language 3

Our Solution: Sydit C new Program differencing A old A new Abstract edit script application Context extraction Identifier & edit position abstraction B old B ne w C old DELETE: config = (ILaunchConfiguration)iter.next(); DELETE: v1 = (t1)v2.m1(); DELETE: v1 = (t1)v2.m1(); C new Context 4 Sydit improves programmer productivity.

Outline Program Transformation Generation Approach Evaluation on Open Source Projects Related Work Conclusion 5

Approach Overview Phase I: Creating Abstract Edit Scripts Phase II: Applying Abstract Edit Scripts – Step 1. Syntactic Program Differencing – Step 2. Edit Context Extraction – Step 3. Identifier and Edit Position Abstraction C old B old B new C new 6

Step 1. Syntactic Program Differencing ChangeDistiller(A old, A new )  AST edit script insert(u, v, k): insert node u and position it as the (k+1)th child of node v delete(u): delete node u update(u, v): replace u with v move(u, v, k): delete u from its current position and insert u as the (k+1)th child of v 7

Example based on eclipse.debug.core A old to A new 1. Iterator iter = getAllLaunchConfigurations().iterator(); 2. List configs = new ArrayList(); 3. + ILaunchConfiguration config = null; 4. while(iter.hasNext()){ 5. - ILaunchConfiguration config = (ILaunchConfiguration)iter.next() 6. + config = (ILaunchConfiguration)iter.next(); 7. + if(!config.inValid()){ 8. + config.reset(); 9. + } 10. if(config.getType.equals(type)){ 11. configs.add(config); 12. } 13. } 14. return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); 8

Step 1. Syntactic Program Differencing A old A new method_ decl iter_decl configs_ decl configs_ decl while return config_ decl config_ decl if then configs_ mi O6 method_ decl iter_decl while return N1 N5 configs_ decl configs_ decl config_ asgn config_ asgn if then configs_ mi config_ decl config_ decl if then config_ mi config_ mi N7 N8 N9 N10 N4 update(O6,N4) move(O6, N1, 2) insert(N7, N5, 0) insert(N8, N5, 1) insert(N9, N8, 0) insert(N10, N9, 0) 9

Step 2. Edit Context Extraction Identify unchanged nodes on which the edited nodes depend or nodes that depend on the edits – Containment dependence – Control dependence – Data dependence 10

Step 2. Edit Context Extraction A old A new method_ decl iter_decl configs_ decl while return config_ decl config_ decl if then configs_ mi O1 O2 O4 O6 method_ decl iter_decl while return N1 N2 N5 configs_ decl config_ asgn config_ asgn if then configs_ mi config_ decl config_ decl if then config_ mi config_ mi N7 N8 N9 N1 0 N4 11

Step 3. Identifier and Edit Position Abstraction Identifier Abstraction Edit Position Abstraction config = (ILaunchConfiguration) iter.next() => v1 = (T1) v2.m1() insert (“i++”, “while(i<j)”, 2) => insert (“v1++”, “while(v1<v2)”, 1) 12

Step 3. Identifier and Edit Position Abstraction Abstract old Abstract new method_ decl iter_decl config_decl AO4 T1 v1 = m1().m2() while while(v1.m3()) T2 v2 = (T2)v1.m4() method_ decl AN4 if then AN5 AN6 AN7 AN3 iter_decl T1 v1 = m1().m2() config_decl T2 v2 = null while while(v1.m3()) config_asgn v2 = (T2)v1.m4()if(v2.m5()) configs.mi AN8 v2.m6() AN1 13 update(AO4,AN3) move(AO4, AN1, 1) insert(AN5, AN4, 0) insert(AN6, AN4, 1) insert(AN7, AN6, 0) insert(AN8, AN7, 0)

Approach Overview Phase I: Creating Abstract Edit Scripts Phase II: Applying Abstract Edit Scripts – Step 1. Syntactic Program Differencing – Step 2. Edit Context Extraction – Step 3. Identifier and Edit Position Abstraction C old B old B new C new – Step 4. Context Matching – Step 5. Identifier and Edit Position Concretization – Step 6. Concrete Edit Application 14

Step 4. Context Matching method_ decl method_ decl v3_decl v1_decl T1 v1 = m1().m2() while while(v1.m3()) T3 v3 = m5().m4() v3_mi v1= (T2)v3.m6() v1_mi v1.m7() v3_decl v1_decl T1 v1 = m1().m9() while while(v2.m3()) T3 v3 = m5().m4() v3_mi v2 =(T2)v3.m6() v2_mi v2.m7() v2_decl T1 v2 = new T1() v3_mi v1 = (T2)v3.m6() while while(v2.m3()) v1_mi v1.m8() Abstract old B old T1 v1 = m1().m2() T1 v1 = m1().m9() AO1 AO2 AO3 AO4 AO5 AO6 O2 15 method_ decl

Example based on eclipse.debug.core B old 1.Iterator iter = getAllLaunchConfigurations().iterator(); 2.List cfgs = new ArrayList(); 3.while(iter.hasNext()){ 4. ILaunchConfiguration cfg = (ILaunchConfiguration)iter.next(); 5. IFile file = cfg.getFile(); 6. if(file != null && file.getProject().equals(project)){ 7. cfgs.add(cfg); 8. } 9.} 10.return cfgs; 16

Step 4. Context Matching method_ decl iter_decl config_decl T1 v1 = m1().m2() while while(v1.m3()) T2 v2 = (T2)v1.m4() method_ decl then iter_decl T1 v1 = m1().m2() while while(v1.m3()) cfg_decl T4 v3 = (T4)v1.m4() if if(v4!=null && v4.m6().m7(v5)) cfgs.mi v2.m8(v4) Abstract o mB o cfgs_decl T2 v2 = new T2() return return v2 file_decl T5 v4 = v3.m5() 17 Variable MapMethod MapType Map v1 m1 T1 v2 v3m2 T2 T4 m3 m4

Step 5. Identifier and Edit Position Concretization Identifier Concretization Edit Position Concretization v1 = (T1) v2.m1() => cfg = (ILaunchConfiguration) iter.next() insert (“v1++”, “while(v1<v2)”, 1) => insert (“i++”, “while(i<j)”, 2) 18

Step 6. Concrete Edit Script Application mB o mB suggested method_ decl iter_decl cfgs_decl while return cfg_decl if then cfgs_mi O6 method_ decl iter_decl while return N1 N5 cfg_decl cfg_asgn if then cfgs_mi cfgs_decl if then cfg_mi N7 N8 N9 N10 N3 update(O6,N3) move(O6, N1, 1) insert(N7, N5, 0) insert(N8, N5, 1) insert(N9, N8, 0) insert(N10, N9, 0) 19

Outline Program Transformation Generation Approach Evaluation on Open Source Projects Related Work Conclusion 20

Test Suite 56 pairs of exemplar edits from – org.eclipse.compare – org.eclipse.core.runtime – org.debug.core Method pairs are at least 40% similar and share at least one common edit 21 – jdt.core – jEdit

Categorization of Edits in the Test Suite Single Node Multiple Nodes ContiguousNon-contiguous IdenticalSICINI 7711 AbstractSACANA

Example: Non-contiguous Abstract Edits A old to A new public IAcitionBars getActionBars(){ + IActionBars actionBars = fContainer.getActionBars(); - if (fContainer == null) { + if (actionBars == null && ! fContainerProvided){ return Utilities.findActionBars(fComposite ); } -return fContainer.getActionBars(); + return actionBars; B old to B new public IServiceLocator getServiceLocator(){ + IServiceLocator serviceLocator = fContainer.getServiceLocator(); - if (fContainer == null) { + if (serviceLocator == null && ! fContainerProvided){ return Utilities.findSite(fComposite); } - return fContainer.getServiceLocator(); + return serviceLocator; 23

RQ1: Coverage, Accuracy and Similarity Coverage: What percentage of examples can Sydit match the context and produce some edits? Accuracy: What percentage of examples can Sydit apply edits correctly? Similarity: How similar is Sydit-generated version to developer-generated version? 24

RQ1: Coverage, Accuracy and Similarity Single Node Multiple Nodes ContiguousNon-contiguous Identical examples7711 coverage71%100%73% accuracy71%100%73% similarity100% Abstract examples712 coverage100%75%83% accuracy86%50%58% similarity86%95% Coverage82% (46/56) Accuracy70% (39/56) Similarity96% (46) Sydit creates edits for 82% of examples, produces correct edits for 70%, & with 96% similarity to developer’s edits Sydit creates edits for 82% of examples, produces correct edits for 70%, & with 96% similarity to developer’s edits 25

26 RQ2: Context Characterization % coverage% accuracy% similarity Varying the number of dependence hops k=179%66%95% k=275%63%95% k=375%63%95% Varying the abstraction settings abstract V T M82%70%96% abstract V66%55% abstract T66%55% abstract M80%68%96% no abstraction66%55% Varying the upstream and downstream dependence settings all (k=1)79%66%95% containment only84%68%90% upstream only (k=1)82%70%96%

Related Work Program differencing Refactoring Source transformation Simultaneous text editing [Miller et al.] Generic patch inference [Andersen & Lawall] 27

Conclusion Sydit automates systematic edits by generating transformations from an example and applies them to different contexts with 82% coverage 70% accuracy, and 96% similarity Future Work – Select target methods automatically – Present proposed edits in a diff-style view for programmers to preview – Integrate with automated compilation and testing 28

29