Abstract
This paper presents a new approach for automatically deriving worst-case resource bounds for C programs. The described technique combines ideas from amortized analysis and abstract interpretation in a unified framework to address four challenges for state-of-the-art techniques: compositionality, user interaction, generation of proof certificates, and scalability. Compositionality is achieved by incorporating the potential method of amortized analysis. It enables the derivation of global whole-program bounds with local derivation rules by naturally tracking size changes of variables in sequenced loops and function calls. The resource consumption of functions is described abstractly and a function call can be analyzed without access to the function body. User interaction is supported with a new mechanism that clearly separates qualitative and quantitative verification. A user can guide the analysis to derive complex non-linear bounds by using auxiliary variables and assertions. The assertions are separately proved using established qualitative techniques such as abstract interpretation or Hoare logic. Proof certificates are automatically generated from the local derivation rules. A soundness proof of the derivation system with respect to a formal cost semantics guarantees the validity of the certificates. Scalability is attained by an efficient reduction of bound inference to a linear optimization problem that can be solved by off-the-shelf LP solvers. The analysis framework is implemented in the publicly-available tool C4B. An experimental evaluation demonstrates the advantages of the new technique with a comparison of C4B with existing tools on challenging micro benchmarks and the analysis of more than 2900 lines of C code from the cBench benchmark suite.
- E. Albert, P. Arenas, S. Genaim, G. Puebla, and D. Zanardini. Cost Analysis of Object-Oriented Bytecode Programs. Theor. Comput. Sci., 413(1):142–159, 2012. Google Scholar
Digital Library
- E. Albert, R. Bubel, S. Genaim, R. Hähnle, and G. Román-D´ıez. Verified Resource Guarantees for Heap Manipulating Programs. In Fundamental Approaches to Software Engineering - 15th Int. Conf. (FASE’12), pages 130–145, 2012. Google Scholar
Digital Library
- C. Alias, A. Darte, P. Feautrier, and L. Gonnord. Multi-dimensional Rankings, Program Termination, and Complexity Bounds of Flowchart Programs. In 17th Int. Static Analysis Symposium (SAS’10), pages 117–133, 2010. Google Scholar
Digital Library
- D. E. Alonso-Blas and S. Genaim. On the limits of the classical approach to cost analysis. In 19th Int. Static Analysis Symposium (SAS’12), pages 405–421, 2012. Google Scholar
Digital Library
- R. Atkey. Amortised Resource Analysis with Separation Logic. In 19th Euro. Symp. on Prog. (ESOP’10), pages 85–103, 2010. Google Scholar
Digital Library
- G. Barthe, B. Grégoire, and S. Z. Béguelin. Formal Certification of Code-Based Cryptographic Proofs. In 36th ACM Symp. on Principles of Prog. Langs. (POPL’09), pages 90–101, 2009. Google Scholar
Digital Library
- G. Barthe, G. Betarte, J. D. Campo, C. Luna, and D. Pichardie. System-Level Non-Interference for Constant-Time Cryptography. IACR Cryptology ePrint Archive, 2014:422, 2014.Google Scholar
- R. Blanc, T. A. Henzinger, T. Hottelier, and L. Kovács. ABC: Algebraic Bound Computation for Loops. In Logic for Prog., AI., and Reasoning - 16th Int. Conf. (LPAR’10), pages 103–118, 2010. Google Scholar
Digital Library
- S. Blazy, A. Maroneze, and D. Pichardie. Formal Verification of Loop Bound Estimation for WCET Analysis. In Verified Software: Theories, Tools, Experiments - 5th Int. Conf. (VSTTE’13), 2013. To appear.Google Scholar
- V. A. Braberman, F. Fernández, D. Garbervetsky, and S. Yovine. Parametric prediction of heap memory requirements. In 7th Int. Symp. on Memory Management (ISMM’08), pages 141–150, 2008. Google Scholar
Digital Library
- M. Brockschmidt, F. Emmes, S. Falke, C. Fuhs, and J. Giesl. Alternating Runtime and Size Complexity Analysis of Integer Programs. In Tools and Alg. for the Constr. and Anal. of Systems - 20th Int. Conf. (TACAS’14), pages 140–155, 2014.Google Scholar
- M. Carbin, S. Misailovic, and M. C. Rinard. Verifying Quantitative Reliability for Programs that Execute on Unreliable Hardware. In 28th Conf. on Object-Oriented Prog., Sys., Langs., and Appl., OOPSLA’13, pages 33–52, 2013. Google Scholar
Digital Library
- Q. Carbonneaux, J. Hoffmann, T. Ramananandro, and Z. Shao. End-to-End Verification of Stack-Space Bounds for C Programs. In Conf. on Prog. Lang. Design and Impl. (PLDI’14), page 30, 2014. Google Scholar
Digital Library
- Q. Carbonneaux, J. Hoffmann, and Z. Shao. Compositional Certified Resource Bounds (Extended Version). Technical Report YALEU/DCS/TR-1505, Dept. of Computer Science, Yale University, New Haven, CT, April 2015.Google Scholar
- A. Carroll and G. Heiser. An Analysis of Power Consumption in a Smartphone. In USENIX Annual Technical Conference (USENIX’10), 2010. Google Scholar
Digital Library
- M. Cohen, H. S. Zhu, E. E. Senem, and Y. D. Liu. Energy Types. In 27th Conf. on Object-Oriented Prog., Sys., Langs., and Appl., OOPSLA’12, pages 831–850, 2012. Google Scholar
Digital Library
- COIN-OR Project. CLP (Coin-or Linear Programming). https: //projects.coin-or.org/Clp, 2014. Accessed: 2014-11-12.Google Scholar
- S. Gulwani and F. Zuleger. The Reachability-Bound Problem. In Conf. on Prog. Lang. Design and Impl. (PLDI’10), pages 292–304, 2010. Google Scholar
Digital Library
- S. Gulwani, S. Jain, and E. Koskinen. Control-Flow Refinement and Progress Invariants for Bound Analysis. In Conf. on Prog. Lang. Design and Impl. (PLDI’09), pages 375–385, 2009. Google Scholar
Digital Library
- S. Gulwani, K. K. Mehra, and T. M. Chilimbi. SPEED: Precise and Efficient Static Estimation of Program Computational Complexity. In 36th ACM Symp. on Principles of Prog. Langs. (POPL’09), pages 127–139, 2009. Google Scholar
Digital Library
- J. Hoffmann and M. Hofmann. Amortized Resource Analysis with Polynomial Potential. In 19th Euro. Symp. on Prog. (ESOP’10), 2010. Google Scholar
Digital Library
- J. Hoffmann and Z. Shao. Type-Based Amortized Resource Analysis with Integers and Arrays. In 12th International Symposium on Functional and Logic Programming (FLOPS’14), 2014.Google Scholar
- J. Hoffmann, K. Aehlig, and M. Hofmann. Multivariate Amortized Resource Analysis. In 38th ACM Symp. on Principles of Prog. Langs. (POPL’11), 2011. Google Scholar
Digital Library
- J. Hoffmann, K. Aehlig, and M. Hofmann. Multivariate Amortized Resource Analysis. ACM Trans. Program. Lang. Syst., 2012. Google Scholar
Digital Library
- M. Hofmann and S. Jost. Static Prediction of Heap Space Usage for First-Order Functional Programs. In 30th ACM Symp. on Principles of Prog. Langs. (POPL’03), pages 185–197, 2003. Google Scholar
Digital Library
- M. Hofmann and S. Jost. Type-Based Amortised Heap-Space Analysis. In 15th Euro. Symp. on Prog. (ESOP’06), pages 22–37, 2006. Google Scholar
Digital Library
- M. Hofmann and G. Moser. Amortised resource analysis and typed polynomial interpretations. In Joint 25th RTA and 12th TLCA, 2014.Google Scholar
Cross Ref
- E. Käsper and P. Schwabe. Faster and Timing-Attack Resistant AESGCM. In Cryptographic Hardware and Emb. Sys., 11th Int. Workshop (CHES’09), pages 1–17, 2009. Google Scholar
Digital Library
- X. Leroy. Formal Verification of a Realistic Compiler. Communications of the ACM, 52(7):107–115, 2009. Google Scholar
Digital Library
- J. Regehr, A. Reid, and K. Webb. Eliminating Stack Overflow by Abstract Interpretation. ACM Trans. Embed. Comput. Syst., 4(4):751– 778, 2005. Google Scholar
Digital Library
- M. Sinn, F. Zuleger, and H. Veith. A Simple and Scalable Approach for Bound Analysis and Amortized Complexity Analysis. In Computer Aided Verification - 26th Int. Conf. (CAV’14), page 743–759, 2014. Google Scholar
Digital Library
- R. E. Tarjan. Amortized Computational Complexity. SIAM Journal on Algebraic Discrete Methods, 6(2):306–318, 1985.Google Scholar
Cross Ref
- F. Zuleger, M. Sinn, S. Gulwani, and H. Veith. Bound Analysis of Imperative Programs with the Size-change Abstraction. In 18th Int. Static Analysis Symposium (SAS’11), 2011. Google Scholar
Digital Library
Index Terms
Compositional certified resource bounds
Recommendations
Bounded expectations: resource analysis for probabilistic programs
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and ImplementationThis paper presents a new static analysis for deriving upper bounds on the expected resource consumption of probabilistic programs. The analysis is fully automatic and derives symbolic bounds that are multivariate polynomials in the inputs. The new ...
Compositional certified resource bounds
PLDI '15: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and ImplementationThis paper presents a new approach for automatically deriving worst-case resource bounds for C programs. The described technique combines ideas from amortized analysis and abstract interpretation in a unified framework to address four challenges for ...
Towards automatic resource bound analysis for OCaml
POPL '17This article presents a resource analysis system for OCaml programs. The system automatically derives worst-case resource bounds for higher-order polymorphic programs with user-defined inductive types. The technique is parametric in the resource and ...






Comments