COSTA: Design and Implementation of a Cost and Termination Analyzer for Java Bytecode

This paper describes the architecture of costa , an abstract interpretation based cos t and t ermination a nalyzer for Java bytecode. The system receives as input a bytecode program, (a choice of) a resource of interest and tries to obtain an upper bound of the resource consumption of the program. costa provides several non-trivial notions of cost, as the consumption of the heap, the number of bytecode instructions executed and the number of calls to a specific method. Additionally, costa tries to prove termination of the bytecode program which implies the boundedness of any resource consumption. Having cost and termination together is interesting, as both analyses share most of the machinery to, respectively, infer cost upper bounds and to prove that the execution length is always finite (i.e., the program terminates). We report on experimental results which show that costa can deal with programs of realistic size and complexity, including programs which use Java libraries. To the best of our knowledge, this system provides for the first time evidence that resource usage analysis can be applied to a realistic object-oriented, bytecode programming language.

[1]  Frances E. Allen,et al.  Control-flow analysis , 2022 .

[2]  Ben Wegbreit,et al.  Mechanical program analysis , 1975, CACM.

[3]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

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

[5]  Saumya K. Debray,et al.  Cost analysis of logic programs , 1993, TOPL.

[6]  Frank Tip,et al.  A survey of program slicing techniques , 1994, J. Program. Lang..

[7]  David Sands A Na Ve Time Analysis and Its Theory of Cost Equivalence {draft Submitted for Publication{ , 1995 .

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

[9]  Michael T. Goodrich,et al.  Education forum: Web Enhanced Textbooks , 1998, SIGA.

[10]  Michael Codish,et al.  A Semantic Basis for the Termination Analysis of Logic Programs , 1999, J. Log. Program..

[11]  Laurie Hendren,et al.  Soot---a java optimization framework , 1999 .

[12]  Karl Crary,et al.  Resource bound certification , 2000, POPL '00.

[13]  Neil D. Jones,et al.  The size-change principle for program termination , 2001, POPL '01.

[14]  Roberto Bagnara,et al.  Possibly Not Closed Convex Polyhedra and the Parma Polyhedra Library , 2002, SAS.

[15]  Fausto Spoto,et al.  Class analyses as abstract interpretations of trace semantics , 2003, TOPL.

[16]  Manuel V. Hermenegildo,et al.  Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor) , 2005, Sci. Comput. Program..

[17]  Fausto Spoto,et al.  The International Archives of the Photogrammetry , Remote Sensing and Spatial Information Sciences , 1982 .

[18]  George C. Necula,et al.  Enforcing Resource Bounds via Static Verification of Dynamic Checks , 2005, ESOP.

[19]  Manuel V. Hermenegildo,et al.  Abstraction carrying code and resource-awareness , 2005, PPDP.

[20]  G. Barthe,et al.  Mobile Resource Guarantees for Smart Devices , 2005 .

[21]  Étienne Payet,et al.  Path-Length Analysis for Object-Oriented Programs , 2006 .

[22]  Peter Müller,et al.  Formal Translation of Bytecode into BoogiePL , 2007, Electron. Notes Theor. Comput. Sci..

[23]  Elvira Albert,et al.  Heap space analysis for java bytecode , 2007, ISMM '07.

[24]  Elvira Albert,et al.  Cost Analysis of Java Bytecode , 2007, ESOP.

[25]  Yu Chen,et al.  A New Algorithm for Identifying Loops in Decompilation , 2007, SAS.

[26]  Elvira Albert,et al.  Termination Analysis of Java Bytecode , 2008, FMOODS.

[27]  Elvira Albert,et al.  Removing useless variables in cost analysis of Java bytecode , 2008, SAC '08.

[28]  Elvira Albert,et al.  Automatic Inference of Upper Bounds for Recurrence Relations in Cost Analysis , 2008, SAS.

[29]  Brian Campbell,et al.  Amortised Memory Analysis Using the Depth of Data Structures , 2009, ESOP.