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 条
  • [11] GROVE D, 1995, SIGPLAN NOTICES, V30, P108, DOI 10.1145/217839.217848
  • [12] HOLZLE U, 1994, SIGPLAN NOTICES, V29, P326
  • [13] HOLZLE U, 1991, LECT NOTES COMPUT SC, V512, P21
  • [14] KICZALES G, 1990, PROCEEDINGS OF THE 1990 ACM CONFERENCE ON LISP AND FUNCTIONAL PROGRAMMING, P99, DOI 10.1145/91556.91600
  • [15] Object-oriented symbol management in syntax-directed compiler systems
    Naik, M
    Kumar, R
    [J]. ACM SIGPLAN NOTICES, 1999, 34 (06) : 58 - 67
  • [16] NAKAMURA H, 1996, RT0137 IBM RES TOK R
  • [17] Pang C, 1999, LECT NOTES COMPUT SC, V1628, P304
  • [18] STROUSTRUP B, 1997, C PLUS PLUS PROGRAMM
  • [19] STROUSTRUP B, 1994, DESIGN EVOLUTION C P
  • [20] Efficient dynamic dispatch without virtual function tables. The SmallEiffel compiler.
    Zendra, O
    Colnet, D
    Collin, S
    [J]. ACM SIGPLAN NOTICES, 1997, 32 (10) : 125 - 141