Hostname: page-component-848d4c4894-75dct Total loading time: 0 Render date: 2024-04-30T10:48:21.525Z Has data issue: false hasContentIssue false

A Transformational Approach to Resource Analysis with Typed-norms Inference

Published online by Cambridge University Press:  05 September 2019

ELVIRA ALBERT
Affiliation:
Dep. Sistemas Informáticos y Computación, Universidad Complutense de Madrid C/ Prof. José García Santesmases 9, 28040 Madrid, Spain (e-mails: elvira@fdi.ucm.es, samir.genaim@fdi.ucm.es)
SAMIR GENAIM
Affiliation:
Dep. Sistemas Informáticos y Computación, Universidad Complutense de Madrid C/ Prof. José García Santesmases 9, 28040 Madrid, Spain (e-mails: elvira@fdi.ucm.es, samir.genaim@fdi.ucm.es)
RAÚL GUTIÉRREZ
Affiliation:
Dep. Sistemes Informàtics i Computació, Universitat Politècnica de València Camino de Vera S/N, 46022 València, Spain (e-mail: rgutierrez@dsic.upv.es)
ENRIQUE MARTIN-MARTIN
Affiliation:
Dep. Sistemas Informáticos y Computación, Universidad Complutense de Madrid C/ Prof. José García Santesmases 9, 28040 Madrid, Spain (e-mail: emartinm@ucm.es)

Abstract

In order to automatically infer the resource consumption of programs, analyzers track how data sizes change along program’s execution. Typically, analyzers measure the sizes of data by applying norms which are mappings from data to natural numbers that represent the sizes of the corresponding data. When norms are defined by taking type information into account, they are named typed-norms. This article presents a transformational approach to resource analysis with typed-norms that are inferred by a data-flow analysis. The analysis is based on a transformation of the program into an intermediate abstract program in which each variable is abstracted with respect to all considered norms which are valid for its type. We also present the data-flow analysis to automatically infer the required, useful, typed-norms from programs. Our analysis is formalized on a simple rule-based representation to which programs written in different programming paradigms (e.g., functional, logic, and imperative) can be automatically translated. Experimental results on standard benchmarks used by other type-based analyzers show that our approach is both efficient and accurate in practice.

Type
Original Article
Copyright
Copyright © Cambridge University Press 2019

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Footnotes

*

This work was funded partially by the Spanish MICINN/FEDER, UE projects RTI2018-094403-B-C31 and RTI2018-094403-B-C32, MINECO projects TIN2015-69175-C4-2-R and TIN2015-69175-C4-1-R, by the CM project S2018/TCS-4314, the GV project PROMETEO/2019/098, and the UPV project SP20180225. Raúl Gutiérrez was also supported by INCIBE program “Ayudas para la excelencia de los equipos de investigación avanzada en ciberseguridad.”

References

