skip to main content
10.1145/1363686.1363779acmconferencesArticle/Chapter ViewAbstractPublication PagessacConference Proceedingsconference-collections
research-article

Removing useless variables in cost analysis of Java bytecode

Published: 16 March 2008 Publication History

Abstract

Automatic cost analysis has interesting applications in the context of verification and certification of mobile code. For instance, the code receiver can use cost information in order to decide whether to reject mobile code which has too large cost requirements in terms of computing resources (in time and/or space) or billable events (SMSs sent, bandwidth required). Existing cost analyses for a variety of languages describe the resource consumption of programs by means of Cost Equation Systems (CESs), which are similar to, but more general than recurrence equations. CESs express the cost of a program in terms of the size of its input data. In a further step, a closed form (i.e., non-recursive) solution or upper bound can sometimes be found by using existing Computer Algebra Systems (CASs), such as Maple and Mathematica. In this work, we focus on cost analysis of Java bytecode, a language which is widely used in the context of mobile code and we study the problem of identifying variables which are useless in the sense that they do not affect the execution cost and therefore can be ignored by cost analysis. We identify two classes of useless variables and propose automatic analysis techniques to detect them. The first class corresponds to stack variables that can be replaced by program variables or constant values. The second class corresponds to variables whose value is cost-irrelevant, i.e., does not affect the cost of the program. We propose an algorithm, inspired in static slicing which safely identifies cost-irrelevant variables. The benefits of eliminating useless variables are two-fold: (1) cost analysis without useless variables can be more efficient and (2) resulting CESs are more likely to be solvable by existing CASs.

References

[1]
A. V. Aho, J. E. Hopcroft, and J. D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.
[2]
A. V. Aho, R. Sethi, and J. D. Ullman. Compilers - Principles, Techniques and Tools. Addison-Wesley, 1986.
[3]
E. Albert, P. Arenas, S. Genaim, G. Puebla, and D. Zanardini. Cost analysis of java bytecode. In Proc. of ESOP'07, volume 4421 of LNCS. Springer, 2007.
[4]
E. Albert, P. Arenas, S. Genaim, G. Puebla, and D. Zanardini. Experiments in Cost Analysis of Java Bytecode. In ETAPS Workshop on Bytecode Semantics, Verification, Analysis and Transformation (BYTECODE'07), volume 190, Issue 1 of Electronic Notes in Theoretical Computer Science, pages 67--83. Elsevier - North Holland, July 2007.
[5]
E. Albert, G. Puebla, and M. Hermenegildo. Abstraction-Carrying Code: A Model for Mobile Code Safety. New Generation Computing, 2007. To appear.
[6]
Elvira Albert, Samir Genaim, and Miguel Gomez-Zamalloa. Heap Space Analysis for Java Bytecode. In ISMM '07: Proceedings of the 6th international symposium on Memory management, pages 105--116, New York, NY, USA, October 2007. ACM Press.
[7]
Frances E. Allen. Control flow analysis. In Proceedings of a symposium on Compiler optimization, pages 1--19, 1970.
[8]
M. Allen and S. Horwitz. Slicing java programs that throw and catch exceptions. In ACM PEPM, 2003.
[9]
D. Aspinall, S. Gilmore, M. Hofmann, D. Sannella, and I. Stark. Mobile Resource Guarantees for Smart Devices. In CASSIS'04, LNCS, 2005.
[10]
R. Benzinger. Automated higher-order complexity analysis. Theor. Comput. Sci., 318(1--2), 2004.
[11]
P. Cousot and R. Cousot. Abstract Interpretation: a Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In Proc. of POPL'77, pages 238--252, 1977.
[12]
K. Crary and S. Weirich. Resource bound certification. In POPL. ACM, 2000.
[13]
S. K. Debray and N. W. Lin. Cost analysis of logic programs. TOPLAS, 15(5), 1993.
[14]
S. K. Debray, P. López-García, M. Hermenegildo, and N.-W. Lin. Lower Bound Cost Estimation for Logic Programs. In ILPS'97. MIT Press, 1997.
[15]
S. Genaim and F. Spoto. Information Flow Analysis for Java Bytecode. In Proc. of VMCAI, LNCS. Springer-Verlag, 2005.
[16]
G. Gomez and Y. A. Liu. Automatic time-bound analysis for a higher-order language. In PEPM. ACM Press, 2002.
[17]
M. Hermenegildo, E. Albert, P. López-García, and G. Puebla. Abstraction Carrying Code and Resource-Awareness. In Proc. of PPDP'05. ACM Press, July 2005.
[18]
J. Jouannaud and W. Xu. Automatic Complexity Analysis for Programs Extracted from Coq Proof. ENTCS, 153(1):35--53, 2006.
[19]
T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley, 1996.
[20]
J. W. Lloyd. Logic Programming. Springer-Verlag, 1987.
[21]
J. Navas, E. Mera, P. López-García, and M. Hermenegildo. User-Definable Resource Bounds Analysis for Logic Programs. In 23rd International Conference on Logic Programming (ICLP 2007), volume 4670 of LNCS, pages 348--363. Springer-Verlag, September 2007.
[22]
G. Necula. Proof-Carrying Code. In POPL'97. ACM Press, 1997.
[23]
F. A. Rabhi and G. A. Manson. Using Complexity Functions to Control Parallelism in Functional Programs. TR. CS-90-1, Dept. of C. S., Univ. of Sheffield, UK, 1990.
[24]
M. Rosendhal. Automatic Complexity Analysis. In FPCA. ACM, 1989.
[25]
D. Sands. A naïve time analysis and its theory of cost equivalence. J. Log. Comput., 5(4), 1995.
[26]
S. Secci and F. Spoto. Pair-sharing analysis of object-oriented programs. In SAS, pages 320--335, 2005.
[27]
F. Tip. A Survey of Program Slicing Techniques. J. of Prog. Lang., 3, 1995.
[28]
T. Wang and A. Roychoudhury. Dynamic Slicing on Java Bytecode Traces. ACM Transactions on Programming Languages and Systems, 2007. To appear.
[29]
M. Weiser. Program slicing. In Proc. Int. Conf. on Software Engineering, pages 439--449. IEEE Computer Society Press, 1981.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SAC '08: Proceedings of the 2008 ACM symposium on Applied computing
March 2008
2586 pages
ISBN:9781595937537
DOI:10.1145/1363686
Permission to make digital or hard copies of all or part 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 components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 16 March 2008

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. complexity
  2. cost analysis
  3. cost equations systems
  4. information flow
  5. java bytecode
  6. program slicing

Qualifiers

  • Research-article

Funding Sources

Conference

SAC '08
Sponsor:
SAC '08: The 2008 ACM Symposium on Applied Computing
March 16 - 20, 2008
Fortaleza, Ceara, Brazil

Acceptance Rates

Overall Acceptance Rate 1,650 of 6,669 submissions, 25%

Upcoming Conference

SAC '25
The 40th ACM/SIGAPP Symposium on Applied Computing
March 31 - April 4, 2025
Catania , Italy

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 07 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media