Abstract
A technique for synthesizing iterators from declarative abstraction functions written in a relational logic specification language is described. The logic includes a transitive closure operator that makes it convenient for expressing reachability queries on linked data structures. Some optimizations, including tuple elimination, iterator flattening, and traversal state reduction, are used to improve performance of the generated iterators.
A case study demonstrates that most of the iterators in the widely used JDK Collections classes can be replaced with code synthesized from declarative abstraction functions. These synthesized iterators perform competitively with the hand-written originals.
In a user study the synthesized iterators always passed more test cases than the hand-written ones, were almost always as efficient, usually took less programmer effort, and were the qualitative preference of all participants who provided free-form comments.
- J. Bloch. Effective Java. Addison-Wesley, Reading, Mass., 2001.Google Scholar
- L. Burdy, Y. Cheon, D. Cok, M. D. Ernst, J. R. Kiniry, G. T. Leavens, K. R. M. Leino, and E. Poll. An overview of JML tools and applications. Software Tools for Technology Transfer, 7(3): 212--232, June 2005. Google Scholar
Digital Library
- Y. Cheon. A Runtime Assertion Checker for the Java Modeling Language. PhD thesis, Department of Computer Science, Iowa State University, Apr. 2003.Google Scholar
- T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. The MIT Press and McGraw-Hill, 2nd edition, 2001. Google Scholar
Digital Library
- B. Demsky, C. Cadar, D. Roy, and M. C. Rinard. Efficient specification-assisted error localization. In WODA, 2004.Google Scholar
Cross Ref
- G. Dennis. A Relational Framework for Bounded Program Verification. PhD thesis, MIT, 2009.Google Scholar
- A. Gesar, H. Hussmann, and A. Muck. A compiler for a class of conditional term rewriting systems. In Kaplan and Jouannaud {19}.Google Scholar
- ECOOP, volume 1628 of LNCS, 1999. Springer-Verlag.Google Scholar
- P. Hawkins, A. Aiken, K. Fisher, M. Rinard, and M. Sagiv. Data representation synthesis. In PLDI, June 2011. Google Scholar
Digital Library
- J. Henkel and A. Diwan. Discovering algebraic specifications from Java classes. In ECOOP. July 2003. ISBN 3-540-40531-3.Google Scholar
- T. Heuillard. Compiling conditional rewriting systems. In Kaplan and Jouannaud {19}.Google Scholar
- C. A. R. Hoare. Proof of correctness of data representations. Acta Informatica, 1(4): 271--281, Dec. 1972.Google Scholar
Digital Library
- S. S. Huan, D. Zook, and Y. Smaragdakis. Domain-specific languages and program generation with Meta-AspectJ. TOSEM, 18(2), Oct. 2008. Google Scholar
Digital Library
- D. Jackson. Software Abstractions: Logic, Language, and Analysis. The MIT Press, revised edition, Jan. 2012. Google Scholar
Digital Library
- B. Jacobs, E. Meijer, F. Piessens, and W. Schulte. Iterators revisited: proof rules and implementation. In Formal Techniques for Java-like Programs (FTfJP), 2005.Google Scholar
- L. Jadoul, L. Duponcheel, and W. Van Puymbroeck. An algebraic data type specification language and its rapid prototyping environment. In ICSE, May 1989. Google Scholar
Digital Library
- P. Jalote. Synthesizing implementations of abstract data types from axiomatic specifications. Software---Practice & Experience, 17(11), Nov. 1987. Google Scholar
Digital Library
- K. D. Jones. A Semantics for a Larch/Modula-3 Interface Language. In Workshop on Larch. July 1992. Google Scholar
Digital Library
- Proceedings of the 1st International Workshop on Term Rewriting Systems, volume 308 of LNCS, 1988. Springer-Verlag.Google Scholar
- T. Kühne. Internal iteration externalized. In Guerraoui {8}.Google Scholar
- V. Kuncak. Modular Data Structure Verification. PhD thesis, MIT, 2007. Google Scholar
Digital Library
- R. Laemmel and S. P. Jones. Scrap your boilerplate: a practical approach to generic programming. In TLDI, 2003. Google Scholar
Digital Library
- G. T. Leavens, A. L. Baker, and C. Ruby. Preliminary design of JML: A behavioral interface specification language for Java. Technical Report 98-06u, Iowa State University, Apr. 2003. URL http://www.jmlspecs.org.Google Scholar
- K. R. M. Leino. Data groups: specifying the modification of extended state. In OOPSLA, Oct. 1998. Google Scholar
Digital Library
- K. R. M. Leino and A. Milicevic. Program extrapolation with Jennisys. Technical Report KRML219, Microsoft Research, 2012. URL http://research.microsoft.com/pubs/158573/krml219.pdf.Google Scholar
Digital Library
- R. Lencevicius, U. Hölzle, and A. K. Singh. Query-based debugging of object-oriented programs. In OOPSLA, Oct. 1997. Google Scholar
Digital Library
- R. Lencevicius, U. Hölzle, and A. K. Singh. Dynamic query-based debugging. In Guerraoui {8}, pages 135--160. Google Scholar
Digital Library
- K. J. Lieberherr. Adaptive Object-Oriented Software: The Demeter Method with Propagation Patterns. PWS, 1996. Google Scholar
Digital Library
- J. Liu and A. C. Myers. JMatch: Iterable Abstract Pattern Matching for Java. In PADL, 2003. Google Scholar
Digital Library
- J. Liu, A. Kimball, and A. C. Myers. Interruptible iterators. In POPL, Jan. 2006. Google Scholar
Digital Library
- A. Milicevic, D. Rayside, K. Yessenov, and D. Jackson. Unifying execution of imperative and declarative code. In ICSE, 2011. Google Scholar
Digital Library
- C. Morgan. Programming from Specifications. Prentice-Hall, Inc., 2nd edition, 1998. First edition 1990. Google Scholar
Digital Library
- S. Murer, S. Omohundro, D. Stoutamire, and C. Szypersky. Iteration abstraction in Sather. TOPLAS, 18(1), 1996. Google Scholar
Digital Library
- M. Odersky, L. Spoon, and B. Venners. Programming in Scala. Artima, Nov. 2008.Google Scholar
- C. Pacheco, S. K. Lahiri, M. D. Ernst, and T. Ball. Feedback-directed random test generation. In ICSE, 2007. Google Scholar
Digital Library
- A. Potanin, J. Noble, and R. Biddle. Checking ownership and confinement. Concurrency and Computation: Practice and Experience, 16(7): 671--687, 2004. Google Scholar
Digital Library
- V. K. Proulx and W. Jossey. Unit test support for Java via reflection and annotations. In Principles and Practice of Programming in Java, 2009. Google Scholar
Digital Library
- D. Rayside, Z. Benjamin, R. Singh, J. P. Near, A. Milicevic, and D. Jackson. Equality and hashing for (almost) free: Generating implementations from abstraction functions. In ICSE, 2009. Google Scholar
Digital Library
- D. Rayside, A. Milicevic, K. Yessenov, G. Dennis, and D. Jackson. Agile specifications. In Proceedings of Onward'09, Oct. 2009. Google Scholar
Digital Library
- C. Reichenbach, N. Immerman, Y. Smaragdakis, E. E. Aftandilian, and S. Z. Guyer. What can the GC compute efficiently? A language for heap assertions at GC time. In OOPSLA, Oct. 2010. Google Scholar
Digital Library
- H. Samimi, E. D. Aung, and T. Millstein. Falling back on executable specifications. In ECOOP. June 2010. Google Scholar
Digital Library
- Y. Smaragdakis and D. Batory. DiSTiL: a Transformation Library for Data Structures. In DSL, 1997. Google Scholar
Digital Library
- M. K. Srivas. Automatic synthesis of implementations for abstract data types from algebraic specifications. PhD thesis, MIT, 1982.Google Scholar
- E. Torlak and D. Jackson. Kodkod: A relational model finder. In TACAS. Mar. 2007. Google Scholar
Digital Library
- M. T. Vandevoorde and J. V. Guttag. Using specialized procedures and specification-based analysis to reduce the runtime costs of modularity. In FSE, Dec. 1994. Google Scholar
Digital Library
- M. Vaziri, F. Tip, S. Fink, and J. Dolby. Declarative object identity using relation types. In ECOOP. July 2007. Google Scholar
Digital Library
- P. Wadler. Deforestation: transforming programs to eliminate trees. TCS, 73: 231--248, 1990. Google Scholar
Digital Library
- D. Willis, D. J. Pearce, and J. Noble. Efficient object querying for Java. In ECOOP. July 2006. Google Scholar
Digital Library
- K. Yessenov. A light-weight specification language for bounded program verification. Master's thesis, MIT, May 2009.Google Scholar
- K. Zee, V. Kuncak, and M. Rinard. Full functional verification of linked data structures. In PLDI, June 2008. Google Scholar
Digital Library
Index Terms
Synthesizing iterators from abstraction functions
Recommendations
Synthesizing iterators from abstraction functions
GPCE '12: Proceedings of the 11th International Conference on Generative Programming and Component EngineeringA technique for synthesizing iterators from declarative abstraction functions written in a relational logic specification language is described. The logic includes a transitive closure operator that makes it convenient for expressing reachability ...
Interruptible iterators
POPL '06: Conference record of the 33rd ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThis paper introduces interruptible iterators, a language feature that makes expressive iteration abstractions much easier to implement. Iteration abstractions are valuable for software design, as shown by their frequent use in well-designed data ...
Accelerating iterators in optimizing AST interpreters
OOPSLA '14Generators offer an elegant way to express iterators. However, their performance has always been their Achilles heel and has prevented widespread adoption. We present techniques to efficiently implement and optimize generators.
We have implemented our ...






Comments