Agha, G. and Callsen, C. J. 1993. Actorspace: An open distributed programming paradigm. In Proceedings 4th ACM Conference on Principles and Practice of Parallel Programming, ACM SIGPLAN Notices, 2332.Google Scholar
Albert, E., Arenas, P., Correas, J., Genaim, S., Gómez-Zamalloa, M., and Guillermo Román-Díez, G. P. 2015. Object-sensitive cost analysis for concurrent objects. Software Testing, Verification and Reliability 25, 3, 218271.CrossRefGoogle Scholar
Albert, E., Arenas, P., Flores-Montoya, A., Genaim, S., Gómez-Zamalloa, M., Martin-Martin, E., Puebla, G., and Román-Díez, G. 2014. SACO: Static analyzer for concurrent objects. In Tools and Algorithms for the Construction and Analysis of Systems – 20th International Conference, TACAS 2014, Ábrahám, E. and Havelund, K., Eds. Lecture Notes in Computer Science, vol. 8413. Springer, 562567.Google Scholar
Albert, E., Arenas, P., Genaim, S., Gómez-Zamalloa, M., and Puebla, G. 2011. Cost analysis of concurrent OO programs. In Programming Languages and Systems - 9th Asian Symposium, APLAS 2011, Kenting, Taiwan, December 5–7, 2011. Proceedings, Yang, H., Ed. Lecture Notes in Computer Science, vol. 7078. Springer, 238254.Google Scholar
Albert, E., Arenas, P., Genaim, S., and Puebla, G. 2011. Closed-Form Upper Bounds in Static Cost Analysis. Journal of Automated Reasoning 46, 2, 161203.CrossRefGoogle Scholar
Albert, E., Arenas, P., Genaim, S., Puebla, G., and Zanardini, D. 2007. Cost Analysis of Java Bytecode. In Programming Languages and Systems, 16th European Symposium on Programming, ESOP 2007, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2007, Braga, Portugal, March 24 – April 1, 2007, Proceedings, Nicola, R. D., Ed. Lecture Notes in Computer Science, vol. 4421. Springer-Verlag, 157172.Google Scholar
Albert, E., Arenas, P., Genaim, S., Puebla, G., and Zanardini, D. 2008. Removing useless variables in cost analysis of Java Bytecode. In Proceedings of the 2008 ACM Symposium on Applied Computing (SAC), Fortaleza, Ceara, Brazil, March 16–20, 2008, Wainwright, R. L. and Haddad, H., Eds. ACM, 368375.Google Scholar
Albert, E., Arenas, P., Genaim, S., Puebla, G., and Zanardini, D. 2012. Cost analysis of object-oriented bytecode programs. Theoretical Computer Science (Special Issue on Quantitative Aspects of Programming Languages) 413, 1, 142159.Google Scholar
Albert, E., Genaim, S., and Gutiérrez, R. 2014. A transformational approach to resource analysis with typed-norms. In Proc. of the 23rd International Symposium on Logic-based Program Synthesis and Transformation (LOPSTR’13). Lecture Notes in Computer Science, vol. 8901. Springer, 3853.Google Scholar
Albert, E., Genaim, S., and Masud, A. N. 2013. On the inference of resource usage upper and lower bounds. ACM Transactions on Computational Logic 14, 3, 22:122:35.CrossRefGoogle Scholar
Alonso-Blas, D. E., Arenas, P., and Genaim, S. 2011. Handling non-linear operations in the value analysis of COSTA. In Proceedings of the Bytecode 2011 Workshop, the Sixth Workshop on Bytecode Semantics, Verification, Analysis and Transformation (Bytecode). Electronic Notes in Theoretical Computer Science 279, 1. Elsevier, 317.Google Scholar
Bossi, A., Cocco, N., and Fabris, M. 1991. Proving termination of logic programs by exploiting term properties. In APSOFT 1991: Proceedings of the International Joint Conference on Theory and Practice of Software Development, Brighton, UK, April 8–12, 1991, Volume 2: Advances in Distributed Computing (ADC) and Colloquium on Combining Paradigms for Software Developmemnt (CCPSD), Abramsky, S. and Maibaum, T. S. E., Eds. Lecture Notes in Computer Science, vol. 494. Springer, 153180.Google Scholar
Bruynooghe, M., Codish, M., Gallagher, J. P., Genaim, S., and Vanhoof, W. 2007. Termination analysis of logic programs through combination of type-based norms. ACM Transactions on Programming Languages and Systems 29, 2.CrossRefGoogle Scholar
Chin, W.-N. and Khoo, S.-C. 2001. Calculating sized types. Higher-Order and Symbolic Computation 14, 2 (September), 261300.CrossRefGoogle Scholar
Cytron, R., Ferrante, J., Rosen, B. K., Wegman, M. N., and Zadeck, F. K. 1991. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13, 4, 451490.CrossRefGoogle Scholar
Flores-Montoya, A. 2016. Upper and lower amortized cost bounds of programs expressed as cost relations. In FM 2016: Formal Methods – 21st International Symposium, Limassol, Cyprus, November 9–11, 2016, Proceedings, Fitzgerald, J. S., Heitmeyer, C. L., Gnesi, S., and Philippou, A., Eds. Lecture Notes in Computer Science, vol. 9995. Springer, 254273.Google Scholar
Flores-Montoya, A. and Hähnle, R. 2014. Resource analysis of complex programs with cost equations. In Programming Languages and Systems – 12th Asian Symposium, APLAS 2014, Singapore, November 17–19, 2014, Proceedings. LNCS, vol. 8858. Springer, 275295.Google Scholar
Genaim, S., Codish, M., Gallagher, J., and Lagoon, V. 2002. Combining norms to prove termination. In 3rd International Workshop on Verification, Model Checking, and Abstract Interpretation (VMCAI’02), Goos, G., Hartmanis, J., and van Leeuwen, J., Eds. Lecture Notes in Computer Science, vol. 2294. Springer, 123138.Google Scholar
Grobauer, B. 2001. Cost recurrences for DML programs. In International Conference on Functional Programming. 253264.CrossRefGoogle Scholar
Hermenegildo, M. V., Bueno, F., Carro, M., López, P., Mera, E., Morales, J., and Puebla, G. 2012. An overview of ciao and its design philosophy. Theory and Practice of Logic Programming 12, 1–2 (January), 219252. http://arxiv.org/abs/1102.5497.CrossRefGoogle Scholar
Hoffmann, J., Aehlig, K., and Hofmann, M. 2012. Resource aware ML. In 24rd International Conference on Computer Aided Verification (CAV 2012). Lecture Notes in Computer Science, vol. 7358. Springer, 781786.Google Scholar
Hoffmann, J., Das, A., and Weng, S.-C. 2017. Towards automatic resource bound analysis for OCaml. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. POPL 2017. ACM, New York, NY, USA, 359–373.Google Scholar
Hofmann, M. and Jost, S. 2003. Static Prediction of heap space usage for first-order functional programs. In 30th Symposium on Principles of Programming Languages (POPL 2003). ACM Press.CrossRefGoogle Scholar
Hughes, J. and Pareto, L. 1999. Recursion and dynamic data-structures in bounded space: Towards embedded ML programming. In Proc. of ICFP 1999. ACM Press, 70–81.Google Scholar
Hughes, J., Pareto, L., and Sabry, A. 1996. Proving the correctness of reactive systems using sized types. In POPL. 410423.CrossRefGoogle Scholar
Johnsen, E. B., Hähnle, R., Schäfer, J., Schlatte, R., and Steffen, M. 2012. ABS: A Core Language for abstract behavioral specification. In Formal Methods for Components and Objects - 9th International Symposium, FMCO 2010, Graz, Austria, November 29 - December 1, 2010. Revised Papers, Aichernig, B. K., de Boer, F. S., and Bonsangue, M. M., Eds. Lecture Notes in Computer Science, vol. 6957. Springer, 142164.Google Scholar
King, A., Shen, K., and Benoy, F. 1997. Lower-bound time-complexity analysis of logic programs. In 1997 International Logic Programming Symposium, Maluszyński, J., Ed. MIT Press, Cambridge, MA, 261275.Google Scholar
Muthukumar, K. and Hermenegildo, M. 1992. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming 13, 2/3 (July), 315347.CrossRefGoogle Scholar
Nielson, F., Nielson, H. R., and Hankin, C. 1999. Principles of Program Analysis. Springer.CrossRefGoogle Scholar
Vasconcelos, Pedro. 2008. Space cost analysis using sized types. Ph.D. thesis, School of Computer Science, University of St. Andrews.Google Scholar
Pierce, B. C. 2002. Types and Programming Languages. MIT Press.Google Scholar
Puebla, G. and Hermenegildo, M. 1996. Optimized algorithms for the incremental analysis of logic programs. In International Static Analysis Symposium (SAS 1996), vol. 1145. Lecture Notes in Computer Science. Springer-Verlag, 270284.Google Scholar
Sands, D. 1990. Calculi for time analysis of functional programs. Ph.D. thesis, Department of Computing, Imperial College London.Google Scholar
Serrano, A., López-García, P., Bueno, F., and Hermenegildo, M. V. 2013. Sized type analysis for logic programs. Theory and Practice of Logic Programming 13, 4-5-Online-Supplement (August).Google Scholar
Serrano, A., López-García, P., and Hermenegildo, M. V. 2014. Resource usage analysis of logic programs via abstract interpretation using sized types. TPLP 14, 4–5, 739754.Google Scholar
Tarski, A. 1955. A lattice-theoretical fixpoint theorem and its applications. Pacific journal of Mathematics 5, 2, 285309.CrossRefGoogle Scholar
Vasconcelos, P. and Hammond, K. 2003. Inferring cost equations for recursive, polymorphic and higher-order functional programs. In Proceedings of the International Workshop on Implementation of Functional Languages. Lecture Notes in Computer Science, vol. 3145. Springer-Verlag, 86101.Google Scholar
Wegbreit, B. 1975. Mechanical program analysis. Communications ACM 18, 9, 528539.CrossRefGoogle Scholar