Efficient message dispatch in object-oriented systems

被引:8
作者
Naik, M [1 ]
Kunar, R [1 ]
机构
[1] Birla Inst Technol & Sci, Dept Comp Sci & Informat Syst, Pilani 333031, Rajasthan, India
关键词
message dispatch; single dispatch; multiple dispatch; object-oriented programming; implementation;
D O I
10.1145/351159.351174
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Single dispatch involves performing at run-time a multi-way switch over the possible classes of the receiver. Most object-oriented systems implement this switch as an array lookup using a table-based technique or as a binary search using a tree-based technique. However, each of these is the best choice only under a particular circumstance; neither outperforms the other under all circumstances. In this paper, we present a time and space efficient implementation of the switch that employs the table-based technique when an array lookup outperforms a binary search and the tree-based technique when a binary search outperforms an array lookup. Further, when neither an array lookup nor a binary search is superior, our scheme blends the two techniques in a manner that gains the benefits of both without suffering the disadvantages of either. We relate our scheme to recent work and discuss extending it to implement multiple dispatch.
引用
收藏
页码:49 / 58
页数:10
相关论文
共 21 条
  • [1] AMIEL E, 1994, SIGPLAN NOTICES, V29, P244, DOI 10.1145/191081.191117
  • [2] [Anonymous], 1979, Computers and Intractablity: A Guide to the Theoryof NP-Completeness
  • [3] BOBROW DG, 1988, ACM SIGPLAN NOTICES, V23
  • [4] CHAMBERS C, 1992, LECT NOTES COMPUT SC, V615, P33, DOI 10.1007/BFb0053029
  • [5] CHAMBERS C, 1999, OOPSLA 99 C P DENV C
  • [6] CHAMBERS C, 1993, UWCSE930305 DEP COMP
  • [7] CHEN WM, 1994, LNCS, V821, P408
  • [8] Fast algorithms for compressed multimethod dispatch table generation
    Dujardin, E
    Amiel, E
    Simon, E
    [J]. ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1998, 20 (01): : 116 - 165
  • [9] DUJARDIN E, 1996, 2892 INRIA ROCQ
  • [10] GOSLING J, 1996, JAVA LANGUAGE SPECIF