article

Efficient dynamic dispatch without virtual function tables: the SmallEiffel compiler

Abstract

SmallEiffel is an Eiffel compiler which uses a fast simple type inference mechanism to remove most late binding calls, replacing them by static bindings. Starting from the system's entry point, it compiles only statically living code, which saves compiling and then removing dead code. As the whole system is analyzed at compile time, multiple inheritance and genericity do not cause any overhead.SmallEiffel features a coding scheme which eliminates the need for virtual function tables. Dynamic dispatch is implemented without any array access but uses a simple static binary branch code. We show that this implementation makes it possible to use modern hardware very efficiently. It also allows us to inline more calls even when dynamic dispatch is required. Some more dispatch sites are removed after the type inference algorithm has been performed, if the different branches of a dispatch site lead to the same code.The advantage of this approach is that it greatly speeds up execution time and considerably decreases the amount of generated code.

References

  1. Age95 Ole Kgesen. The Cartesian Product Algorithm- Simple and Precise Type Inference of Parametric Polymorphism. In Proceedings of the 9th European Conference on Object-Oriented Programming (ECOOP'95), volume 952 of Lecture Notes in Computer Sciences, pages 2-26. Springer-Verlag, i995. Google ScholarGoogle Scholar
  2. Age96 Ole Agesen,Concrete Type Inference: Delivering Object-Oriented Applications. PhD thesis, Department of Computer Science of Stanford University, Published by Sun Microsystem Laboratories (SMLI TR-96-52), 1996. , Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. AH95 Ole Agesen and;Urs HSlzle. Type Feedback vs. Concrete Type inference: A Comparison of Optimization Techniques for Object- Oriented Languages. in Proceedings of lOth Annual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA'95), pages 91-107, I995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. AH96 Gerald Aigner and Urs H6lzle. Eliminating Virtual Function Calls in C++ Programs. In proceedings of the l Oth European Conference on Object-Oriented Programming (ECOOP'96), volume 1098 of Lecture Notes in Computer Sciences, pages 142- 166. Springer-Verlag, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. APS93 Ole Agesen, Jens Palsberg, and Michael I. Schwartzbach. Type Inference of SELF. Analysis of Objects with Dynamic and Multi:~ ple Inheritance. in Proceedings of the 7th European Conference on Object-Oriented Pro- (zvoOP'9s), vo/um 707 of ture Notes in Computer Sciences, pages 247- 267. Springer-Verlag, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. AU77 Alfred V. Ah0 and Jeffrey D. Ullman. Principles o/Compiler Design. Addison-Wesley, eading~ Massachusetts, 1977. ~ 'Google ScholarGoogle Scholar
  7. BS96 David F. Bacon and Peter F. Sweeney. Fast Static' Analysis of C++ Virtual Function Calls. In Proceedings'of llthAnnual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOP- SLA '96), pages 324-341~, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. CCZ97 Suzanne Collin, Dominique Colnet,~ and Olivier Zendra. Type Inference for Late Binding. The SmaUEiffel Compiler. In Joint Modular Languages Conference, volume 1204 of Lecture Notes in Computer Sciences, pages 67-81. Springer-Vedag, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. CF91 Robert Cartwright and Mike Fagan. Soft Typing. in Proceedings of the A CM SIG- PLAN '91 Conference on Programming Language Design and Implementation, pages 278-292, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. CG94a Brad Calder and Dirk Grunwald. Reducing Indirect Function Call Overhead In C++ Programs. In 21st Annual A CM Symposium on the Principles of Programming Languages, pages 397-408, :lanua~y 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. CG94b Diane Corney and ,John Gough. Type Tes~ Elimination using Typeflow Analysis. in PLSA 199~ International Conference, Zurich, volume 782 of Lecture Notes in Computer Sciences, pages 137-150. Spfinget- Verlag, 1994. Google ScholarGoogle Scholar
  12. CU89 Craig Chambers and David Ungar. Customization: Optimizing Compiler Technology for SELF~ a Dynamically-Typed Object- Oriented Language. In Proceedings of the A CM S{GPLAN '89 Conference on Programming Language Design and Implementation, volume 24 of SIGPLAN notices, pa~ 146- 160, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. DDG+96 Jeffrey Dean, Greg DeFouw, David Grove, Vassily Litvinov, and Craig Chambers. Vortex: An Optimizing Compiler for Object- Oriented Languages. In Proceedings of 11th Annual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '96), pages 83-100, 1996. Google ScholarGoogle Scholar
  14. DGC95 Jeffrey Dean, David Grove, and Craig Chambers. Optimization of Object-Oriented Programs Using Static Class Hierarchy, Analysis. In Proceedings of the 9th European , Conference on Object-Oriented Programming (ECOOP'95}, volume 952 of Lecture Notes in Computer Sciences, pages 77-101. Springer- Verlag, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. DH96 Karel Driesen and Urs HSlzle. The Direct. Cost of Virtual Function Calls in C++. In Proceedings of 11th Annual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA'96}, pages 306-323, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Dha91 D.M. Dhamdhere. Practical Adaptation of the Global Optimization Algorithm of Morel and Renvoise. A CM Transactions on Programming Languages and Systems, 13(2):291-294, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. DHV95 Karel Driesen, Urs Htilzle, and Jan Vitek. Message Dispatch on Pipelined Processors. in Proceedings of the #th European Conference on Object-Oriented Programming (EGOOP'95), volume 952 of Lecture Notes in Computer Sciences, pages 253-282. Springer- Verlag, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. DMM96 Amer Diwan, J. Eliot B. Moss, and Kathryn' S. McKinley. Simple and Effective Analysis of Statically-Typed Object- Oriented Programs. in Rroceedings of 11th Annual A CM Conference on Object-Oriented Programming Systems, Languages and Appli. cations (OOPSLA '96}, pages 292-305, 1996. Google ScholarGoogle Scholar
  19. DS84 Peter L. Deutsch and Alan Sehiffman, Efficient Implementation of the Smalltalk-80 System. In 11th Annual A GM Symposium on the Principles of Programming Languages~ 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. EST95 Jonathan Eifrig, Scott Smith, and Valery Trifonov. Sound Polymorphic Type Inference for Objects. In Proceedings of lflth Annual A CM Conference on Object.Oriented Programming Systems, Languages and Applications (OOPSLA '95), pages 169-184, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. GJ90 J. Graver and R. Johnson. A Type System for Smalltalk. In 17th Annual A GM 5ympo. slum on the Principles of Programming Lan. guages, pages 139-150, 1990. Google ScholarGoogle Scholar
  22. GR83 A. Goldbe~g and D. Robson. Smalltalk. 80, the Language and its Implementation. Addison-Wesley, Reading, Massachusetts, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. HCU91 Urs H61zle, Craig Chambers, and David Ungar. Optimizing Dynamically-Typed Object- Oriented Languages With Polymorphic Inline Caches. In Proceedings of the 5th European Conference on Object-Oriented Programming (EGOOP'91), volume 512 of Lecture Notes in Computer Sciences, pages 21- 38. Springer-Verlag, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. HU95 Urs H61zle and David Ungar. Do Objec~ Oriented Languages Need Special Hardware Support ? in Proceedings of the 9th European Conference on Object-Oriented Programming (ECOOP'95), volume 952 of Lecture Notes in Computer :~ciences, pages 283-302. Springer- Verlag, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. JGS96 Bill Joy James Gosling and Guy Steele. The Java Language Specification. Addison Weseey, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. KRS94 lens Knoop, Oliver Ruthing, and Bernhard Steffen. Partial Dead Code Elimination. In Proceedings of the ACM SIGPLAN '9~ Conference on Programming Language Design and Implementation, pages 147-10000, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Mey88 Bertrand Meyer. Object-oriented Software Construction. Prentice Hall, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Mey94 Bertrand Meyer. Eiffel, The Language. Prentice Hall, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Mil78 R. Milner. A Theory of Type Polymorphism in Programming. In Journal of Computer and System Sciences, pages 348-375, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  30. MNC+91 G. Masini, A. Napoli, D. Colnet, D. L6onard, and K. Tombre. Object Oriented Languages. Academic Press Limited, London, 1991.Google ScholarGoogle Scholar
  31. PC94 John Plevyak and Andrew A. Chien. Precise Concrete Type Inference for Object-Oriented languages." In Proceedings of 9th Annual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '9~), pages 324-340, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. PS91 Jens Palsberg and Michael I. Schwartzbach. Object-Oriented Type Inference. In Proceedings of 6th Annual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA'91), pages 146-161, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. PS92 J. Palsberg and M.I. Schwartzbach. Safety Analysis Versus Type Inference for partial Types. Information Processing Letters, pages i75-180, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Ros88 John R. Rose. Fas~ Dispatch Mechanisms for Stock Hardware. In Proceedings of 3rd Annual A CM Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '88), pages 27-35, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. ST84 N. Suzuki and M. Terada. Creating Efficient System for Object-Oriented Languages. In 11th Annual A CM Symposium on the Principles of Pro#ramming Languages, pages 290- 296, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Str86 B. S~roustrup. The C++ Programming Language. Addison-Wesley Series in Computer Science, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Suz81 N. Suzuki. Inferring Types in Smalltalk. In Eighth Symposium on Principles of Programming Languages, pages 187-199, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. UP87 David Ungar and David Patterson. What Price Small~a/k ? IF, EE Computer, 20(1), 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. US87 David Ungar and Randall B. Smith. Self: The Power of Simplicity. In Proceedings of 2nd Annual A GM Conference on Object- Oriented Programming Systems, Languages and Applications (OOPSLA '87), pages 227- 241, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. VHU92 Jan Vitek, R. Nigel Horspool, and James S. Uhl. Compile-Time Analysis of Object- Oriented Programs. In International Conference on Compiler Construction, volume 641 of Lecture Notes in Computer Sciences, pages 237-250. Spriager-Verlag, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Efficient dynamic dispatch without virtual function tables: the SmallEiffel compiler

      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

      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!