Abstract
Subtype tests are an important issue in the implementation of object-oriented programming languages. Many techniques have been proposed, but none of them perfectly fulfills the five requirements that we have identified: constant-time, linear-space, multiple inheritance, dynamic loading and inlining. In this article, we propose a subtyping test implementation that involves a combination of usual hashtables and Cohen's display, which is a well-known technique for single inheritance hierarchies. This novel approach is based on perfect hashing, that is, an optimized and truly constant-time variant of hashing that applies to immutable hashtables. We show that the resulting technique closely meets all five requirements. Furthermore, in the framework of Java-like languages—characterized by single inheritance of classes and multiple subtyping of interfaces—perfect hashing also applies to method invocation when the receiver is typed by an interface. The proposed technique is compared to some alternatives, including the proposal by Palacz and Vitek [2003]. Time-efficiency is assessed at the cycle level in the framework of Driesen's pseudo-code and the linear-space criterion is validated by statistical simulation on benchmarks consisting of large-scale class hierarchies.
- Agrawal, R., Borgida, A., and Jagadish, H. 1989. Efficient management of transitive relationships in large data and knowledge bases. In Proceedings of SIGMOD'89. ACM SIGMOD Record, 18, 2, 253--262. Google Scholar
Digital Library
- Aït-Kaci, H., Boyer, R., Lincoln, P., and Nasr, R. 1989. Efficient implementation of lattice operations. ACM Trans. Program. Lang. Syst. 11, 1, 115--146. Google Scholar
Digital Library
- Alavi, H. S., Gilbert, S., and Guerraoui, R. 2008. Extensible encoding of type hierarchies. In Proceedings of the 35th ACM Symposium on Principles of Programming Languages (POPL'08). ACM, 349--358. Google Scholar
Digital Library
- Alpern, B., Cocchi, A., Fink, S., and Grove, D. 2001a. Efficient implementation of Java interfaces: Invokeinterface considered harmless. In Proceedings of the 16th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'01). SIGPLAN Notices, 36, 10, ACM, New York, 108--124. Google Scholar
Digital Library
- Alpern, B., Cocchi, A., and Grove, D. 2001b. Dynamic type checking in Jalapeño. In Proceedings of the USENIX JVM'01. Google Scholar
Digital Library
- Bacon, D. and Sweeney, P. 1996. Fast static analysis of C++ virtual function calls. In Proceedings of the 11th Annual on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'96). SIGPLAN Notices, 31, 10, ACM, New York, 324--341. Google Scholar
Digital Library
- Barnes, J. 1995. Programming In Ada 95, first edition. Addison-Wesley, Reading, MA. Google Scholar
Digital Library
- Caseau, Y. 1993. Efficient handling of multiple inheritance hierarchies. In Proceedings of the 8th Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'93). ACM, New York, 271--287. Google Scholar
Digital Library
- Chaitin, G. J. 1982. Register allocation & spilling via graph coloring. In Proceedings of the 1982 ACM SIGPLAN Symposium on Compiler Construction. ACM, New York, 98--105. Google Scholar
Digital Library
- Click, C. and Rose, J. 2002. Fast subtype checking in the Hotspot JVM. In Proceedings of the ACM-ISCOPE conference on Java Grande (JGI'02). ACM, New York, 96--107. Google Scholar
Digital Library
- Cohen, N. 1991. Type-extension type tests can be performed in constant time. ACM Trans. Program. Lang. Syst. 13, 4, 626--629. Google Scholar
Digital Library
- Collin, S., Colnet, D., and Zendra, O. 1997. Type inference for late binding. the SmallEiffel compiler. In Proceedings of the Joint Modular Languages Conference. Lecture Notes in Computer Science, vol. 1204. Springer-Verlag, New York, 67--81. Google Scholar
Digital Library
- Czech, Z. J. 1998. Quasi-perfect hashing. Comput. J. 41, 416--421.Google Scholar
Cross Ref
- Czech, Z. J., Havas, G., and Majewski, B. S. 1997. Perfect hashing. Theoret. Comput. Sci. 182, 1-2, 1--143. Google Scholar
Digital Library
- Dijkstra, E. W. 1960. Recursive programming. Numer. Math. 2, 312--318.Google Scholar
Digital Library
- Dixon, R., McKee, T., Schweitzer, P., and Vaughan, M. 1989. A fast method dispatcher for compiled languages with multiple inheritance. In Proceedings of the Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'89). ACM, New York, 211--214. Google Scholar
Digital Library
- Driesen, K. 1993a. Method lookup strategies in dynamically typed object-oriented programming languages. M.S. dissertation, Vrije Universiteit Brussel.Google Scholar
- Driesen, K. 1993b. Selector table indexing and sparse arrays. In Proceedings of the 8th Annual on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'93). ACM, New York, 259--270. Google Scholar
Digital Library
- Driesen, K. 2001. Efficient Polymorphic Calls. Kluwer Academic Publisher. Google Scholar
Digital Library
- Driesen, K. and Hölzle, U. 1995. Minimizing row displacement dispatch tables. Proceedings of the Annual Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA'95). ACM, New York, 141--155. Google Scholar
Digital Library
- Driesen, K., Hölzle, U., and Vitek, J. 1995. Message dispatch on pipelined processors. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'95). Lecture Notes in Computer Science, vol. 952. Springer-Verlag, New York, 253--282. Google Scholar
Digital Library
- Ducournau, R. 1991. Yet Another Frame-based Object-Oriented Language: YAFOOL Reference Manual. Sema Group, Montrouge, France.Google Scholar
- Ducournau, R. 1997. La compilation de l'envoi de message dans les langages dynamiques. L'Objet 3, 3, 241--276.Google Scholar
- Ducournau, R. 2002a. Implementing statically typed object-oriented programming languages. Rapport de Recherche 02-174, LIRMM, Université Montpellier 2.Google Scholar
- Ducournau, R. 2002b. La coloration pour l'implémentation des langages à objets à typage statique. In Actes LMO'2002 in L'Objet vol. 8, M. Dao and M. Huchard, Eds. Lavoisier, 79--98.Google Scholar
Cross Ref
- Ducournau, R. 2002c. “Real World” as an argument for covariant specialization in programming and modeling. In Proceedings of the Workshops on Advances in Object-Oriented Information Systems (OOIS'02) . J.-M. Bruel and Z. Bellahsène, Eds. Lecture Notes in Computer Science, vol. 2426. Springer-Verlag, New York, 3--12. Google Scholar
Digital Library
- Ducournau, R. 2006. Coloring, a versatile technique for implementing object-oriented languages. Rapport de Recherche 06-001, LIRMM, Université Montpellier 2.Google Scholar
- Ellis, M. and Stroustrup, B. 1990. The Annotated C++ Reference Manual. Addison-Wesley, Reading, MA, US. Google Scholar
Digital Library
- Fall, A. 1995. Heterogeneous encoding. In Proceedings of the International Conference on Knowledge Retrieval and Storage for Efficiency (KRUSE'95). 162--167.Google Scholar
- Fall, A. 1998. The foundations of taxonomic encoding. Computat. Intell. 14, 598--642.Google Scholar
Cross Ref
- Gagnon, E. M. and Hendren, L. 2001. SableVM: A research framework for the efficient execution of Java bytecode. In Proceedings of the USENIX JVM'01. 27--40. Google Scholar
Digital Library
- Garey, M. and Johnson, D. 1979. Computers and Intractability. A Guide to the Theory of NP-Completeness. Freeman, San Francisco, CA. Google Scholar
Digital Library
- Gil, J. and Zibin, Y. 2005. Efficient subtyping tests with PQ-encoding. ACM Trans. Program. Lang. Syst. 27, 5, 819--856. Google Scholar
Digital Library
- Goldberg, A. and Robson, D. 1983. Smalltalk-80, the Language and its Implementation. Addison-Wesley, Reading, MA. Google Scholar
Digital Library
- Grove, D. and Chambers, C. 2001. A framework for call graph construction algorithms. ACM Trans. Program. Lang. Syst. 23, 6, 685--746. Google Scholar
Digital Library
- Habib, M., Huchard, M., and Nourine, L. 1995. Embedding partially ordered sets into chain-products. In Proceedings of the International Conference on Knowledge Retrieval and Storage for Efficiency (KRUSE'95). 147--161.Google Scholar
- Habib, M. and Nourine, L. 1994. Bit-vector encoding for partially ordered sets. In ORDAL, V. Bouchitté and M. Morvan, Eds. Lecture Notes in Computer Science, vol. 831. Springer-Verlag, New York, 1--12. Google Scholar
Digital Library
- Habib, M., Nourine, L., and Raynaud, O. 1997. A new lattice-based heuristic for taxonomy encoding. In Proceedings of the International Conference on Knowledge Retrieval and Storage for Efficiency (KRUSE'97). 60--71.Google Scholar
- Harbinson, S. P. 1992. Modula-3. Prentice-Hall, Englewood, Cliffs, NJ. Google Scholar
Digital Library
- Huchard, M. and Leblanc, H. 2000. Computing interfaces in Java. In Proceedings of the IEEE International Conference on Automated Software Engineering (ASE'2000). 317--320. Google Scholar
Digital Library
- Jensen, T. R. and Toft, B. 1995. Graph Coloring Problems. Wiley, New York.Google Scholar
- Kiczales, G., des Rivières, J., and Bobrow, D. 1991. The Art of the Meta-Object Protocol. MIT Press, Cambridge, MA. Google Scholar
Digital Library
- Klefstad, R., Krishna, A., and Schmidt, D. 2002. Design and performance of a modular portable object adapter for distributed, real-time, and embedded CORBA applications. In Proceedings of the 4th International Symposium on Distributed Objects and Applications. OMG. Google Scholar
Digital Library
- Knuth, D. E. 1973. The Art of Computer Programming, Sorting and Searching. Vol. 3. Addison-Wesley, Reading, MA.Google Scholar
- Krall, A. and Grafl, R. 1997. CACAO—a 64 bits JavaVM just-in-time compiler. Concur: Pract. Exper. 9, 11, 1017--1030.Google Scholar
Cross Ref
- Krall, A., Vitek, J., and Horspool, R. 1997. Near optimal hierarchical encoding of types. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'97), M. Aksit and S. Matsuoka, Eds. Lecture Notes in Computer Science, vol. 1241. Springer-Verlag, New York, 128--145.Google Scholar
- Lippman, S. 1996. Inside the C++ Object Model. Addison-Wesley, Reading, MA. Google Scholar
Digital Library
- Liskov, B., Curtis, D., Day, M., Ghemawat, S., Gruber, R., Johnson, P., and Myers, A. C. 1995. THETA reference manual. Technical report. MIT, Cambridge, MA.Google Scholar
- Mehlhorn, K. and Tsakalidis, A. 1990. Data structures. In Algorithms and Complexity. Handbook of Theretical Computer Science, vol. 1, Chap. 6, Elsevier, Amsterdam, The Netherlands, 301--341. Google Scholar
Digital Library
- Meyer, B. 1992. Eiffel: The Language. Prentice-Hall, Englewood Cliffs, NJ. Google Scholar
Digital Library
- Meyer, B. 1997. Object-Oriented Software Construction, second ed. Prentice-Hall, Englewood Cliffs, NJ. Google Scholar
Digital Library
- Meyer, J. and Downing, T. 1997. JAVA Virtual Machine. O'Reilly. Google Scholar
Digital Library
- Microsoft. 2001. C# Language specifications, v0.28. Technical report, Microsoft Corporation, Seattle, WA.Google Scholar
- Morris, R. 1968. Scatter storage techniques. Commun. ACM 11, 1, 38--44. Google Scholar
Digital Library
- Mössenböck, H. 1993. Object-Oriented Programming in Oberon-2. Springer-Verlag, New York. Google Scholar
Digital Library
- Muthukrishnan, S. and Muller, M. 1996. Time and space efficient method lookup for object-oriented languages. In Proceedings of the ACM-SIAM Symposium on Discrete Algorithms. ACM/SIAM, New York, 42--51. Google Scholar
Digital Library
- Myers, A. 1995. Bidirectional object layout for separate compilation. In Proceedings of the 10th ACM Conference on Object-Oriented Programming, Languages and Applications, OOPSLA'95. SIGPLAN Notices, 30(10). ACM, New York, 124--139. Google Scholar
Digital Library
- Odersky, M., Spoon, L., and Venners, B. 2008. Programming in Scala, A comprehensive step-by-step guide. Artima. Google Scholar
Digital Library
- Palacz, K. and Vitek, J. 2003. Java subtype tests in real-time. In Proceedings of the 17th European Conference on Object-Oriented Programming (ECOOP'03). Lecture Notes in Computer Science, vol. 2743. Springer-Verlag, New York, 378--404.Google Scholar
- Pfister, B. H. C. and Templ, J. 1991. Oberon technical notes. Tech. Rep. 156, Eidgenossische Techniscle Hochschule Zurich--Departement Informatik.Google Scholar
- Privat, J. 2006. PRM, the language. version 0.2. Rapport de Recherche 06-029, LIRMM, Université Montpellier 2.Google Scholar
- Privat, J. and Ducournau, R. 2005. Link-time static analysis for efficient separate compilation of object-oriented languages. In Proceedings of the ACM Workshop on Programming Analysis Software Tools Engin. (PASTE'05). 20--27. Google Scholar
Digital Library
- Pugh, W. and Weddell, G. 1990. Two-directional record layout for multiple inheritance. In Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI). ACM SIGPLAN Notices, 25, 6. ACM, New York. 85--91. Google Scholar
Digital Library
- Pugh, W. and Weddell, G. 1993. On object layout for multiple inheritance. Tech. Rep. CS-93-22, University of Waterloo.Google Scholar
- Queinnec, C. 1998. Fast and compact dispatching for dynamic object-oriented languages. Inf. Proc. Lett. 64, 6, 315--321. Google Scholar
Digital Library
- Raynaud, O. and Thierry, E. 2001. A quasi optimal bit-vector encoding of tree hierarchies. application to efficient type inclusion tests. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP'01). Lecture Notes in Computer Science, vol. 2072. Springer-Verlag, New York, 165--180. Google Scholar
Digital Library
- Schmidt, D. C. 1990. GPERF: A perfect hash function generator. In Proceedings of the USENIX C++ Conference. 87--102.Google Scholar
- Schubert, L., Papalaskaris, M., and Taugher, J. 1983. Determining type, part, color and time relationship. Computer 16, 53--60. Google Scholar
Digital Library
- Shalit, A. 1997. The Dylan Reference Manual: The Definitive Guide to the New Object-Oriented Dynamic Language. Addison-Wesley, Reading, MA. Google Scholar
Digital Library
- Sprugnoli, R. 1977. Perfect hashing functions: a single probe retrieving method for static sets. Commun. ACM 20, 11, 841--850. Google Scholar
Digital Library
- Steele, G. 1990. Common Lisp, the Language, Second ed. Digital Press. Google Scholar
Digital Library
- Stroustrup, B. 1998. The C++ Programming Language, 3e ed. Addison-Wesley, Reading, MA.Google Scholar
- Taft, S. T., Duff, R. A., Brukardt, R. L., Ploedereder, E., and Leroy, P., Eds. 2006. Ada 2005 Reference Manual: Language and Standard Libraries. Lecture Notes in Computer Science, vol. 4348. Springer-Verlag, New York. Google Scholar
Digital Library
- Takhedmit, P. 2003. Coloration de classes et de propriétés : étude algorithmique et heuristique. M.S. thesis, Université Montpellier 2.Google Scholar
- Tarjan, R. E. and Yao, A. C. C. 1979. Storing a sparse table. Commun. ACM 22, 11, 606--611. Google Scholar
Digital Library
- Vitek, J., Horspool, R., and Krall, A. 1997. Efficient type inclusion tests. In Proceedings of the 12th ACM Conference on Object-Oriented Programming, Languages and Applications (OOPSLA'97). ACM, New York. 142--157. Google Scholar
Digital Library
- Vitter, J. S. and Flajolet, P. 1990. Average-case analysis of algorithms and data structures. In Algorithms and Complexity. Handbook of Theretical Computer Science, vol. 1, J. van Leeuwen, Ed. Elsevier, Amsterdam, The Netherlands. Chapter 9, 431--524. Google Scholar
Digital Library
- Warren, H. S. 2003. Hacker's Delight. Addison-Wesley, Reading, MA. Google Scholar
Digital Library
- Wirth, N. 1988. The programming language Oberon. Softw. Pract. Exper. 18, 7, 671--690. Google Scholar
Digital Library
- Zendra, O., Colnet, D., and Collin, S. 1997. Efficient dynamic dispatch without virtual function tables: The SmallEiffel compiler. In Proceedings of the 12th ACM Conference on Object-Oriented Programming, Languages and Applications (OOPSLA'97). ACM, New York, 125--141. Google Scholar
Digital Library
- Zibin, Y. and Gil, J. 2003a. Incremental algorithms for dispatching in dynamically typed languages. In Proceedings of the Programming Languages (POPL'97)). ACM, New York, 126--138. Google Scholar
Digital Library
- Zibin, Y. and Gil, J. 2003b. Two-dimensional bi-directional object layout. In Proceedings of the 17th European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 2743. Springer-Verlag, New York, 329--350.Google Scholar
Index Terms
Perfect hashing as an almost perfect subtype test
Recommendations
Implementing statically typed object-oriented programming languages
Object-oriented programming represents an original implementation issue due to its philosophy of making the program behavior depend on the dynamic type of objects. This is expressed by the late binding mechanism, aka message sending. The underlying ...
Empirical assessment of object-oriented implementations with multiple inheritance and static typing
OOPSLA '09Object-oriented languages involve a threefold tradeoff between runtime efficiency, expressiveness (multiple inheritance), and modularity, i.e. open-world assumption (OWA). Runtime efficiency is conditioned by both the implementation technique and ...
Empirical assessment of object-oriented implementations with multiple inheritance and static typing
OOPSLA '09: Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applicationsObject-oriented languages involve a threefold tradeoff between runtime efficiency, expressiveness (multiple inheritance), and modularity, i.e. open-world assumption (OWA). Runtime efficiency is conditioned by both the implementation technique and ...






Comments