Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Resource Contracts for Java

Published: 05 January 2017 Publication History

Abstract

Writing specifications about program behavior is hard. Writing specifications about non-functional effects such as resource usage is often even harder. If manually instrumenting the program is not an option, programmers have to rely on comment-based specification languages like JML to introduce ghost variables and other fairly abstract concepts that are complicated and hard to maintain. Even worse, most static analysis tools nowadays operate on bit- or bytecode and cannot process those type of specifications
To address this problem, we propose a library-based specification formalism for time complexity in Java. The approach is inspired by the success of assertion libraries like CodeContracts and Guava. Our library provides a set of methods and enumerated types that allow the user to write complexity assertions in a 'human' readable form and without instrumenting the code. On the backend, we provide a bytecode rewriting tool that uses these assertions to automatically instrument the program with counter variables. The transformed program can then be checked via testing or off-the-shelf automated static analyzers

References

[1]
E. Albert, R. Bubel, S. Genaim, R. Hähnle, G. Puebla, and G. Román-Díez. Verified resource guarantees using COSTA and KeY. In PEPM '11, pages 73--76. ACM, 2011.
[2]
J. Barnes. High Integrity Software, The SPARK Approach to Safety and Security. Praxis Critical Systems Limited, 2006.
[3]
P. Baudin, P. Cuoq, J.-C. Filliâtre, C. Marché, B. Monate, Y. Moy, and V. Prevosto. ACSL: ANSI/ISO C Specification Language, ver. 1.5, 2010.
[4]
A. R. Bradley, Z. Manna, and H. B. Sipma. Linear ranking with reachability. In CAV '05, pages 491--504. Springer, 2005.
[5]
M. Colón and H. Sipma. Synthesis of linear ranking functions. In TACAS '01, pages 67--81, 2001.
[6]
L. De Moura and N. Bjørner. Z3: An efficient SMT solver. In TACAS '08, pages 337--340, Berlin, Heidelberg, 2008. Springer-Verlag.
[7]
E. W. Dijkstra. A Discipline of Programming. Prentice-Hall, 1976.
[8]
M. Fähndrich and F. Logozzo. Static contract checking with abstract interpretation. In FoVeOOS '10, Revised Selected Papers, pages 10--30. Springer, 2011.
[9]
B. S. Gulavani and S. Gulwani. A numerical abstract domain based on expression abstraction and max operator with application in timing analysis. In Computer Aided Verification, LNCS 5123, pages 370--384. Springer, 2008.
[10]
S. Gulwani. SPEED: Symbolic complexity bound analysis. In CAV '09, pages 51--62. Springer, 2009.
[11]
C. A. R. Hoare. An axiomatic basis for computer programming. Communications of the ACM, 12(10):576--580, 583, Oct. 1969.
[12]
J. Jézéquel and B. Meyer. Design by contract: The lessons of Ariane. IEEE Computer, 30(1), 1997.
[13]
C. Jones. Development Methods for Computer Programs including a Notion of Interference. PhD thesis, Oxford University, 1981.
[14]
T. Kahsai, P. Rummer, H. Sanchez, and M. Schaf. JayHorn: A framework for verifying Java programs. In CAV '16, 2016.
[15]
R. Kersten, P. Parisen Toldin, B. van Gastel, and M. van Eekelen. A Hoare logic for energy consumption analysis. In FOPARA '13, LNCS 8552, pages 93--109. Springer, 2014.
[16]
R. Kersten, B. van Gastel, O. Shkaravska, M. Montenegro, and M. van Eekelen. ResAna: a resource analysis toolset for (real-time) JAVA. Concurrency and Computation: Practice and Experience, 26(14):2432--2455, 2014.
[17]
R. W. J. Kersten, O. Shkaravska, B. E. van Gastel, M. Montenegro, and M. C. J. D. van Eekelen. Making resource analysis practical for Real-Time Java. In JTRES'12, pages 135--144, 2012.
[18]
G. T. Leavens, A. L. Baker, and C. Ruby. JML: a java modeling language. In Formal Underpinnings of Java Workshop (at OOPSLA '98), 1998.
[19]
K. R. M. Leino. Dafny: An automatic program verifier for functional correctness. In LPAR '16, LNCS 6355, pages 348--370. Springer, 2010.
[20]
B. Meyer. Applying "design by contract". IEEE Computer, 25(10):40--51, Oct. 1992.
[21]
C. Pacheco and M. D. Ernst. Randoop: Feedback-directed random testing for java. In OOPSLA '07, pages 815--816. ACM, 2007.
[22]
A. Podelski and A. Rybalchenko. A Complete Method for the Synthesis of Linear Ranking Functions. In VMCAI, pages 239--251, 2004.
[23]
C. S. Păsăreanu, P. C. Mehlitz, D. H. Bushnell, K. Gundy-Burlet, M. Lowry, S. Person, and M. Pape. Combining unit-level symbolic execution and system-level concrete execution for testing NASA software. In ISSTA'08, pages 15--26, 2008.
[24]
P. Rümmer, H. Hojjat, and V. Kuncak. Disjunctive interpolants for Horn-clause verification. In CAV'13, pages 347--363. Springer, 2013.
[25]
R. Sharma, S. Gupta, B. Hariharan, A. Aiken, P. Liang, and A. Nori. A data driven approach for algebraic loop invariants. In Programming Languages and Systems, LNCS 7792, pages 574--592. Springer, 2013.
[26]
O. Shkaravska, R. Kersten, and M. Van Eekelen. Test-based inference of polynomial loop-bound functions. In PPPJ'10, pages 99--108. ACM, 2010.
[27]
G. Soares, R. Gheyi, and T. Massoni. Automated behavioral testing of refactoring engines. IEEE Trans. Softw. Eng., 39(2):147--162, Feb. 2013.
[28]
C. Urban, A. Gurfinkel, and T. Kahsai. Synthesizing ranking functions from bits and pieces. In TACAS '16, pages 54--70, 2016.
[29]
R. Wilhelm, J. Engblom, A. Ermedahl, N. Holsti, S. Thesing, D. Whalley, G. Bernat, C. Ferdinand, R. Heckmann, T. Mitra, F. Mueller, I. Puaut, P. Puschner, J. Staschulat, and P. Stenström. The worst-case execution-time problem -- overview of methods and survey of tools. ACM Trans. Embed. Comput. Syst., 7(3):36:1--36:53, May 2008.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGSOFT Software Engineering Notes
ACM SIGSOFT Software Engineering Notes  Volume 41, Issue 6
November 2016
110 pages
ISSN:0163-5948
DOI:10.1145/3011286
Issue’s Table of Contents
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 05 January 2017
Published in SIGSOFT Volume 41, Issue 6

Check for updates

Author Tags

  1. Code contracts
  2. Complexity Analysis
  3. Resource analysis

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 31
    Total Downloads
  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)0
Reflects downloads up to 02 Feb 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media