ACM Home Page
Please provide us with feedback. Feedback
Digital Library logoTake a look at the new version of this page: [ beta version ]. Tell us what you think.
Efficient dynamic dispatching with type slicing
Full text PdfPdf (750 KB)
Source
ACM Transactions on Programming Languages and Systems (TOPLAS) archive
Volume 30 ,  Issue 1  (November 2007) table of contents
Article No.: 5  
Year of Publication: 2007
ISSN:0164-0925
Authors
Joseph (Yossi) Gil  Technion—Israel Institute of Technology, Haifa, Israel
Yoav Zibin  Technion—Israel Institute of Technology, Haifa, Israel
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 9,   Downloads (12 Months): 74,   Citation Count: 0
Additional Information:

abstract   references   index terms   review   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1290520.1290525
What is a DOI?

ABSTRACT

A fundamental problem in the implementation of object-oriented languages is that of a frugal implementation of dynamic dispatching, that is, a small footprint data structure that supports quick response to runtime dispatching queries of the following format: which method should be executed in response to a certain message sent to a given object. Previous theoretical algorithms for this problem tend to be impractical due to their conceptual complexity and large hidden constants. In contrast, successful practical heuristics lack theoretical support.

The contribution of this article is in a novel type slicing technique, which results in two dispatching schemes: TS and CTd. We make the case for these schemes both practically and theoretically. The empirical findings on a corpus of 35 hierarchies totaling some 64 thousand types from eight different languages, demonstrate improvement over previous results in terms of the space required for the representation, and the time required for computing it.

The theoretical analysis is with respect to ι, the best possible compression factor of the dispatching matrix. The results are expressed as a function of a parameter κ, which can be thought of as a metric of the complexity of the topology of a multiple inheritance hierarchy. In single inheritance hierarchies κ = 1, but although κ can be in the order of the size of the hierarchy, it is typically a small constant in actual use of inheritance; in our corpus, the median value of κ is 5, while its average is 6.4.

The TS scheme generalizes the famous interval containment technique to multiple inheritance. TS achieves a compression factor of ι/κ, that is, our generalization comes with an increase to the space requirement by a small factor of κ. The pay is in the dispatching time, which is no longer constant as in a naive matrix implementation, but logarithmic in the number of different method implementations. In practice, dispatching uses one indirect branch and, on average, only 2.5 binary branches.

The CT schemes are a sequence of algorithms CT1, CT2, CT3, …, where CTd uses d memory dereferencing operations during dispatch, and achieves a compression factor of 1/dι1−1/d in a single inheritance setting. A generalization of these algorithms to a multiple inheritance setting, increases the space by a factor of (2κ)1−1/d. This trade-off represents the first bounds on the compression ratio of constant-time dispatching algorithms. We also present an incremental variant of the CTd suited for languages such as Java.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

1
 
2
 
3
Bobrow, D. G., DeMichiel, L. G., Gabriel, R. P., Keene, S. E., Kiczales, G., and Moon, D. A. 1988. Common LISP object system specification. X3J13 Document 88-002R.
4
 
5
Booth, K. S. and Leuker, G. S. 1976. Testing for the consecutive ones property, interval graphs, and graph planarity using PQ-tree algorithms. J. Comput. Syst. Sci. 13, 3 (Dec.), 335--379.
 
6
Chambers, C. 1993. The Cecil language, specification and rationale. Tech. Rep. TR-93-03-05, University of Washington, Seattle, WA.
7
 
8
Cohen, T. and Gil, J. 2000. Self-calibration of metrics of Java methods. In Proceedings of the 37th International Conference on Technology of Object-Oriented Languages and Systems (TOOLS'00 Pacific) (Sydney, Australia). Prentice-Hall, Englewood Cliffs, NJ, 94--106.
 
9
Conroy, T. J. and Pelegri-Llopart, E. 1983. An assessment of method-lookup caches for Smalltalk-80 implementations. In Smalltalk-80: Bits of History, Words of Advice. Addison-Wesley, Reading, MA.
 
10
11
12
 
13
14
15
 
16
17
18
 
19
 
20
 
21
Dujardin, E. 1996. Efficient dispatch of multimethods in constant time using dispatch trees. Tech. Rep. RR-2892. Inria, Institut National de Recherche en Informatique et en Automatique.
22
 
23
 
24
 
25
26
 
27
28
 
29
 
30
Holst, W., Szafron, D., Leontiev, Y., and Pang, C. 1998. Multi-method dispatch using single-receiver projections. Tech. Rep. TR-98-03, University of Alberta, Edmonton, Alb., Canada.
 
31
 
32
ISE. 1997. ISE EIFFEL The Language Reference. ISE, Santa Barbara, CA.
33
 
34
35
 
36
37
 
38
39
 
40
 
41
 
42
van Emde Boas, P. E. 1977. Preserving order in a forest in less than logarithmic time and linear space. Inf. Proc. Lett. 6, 3, 80--82.
 
43
van Emde Boas, P. E., Kaas, R., and Zijlstra, E. 1977. Design and implementation of an efficient priority queue. Math. Syst. Theory 10, 99--127.
 
44
Vitek, J. 1995. Compact dispatch tables for dynamically typed programming languages. M.S. thesis, University of Victoria, Victoria, BC, Canada.
 
45
 
46
 
47
48
49
50
51


REVIEW

"Chenglie Hu : Reviewer"

In executing an object-oriented program, a data structure needs to be maintained to support a quick response to runtime dispatching queries about which method should be executed when a certain message is sent to a given object. More specifically,   more...

Collaborative Colleagues:
Joseph (Yossi) Gil: colleagues
Yoav Zibin: colleagues