Semantic Code Refactoring for Abstract Data Types
Shankara Pailoor, Yuepeng Wang, Isil Dillig
摘要
Modifications to the data representation of an abstract data type (ADT) can require significant semantic refactoring of the code. Motivated by this observation, this paper presents a new method to automate semantic code refactoring tasks. Our method takes as input the original ADT implementation, a new data representation, and a so-called relational representation invariant (relating the old and new data representations), and automatically generates a new ADT implementation that is semantically equivalent to the original version.
Our method is based on counterexample-guided inductive synthesis (CEGIS) but leverages three key ideas that allow it to handle real-world refactoring tasks. First, our approach reduces the underlying relational synthesis problem to a set of (simpler) programming-by-example problems, one for each method in the ADT. Second, it leverages symbolic reasoning techniques, based on logical abduction, to deduce code snippets that should occur in the refactored version. Finally, it utilizes a notion of partial equivalence to make inductive synthesis much more effective in this setting. We have implemented the proposed approach in a new tool called Revamp for automatically refactoring Java classes and evaluated it on 30 Java class mined from Github. Our evaluation shows that Revamp can correctly refactor the entire ADT in 97% of the cases and that it can successfully re-implement 144 out of the 146 methods that require modifications.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Relational Synthesis of Recursive Programs via Constraint Annotated Tree Automata 引用了 Data-driven inference of representation invariants
- Relational Synthesis of Recursive Programs via Constraint Annotated Tree Automata 引用了 Synthesis-powered optimization of smart contracts via data type refactoring
- Relational Synthesis of Recursive Programs via Constraint Annotated Tree Automata 引用了 Cyclic program synthesis
- Synthesis-powered optimization of smart contracts via data type refactoring 引用了 Data Migration using Datalog Program Synthesis
- Graphiti: Bridging Graph and Relational Database Queries 引用了 Synthesis-powered optimization of smart contracts via data type refactoring
- Graphiti: Bridging Graph and Relational Database Queries 引用了 Data Migration using Datalog Program Synthesis
引用它的顶会 Paper9
- Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisRuyi Ji, Yuwei Zhao, Nadia Polikarpova, Yingfei Xiong 等PLDI 2024 · 4 次引用
- From Batch to Stream: Automatic Generation of Online AlgorithmsZiteng Wang, Shankara Pailoor, Aaryan Prakash, Yuepeng Wang 等PLDI 2024 · 4 次引用
- Graphiti: Bridging Graph and Relational Database QueriesYang He, Ruijie Fang, Isil Dillig, Yuepeng WangPLDI 2025 · 3 次引用
- Relational Synthesis of Recursive Programs via Constraint Annotated Tree AutomataAnders Miltner, Ziteng Wang, Swarat Chaudhuri, Isil DilligCAV 2024 · 2 次引用
- Automated Discovery of Tactic Libraries for Interactive Theorem ProvingYutong Xin, Jimmy Xin, Gabriel Poesia, Noah D. Goodman 等OOPSLA 2025
它引用的 Paper7
- Combining the top-down propagation and bottom-up enumeration for inductive program synthesisWoosuk LeePOPL 2021 · 34 次引用
- Data-driven inference of representation invariantsAnders Miltner, Saswat Padhi, Todd D. Millstein, David WalkerPLDI 2020 · 33 次引用
- Data Migration using Datalog Program SynthesisYuepeng Wang, Rushi Shah, Abby Criswell, Rong Pan 等VLDB 2020 · 30 次引用
- Cyclic program synthesisShachar Itzhaky, Hila Peleg, Nadia Polikarpova, Reuben N. S. Rowe 等PLDI 2021 · 26 次引用
- Synthesis-powered optimization of smart contracts via data type refactoringYanju Chen, Yuepeng Wang, Maruth Goyal, James Dong 等OOPSLA 2022 · 14 次引用
相关 Paper
- Synthesizing data structure refinements from integrity constraintsShankara Pailoor, Yuepeng Wang, Xinyu Wang, Isil DilligPLDI 2021 · 10 次引用
- Recursion synthesis with unrealizability witnessesAzadeh Farzan, Danya Lette, Victor NicoletPLDI 2022 · 19 次引用
- Synthesizing replacement classesMalavika Samak, Deokhwan Kim, Martin C. RinardPOPL 2020 · 14 次引用
- Provenance-guided synthesis of Datalog programsMukund Raghothaman, Jonathan Mendelson, David Zhao, Mayur Naik 等POPL 2020 · 49 次引用
- From Custom Logic to APIs: Understanding and Recommending API Replacement RefactoringsBridget Nyirongo, Yanjie Jiang, Yuxia Zhang, Hui LiuISSTA 2026
