A calculus for constraint-based flow typing

Flow typing offers an alternative to traditional Hindley-Milner type inference. A key distinction is that variables may have different types at different program points. Flow typing systems are typically formalised in the style of a dataflow analysis. In the presence of loops, this requires a fix-point computation over typing environments. Unfortunately, for some flow typing problems, the standard iterative fix-point computation may not terminate. We formalise such a problem we encountered in developing the Whiley programming language, and present a novel constraint-based solution which is guaranteed to terminate. This provides a foundation for others when developing such flow typing systems.

[1]  Alexander Aiken,et al.  Polymorphic versus Monomorphic Flow-Insensitive Points-to Analysis for C , 2000, SAS.

[2]  James Noble,et al.  Implementing a Language with Flow-Sensitive and Structural Typing on the JVM , 2011, Bytecode@ETAPS.

[3]  Sophia Drossopoulou,et al.  Towards Type Inference for JavaScript , 2005, ECOOP.

[4]  Scott F. Smith,et al.  Sound polymorphic type inference for objects , 1995, OOPSLA.

[5]  Alexander Aiken,et al.  Introduction to Set Constraint-Based Program Analysis , 1999, Sci. Comput. Program..

[6]  Davide Ancona,et al.  RPython: a step towards reconciling dynamically and statically typed OO languages , 2007, DLS '07.

[7]  David J. Pearce JPure: A Modular Purity System for Java , 2011, CC.

[8]  K. Rustan M. Leino,et al.  Declaring and checking non-null types in an object-oriented language , 2003, OOPSLA 2003.

[9]  Andrew A. Chien,et al.  Precise concrete type inference for object-oriented languages , 1994, OOPSLA 1994.

[10]  Alexander Aiken,et al.  A theory of type qualifiers , 1999, PLDI '99.

[11]  Shane Markstrum,et al.  A framework for implementing pluggable type systems , 2006, OOPSLA '06.

[12]  Susan Horwitz,et al.  An efficient general iterative algorithm for dataflow analysis , 2004, Acta Informatica.

[13]  Craig Chambers,et al.  Alias annotations for program understanding , 2002, OOPSLA '02.

[14]  Alexander Aiken,et al.  Set Constraints: Results, Applications, and Future Directions , 1994, PPCP.

[15]  Laurie J. Hendren,et al.  A Framework for Optimizing Java Using Attributes , 2001, CC.

[16]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[17]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[18]  Alejandro Russo,et al.  Dynamic vs. Static Flow-Sensitive Security Analysis , 2010, 2010 23rd IEEE Computer Security Foundations Symposium.

[19]  A. Aiken,et al.  Flow-Insensitive Points-to Analysis with Term and Set Constraints , 1997 .

[20]  Mark N. Wegman,et al.  An efficient method of computing static single assignment form , 1989, POPL '89.

[21]  Incremental Computation of Static Single Assignment Form , 1996, CC.

[22]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[23]  Didier Rémy,et al.  Objective ML: An Effective Object-Oriented Extension to ML , 1998, Theory Pract. Object Syst..

[24]  Chris Hankin,et al.  Online Cycle Detection and Difference Propagation: Applications to Pointer Analysis , 2004, Software Quality Journal.

[25]  Alexander Aiken,et al.  Partial online cycle elimination in inclusion constraint graphs , 1998, PLDI.

[26]  Johnni Winther Guarded type promotion: eliminating redundant casts in Java , 2011, FTfJP@ECOOP.

[27]  Ondrej Lhoták,et al.  Points-to analysis using BDDs , 2003, PLDI '03.

[28]  Nevin Heintze,et al.  Set-based analysis of ML programs , 1994, LFP '94.

[29]  Sam Tobin-Hochstadt,et al.  Logical types for untyped languages , 2010, ICFP '10.

[30]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[31]  Akira Fukuda,et al.  The modulo interval: a simple and practical representation for program analysis , 1999, 1999 International Conference on Parallel Architectures and Compilation Techniques (Cat. No.PR00425).

[32]  Dave Clarke,et al.  External Uniqueness Is Unique Enough , 2003, ECOOP.

[33]  Flemming Nielson,et al.  Principles of Program Analysis , 1999, Springer Berlin Heidelberg.

[34]  Benjamin C. Pierce,et al.  Local type inference , 1998, POPL '98.

[35]  Flemming M. Damm,et al.  Subtyping with Union Types, Intersection Types and Recursive Types , 1994, TACS.

