Skip to main content

Code Specialization Based on Value Profiles

  • Conference paper
Static Analysis (SAS 2000)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1824))

Included in the following conference series:

Abstract

It is often the case at runtime that variables and registers in programs are “quasi-invariant,” i.e., the distribution of the values they take on is very skewed, with a small number of values occurring most of the time. Knowledge of such frequently occurring values can be exploited by a compiler to generate code that optimizes for the common cases without sacrificing the ability to handle the general case. The idea can be generalized to the notion of expression profiles, which profile the runtime values of arbitrary expressions and can permit optimizations that may not be possible using simple value profiles. Since this involves the introduction of runtime tests, a careful cost-benefit analysis is necessary to make sure that the benefits from executing the code specialized for the common values outweigh the cost of testing for these values. This paper describes a static cost-benefit analysis that allows us to discover when such specialization is profitable. Experimental results, using such an analysis and an implementation of low-level code specialization based on value and expression profiles within a link-time code optimizer, are given to validate our approach.

This work was supported in part by the National Science Foundation under grants CDA-9500991, CCR-9711166, and ASC-9720738.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aigner, G., Hölzle, U.: Eliminating Virtual Function Calls in C++ Programs. In: Cointe, P. (ed.) ECOOP 1996. LNCS, vol. 1098, pp. 142–166. Springer, Heidelberg (1996)

    Google Scholar 

  2. Andersen, L.O., Gomard, C.K.: Speedup Analysis in Partial Evaluation (Preliminary Results). In: Proc. ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, June 1992, pp. 1–7 (1992) (Also available as Research Report YALEU/DCS/RR-909, Department of Computer Science, Yale University, New Haven, CT)

    Google Scholar 

  3. Auslander, J., Philipose, M., Chambers, C., Eggers, S.J., Bershad, B.N.: Fast, Effective Dynamic Compilation. In: Proc. SIGPLAN 1996 Conference on Programming Language Design and Implementation, June 1996, pp. 149–159 (1996)

    Google Scholar 

  4. Bala, V., Duesterwald, E., Banerjia, S.: Transparent Dynamic Optimization: The Design and Implementation of Dynamo, Technical Report HPL-1999-78, Hewlett-Packard Laboratories, Cambridge, Mass. (June 1999)

    Google Scholar 

  5. Bernstein, R.L.: Producing Good Code for the Case Statement. Software— Practice and Experience 15(10), 1021–1024 (1985)

    Article  Google Scholar 

  6. Calder, B., Feller, P., Eustace, A.: Value Profiling. In: Proc. 30th International Symposium on Microarchitecture, December 1997, pp. 259–269 (1997)

    Google Scholar 

  7. Calder, B., Feller, P., Eustace, A.: Value Profiling and Optimization. Journal of Instruction-Level Parallelism 1, 1–6 (1999)

    Google Scholar 

  8. Consel, C., Noël, F.: A General Approach for Run-time Specialization and its Application to C. In: Proc. 23rd Annual ACM Symposium on Principles of Programming Languages, January 1996, pp. 145–156 (1996)

    Google Scholar 

  9. Cousot, P., Cousot, R.: Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Apporoximation of Fixpoints. In: Proc. Fourth ACM Symposium on Principles of Programming Languages, pp. 238–252 (1977)

    Google Scholar 

  10. Davidson, J., Jinturkar, S.: Memory Access Coalescing: A Technique for Eliminating Redundant Memory Accesses. In: Proc. SIGPLAN 1994 Symposium on Programming Language Design and Implementation, June 1994, pp. 186–195 (1994)

    Google Scholar 

  11. Davidson, J.W., Jinturkar, S.: Aggressive Loop Unrolling in a Retargetable Optimizing Compiler., in Proc. CC 1996: Compiler Construction (April 1996)

    Google Scholar 

  12. Grant, B., Mock, M., Philipose, M., Chambers, C., Eggers, S. J.: DyC: An Expressive Annotation-Directed Dynamic Compiler for C, Technical Report UWCSE- 97-03-03 (January 1998) (updated May 1999)

    Google Scholar 

  13. Grant, B., Philipose, M., Mock, M., Chambers, C., Eggers, S.J.: An Evaluation of Staged Run-time Optimizations in DyC. In: Proc. SIGPLAN 1999 Conference on Programming Language Design and Implementation, May 1999, pp. 293–304 (1999)

    Google Scholar 

  14. Hölzle, U., Agesen, O.: Dynamic vs. Static Optimization Techniques for Object- Oriented Languages. Theory and Practice of Object Systems 1(3) (1996)

    Google Scholar 

  15. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, Englewood Cliffs (1993)

    MATH  Google Scholar 

  16. Mock, M., Berryman, M., Chambers, C., Eggers, S.J.: Calpa: A Tool for Automating Dynamic Compilation. In: Proc. 2nd. ACM Workshop on Feedback-Directed Optimization (November 1999), Available as http://www-cse.ucsd.edu/users/calder/fdo/fdo2-mock.ps

  17. Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufman, San Francisco (1997)

    Google Scholar 

  18. Muth, R., Debray, S.K., Watterson, S., De Bosschere, K.: alto: A Link- Time Optimizer for the DEC Alpha, Technical Report 98-14, Dept. of Computer Science, The University of Arizona (December 1998)

    Google Scholar 

  19. Wegman, M.N., Zadeck, F.K.: Constant Propagation with Conditional Branches. ACM Transactions on Programming Languages and Systems 13(2), 181–210 (1991)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Muth, R., Watterson, S., Debray, S. (2000). Code Specialization Based on Value Profiles. In: Palsberg, J. (eds) Static Analysis. SAS 2000. Lecture Notes in Computer Science, vol 1824. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-45099-3_18

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-45099-3_18

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-67668-3

  • Online ISBN: 978-3-540-45099-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics