skip to main content
article

Reducing calling convention overhead in object-oriented programming on embedded ARM thumb-2 platforms

Published:23 October 2017Publication History
Skip Abstract Section

Abstract

This paper examines the causes and extent of code size overhead caused by the ARM calling convention in Thumb-2 binaries. We show that binaries generated from C++ source files generally have higher amounts of calling convention overhead, and present a binary file optimizer to eliminate some of that overhead. Calling convention overhead can negatively impact power consumption, flash memory costs, and chip size in embedded or otherwise resource-constrained domains. This is particularly true on platforms using "compressed" instruction sets, such as the 16-bit ARM Thumb and Thumb-2 instruction sets, used in virtually all smartphones and in many other smaller-scale embedded devices. In this paper, we examine the extent of calling convention overhead in practical software, and compare the results of C and C++ programs, and find that C++ programs generally have a higher percentage of calling-convention overhead. Finally, we demonstrate a tool capable of eliminating some of this overhead, particularly in the case of C++ programs, by modifying the calling conventions on a per-procedure basis.

References

  1. F. E. Allen and J. Cocke. 1976. A Program Data Flow Analysis Procedure. Commun. ACM 19, 3 (March 1976), 137–. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Talal Bonny and Jörg Henkel. 2010. Huffman-based Code Compression Techniques for Embedded Processors. ACM Trans. Des. Autom. Electron. Syst. 15, 4, Article 31 (Oct. 2010), 37 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Gregory J. Chaitin, Marc A. Auslander, Ashok K. Chandra, John Cocke, Martin E. Hopkins, and Peter W. Markstein. 1981. Register Allocation via Coloring. Comput. Lang. 6, 1 (Jan. 1981), 47–57. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bjorn De Sutter, Ludo Van Put, Dominique Chanet, Bruno De Bus, and Koen De Bosschere. 2007. Link-time Compaction and Optimization of ARM Executables. ACM Trans. Embed. Comput. Syst. 6, 1, Article 5 (Feb. 2007). Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Saumya K. Debray, William Evans, Robert Muth, and Bjorn De Sutter. 2000. Compiler Techniques for Code Compaction. ACM Trans. Program. Lang. Syst. 22, 2 (March 2000), 378–415. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Milenko Drinić, Darko Kirovski, and Hoi Vo. 2007. PPMexe: Program Compression. ACM Trans. Program. Lang. Syst. 29, 1, Article 3 (Jan. 2007). Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. L. Goudge and S. Segars. 1996. Thumb: reducing the cost of 32-bit RISC performance in portable and consumer applications. In Compcon ’96. ’Technologies for the Information Superhighway’ Digest of Papers . 176–181. Google ScholarGoogle ScholarCross RefCross Ref
  8. Darko Kirovski, Johnson Kin, and William H. Mangione-Smith. 1997. Procedure Based Program Compression. In Proceedings of the 30th Annual ACM/IEEE International Symposium on Microarchitecture (MI-CRO 30) . IEEE Computer Society, Washington, DC, USA, 204–213. http://dl.acm.org/citation.cfm?id=266800.266820 Google ScholarGoogle ScholarCross RefCross Ref
  9. Arvind Krishnaswamy and Rajiv Gupta. 2002. Profile Guided Selection of ARM and Thumb Instructions. SIGPLAN Not. 37, 7 (June 2002), 56–64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Arvind Krishnaswamy and Rajiv Gupta. 2005. Dynamic Coalescing for 16-bit Instructions. ACM Trans. Embed. Comput. Syst. 4, 1 (Feb. 2005), 3–37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Feipei Lai and Yung-Kuang Chao. 1994. The complementary relationship of interprocedural register allocation and inlining. In Computer Languages, 1994., Proceedings of the 1994 International Conference on . 253–264. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Feipei Lai and Chia-Jung Hsieh. 1994. Reducing procedure call overhead: optimizing register usage at procedure calls. In Proceedings of 1994 International Conference on Parallel and Distributed Systems . 649– 654. Google ScholarGoogle ScholarCross RefCross Ref
  13. Christian Lindig. 2005. Random Testing of C Calling Conventions. In Proceedings of the Sixth International Symposium on Automated Analysis-driven Debugging (AADEBUG’05) . ACM, New York, NY, USA, 3–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. H. Lozano and M. Ito. 2016. Increasing the Code Density of Embedded RISC Applications. In 2016 IEEE 19th International Symposium on RealTime Distributed Computing (ISORC) . 182–189. Google ScholarGoogle ScholarCross RefCross Ref
  15. David W. Wall. 1986. Global Register Allocation at Link Time. SIGPLAN Not. 21, 7 (July 1986), 264–275. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Vincent M. Weaver and Sally A. McKee. 2009. Code Density Concerns for New Architectures. In Proceedings of the 2009 IEEE International Conference on Computer Design (ICCD’09) . IEEE Press, Piscataway, NJ, USA, 459–464. http://dl.acm.org/citation.cfm?id=1792354.1792441 Google ScholarGoogle ScholarCross RefCross Ref
  17. Andrew Wolfe and Alex Chanin. 1992. Executing Compressed Programs on an Embedded RISC Architecture. SIGMICRO Newsl. 23, 1-2 (Dec. 1992), 81–91. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Reducing calling convention overhead in object-oriented programming on embedded ARM thumb-2 platforms

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 52, Issue 12
        GPCE '17
        December 2017
        258 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3170492
        Issue’s Table of Contents
        • cover image ACM Conferences
          GPCE 2017: Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
          October 2017
          258 pages
          ISBN:9781450355247
          DOI:10.1145/3136040

        Copyright © 2017 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 23 October 2017

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!