Efficient dynamic dispatching with type slicing

Author:

Gil Joseph (Yossi)1,Zibin Yoav1

Affiliation:

1. Technion—Israel Institute of Technology, Haifa, Israel

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 CT d . 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 CT 1 , CT 2 , CT 3 , …, where CT d 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 CT d suited for languages such as Java.

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference48 articles.

1. Efficient implementation of Java interfaces

2. Arnold P. and Gosling J. 1996. The Java Programming Language. The Java Series. Addison-Wesley Reading MA. Arnold P. and Gosling J. 1996. The Java Programming Language. The Java Series. Addison-Wesley Reading MA.

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. 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. CommonLoops: merging Lisp and object-oriented programming

5. Testing for the consecutive ones property, interval graphs, and graph planarity using PQ-tree algorithms

Cited by 6 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Extending the Object-Capability Model with Fine-Grained Type-Based Capabilities.;The Journal of Object Technology;2024

2. Implementing statically typed object-oriented programming languages;ACM Computing Surveys;2011-04

3. Formal verification of object layout for c++ multiple inheritance;ACM SIGPLAN Notices;2011-01-26

4. Formal verification of object layout for c++ multiple inheritance;Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '11;2011

5. Engineering Theories with Z3;Programming Languages and Systems;2011

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3