skip to main content
article

Refactoring gcc using structure field access traces and concept analysis

Published: 17 May 2005 Publication History

Abstract

Refactoring usually involves statically analyzing source code to understand which transformations safely preserve execution behavior of the program. However, static analysis may not scale well for large programs when analysis results are too general, when tools for analyzing the source code are unwieldy, or when the tools simply do not exist. In such cases, it can be simpler to analyze the program at runtime to gather answers needed for safe code changes. I show how dynamic data can guide refactoring of a single data structure into a hierarchy of classes. Specifically, I show how I refactored the gcc compiler to cut its use of heap memory. In order to partition the declaration data structure into more efficiently-sized parts, I used data structure field access traces to automatically identify how the data structure might be refactored. I also identified other potential refactorings of the data structure using concept analysis. These results then guided by-hand modifications to the compiler. I finally evaluated what size test cases would be needed to gather adequate information to correctly perform the refactoring. The case study showed the refactoring could be performed with the dynamic information, but without traces from an exhaustive set of test cases, some fields would be moved incorrectly.

References

[1]
Canfora, G., Cimitile, A., Munro, M., & Tortorella, M. (1993). Experiments in Identifying Reusable Abstract Data Types in Program Code. In <IEEE Conference on Program Comprehension, (pp. 36--45). Capri, Italy: IEEE Computer Society Press.
[2]
Casais, E. (1993). The Automatic Reorganization of Object Oriented Hierarchies. In E. Casais & C. Lewerentz (Eds.), <Building Object Oriented Software Libraries Karlsruhe, Germany: FZI Publication.
[3]
Chilimbi, T., Davidson, B., & Larus, J. (1999) Cache-Conscious Structure Definitions. In PLDI '99, p. 13--24.
[4]
Ernst, M. D., J. Cockrell, et al. (2001). "Dynamically Discovering Likely Program Invariants to Support Program Evolution." IEEE Transactions on Software Engineering 27(2): 99--123.
[5]
Fowler, M., Beck, K., Brant, J., et al. (1999). Refactoring: Improving the Design of Existing Code. Addison Wesley.
[6]
Ganser, B. and R. Wille, (1999). Formal Concept Analysis - Mathematical Foundations. Springer-Verlag.
[7]
Griswold, W. G. and D. Notkin (1993). "Automated Assistance for Program Restructuring." ACM Transactions on Software Engineering and Methodology 2(3): 228--269.
[8]
Kataoka, Y., Ernst, M. D., Griswold, W. G., & Notkin, D. (2001). Automated support for program refactoring using invariants. In <ICSM 2001. (pp. 736--743). Florence, Italy.
[9]
Opdyke, W. F. (1991) Refactoring: A Program Restructuring Aid in Designing Object-Oriented Application Frameworks. Ph.D. thesis, University of Illinois, Urbana-Champaign.
[10]
Roberts, D., Brandt, J., and Johnson, R. E. (1997). A Refactoring Browser for Smalltalk. Theory and Practice of Object Systems, Vol 3, No. 4.
[11]
Roberts, D. (1999) Eliminating Analysis in Refactoring. Ph.D. dissertation, University of Illinois at Urbana-Champaign.
[12]
Snelting, G., & Tip, F. (2000). Reengineering Class Hierarchies Using Concept Analysis. ACM Transactions on Programming Languages and Systems, May 2000, 540--582.
[13]
Strechenbach, M., & Snelting, G. (2004). Refactoring Class Hierarchies with KABA. OOPSLA '04, October 2004.
[14]
Tonella, P., & Ceccato, M. (2004). Aspect Mining Through the Formal Concept Analysis of Execution Traces. In <IEEE 11th Working Conference on Reverse Engineering, (pp. 112--121).
[15]
Trolltech (2004) Qt cross-platform GUI library, version 3.3.2. www.trolltech.com.
[16]
van Deursen, A., & Kuipers, T. (1999) Identifying Objects Using Cluster and Concept Analysis. ICSE '99, p. 246--255.
[17]
Yevtushenko, S. A. (2000). System of data analysis "Concept Explorer" (in Russian.). In 7th National Conference on Artificial Intelligence KII-2000, (pp. 127--134). (Available at http://sourceforge.net/projects/conexp)

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGSOFT Software Engineering Notes
ACM SIGSOFT Software Engineering Notes  Volume 30, Issue 4
July 2005
1514 pages
ISSN:0163-5948
DOI:10.1145/1082983
Issue’s Table of Contents
  • cover image ACM Other conferences
    WODA '05: Proceedings of the third international workshop on Dynamic analysis
    May 2005
    75 pages
    ISBN:1595931260
    DOI:10.1145/1083246
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: 17 May 2005
Published in SIGSOFT Volume 30, Issue 4

Check for updates

Author Tags

  1. case study
  2. gcc
  3. meaning-preserving restructuring

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 343
    Total Downloads
  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)1
Reflects downloads up to 16 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