[36]  Jens Palsberg,et al.  Efficient recursive subtyping , 1992, POPL '93.

[37]  David J. Pearce Sound and Complete Flow Typing with Unions, Intersections and Negations , 2013, VMCAI.

[38]  David Sands,et al.  On flow-sensitive security types , 2006, POPL '06.

[39]  J PearceDavid,et al.  Online Cycle Detection and Difference Propagation , 2004 .

[40]  Sorin Lerner,et al.  Staged information flow for javascript , 2009, PLDI '09.

[41]  Stefan Kaes Type inference in the presence of overloading, subtyping and recursive types , 1992, LFP '92.

[42]  Luca Cardelli,et al.  Subtyping recursive types , 1991, POPL '91.

[43]  Benjamin C. Pierce,et al.  Recursive subtyping revealed , 2000, Journal of Functional Programming.

[44]  John Tang Boyland,et al.  Alias burying: Unique variables without destructive reads , 2001, Softw. Pract. Exp..

[45]  Alexander Aiken,et al.  Solving systems of set constraints , 1992, [1992] Proceedings of the Seventh Annual IEEE Symposium on Logic in Computer Science.

[46]  Jong-Deok Choi,et al.  Efficient flow-sensitive interprocedural computation of pointer-induced aliases and side effects , 1993, POPL '93.

[47]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[48]  Andrew C. Myers,et al.  JFlow: practical mostly-static information flow control , 1999, POPL '99.

[49]  Scott F. Smith,et al.  Precise Constraint-Based Type Inference for Java , 2001, ECOOP.

[50]  Laurie J. Hendren,et al.  Efficient Inference of Static Types for Java Bytecode , 2000, SAS.

[51]  Shriram Krishnamurthi,et al.  Typing Local Control and State Using Flow Analysis , 2011, ESOP.

[52]  Gavin M. Bierman,et al.  Lost in translation: formalizing proposed extensions to c# , 2007, OOPSLA.

[53]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[54]  Jens Palsberg,et al.  Object-oriented type inference , 1991, OOPSLA 1991.

[55]  Xavier Leroy,et al.  Java bytecode verification : algorithms and formalizations Xavier Leroy INRIA Rocquencourt and Trusted Logic , 2003 .

[56]  François Bourdoncle,et al.  Efficient chaotic iteration strategies with widenings , 1993, Formal Methods in Programming and Their Applications.

[57]  Jeffrey S. Foster,et al.  Static type inference for Ruby , 2009, SAC '09.

[58]  Davide Ancona,et al.  Corecursive Featherweight Java , 2012, FTfJP@ECOOP.

[59]  Susan Horwitz,et al.  Pointer-Range Analysis , 2004, SAS.

[60]  Barbara G. Ryder,et al.  Points-to analysis for Java using annotated constraints , 2001, OOPSLA '01.

[61]  Sam Tobin-Hochstadt,et al.  The design and implementation of typed scheme , 2008, POPL '08.

[62]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[63]  Davide Ancona,et al.  Idealized coinductive type systems for imperative object-oriented programs , 2011, RAIRO Theor. Informatics Appl..

[64]  Davide Ancona,et al.  Complete coinductive subtyping for abstract compilation of object-oriented languages , 2010, FTfJP@ECOOP.

[65]  Torbjörn Ekman,et al.  Pluggable checking and inferencing of nonnull types for Java , 2007, J. Object Technol..

[66]  David A. Wagner,et al.  A class of polynomially solvable range constraints for interval analysis without widenings , 2005, Theor. Comput. Sci..

[67]  Giuseppe Castagna,et al.  A Gentle Introduction to Semantic Subtyping , 2005, ICALP.

[68]  David J. Pearce,et al.  Structural and Flow-Sensitive Types for Whiley , 2010 .

[69]  Alexander Aiken,et al.  Soft typing with conditional types , 1994, POPL '94.

[70]  Giuseppe Castagna,et al.  Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types , 2008, JACM.

[71]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[72]  Alexander Aiken,et al.  Flow-sensitive type qualifiers , 2002, PLDI '02.

[73]  Alex Potanin,et al.  Java Bytecode Verification for @NonNull Types , 2008, CC.

[74]  Jens Palsberg,et al.  Making Type Inference Practical , 1992, ECOOP.

[75]  Frank Tip,et al.  Customization of Java Library Classes Using Type Constraints and Profile Information , 2004, ECOOP.

[76]  Jason R. C. Patterson,et al.  Accurate static branch prediction by value range propagation , 1995, PLDI '95.