Space and time-efficient memory layout for multiple inheritance

  • Authors:
  • Peter F. Sweeney;Joseph (Yossi) Gil

  • Affiliations:
  • IBM T. J. Watson Research Center, P.O. Box 704, Yorktown Heights, NY;Department of Computer Science, Technion-IIT, Haifa 32000, Israel

  • Venue:
  • Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

Traditional implementations of multiple inheritance bring about not only an overhead in terms of run-time but also a significant increase in object space. For example, the number of compiler-generated fields in a certain object can be as large as quadratic in the number of its subobjects. The problem of efficient object layout is compounded by the need to support two different semantics of multiple inheritance: shared, in which a base class inherited along distinct paths occurs only once in the derived class, and repeated, in which this base has multiple distinct occurrences in the derived. In this theoretical and foundational paper, we introduce two new techniques to optimize memory layout for multiple inheritance. The main ideas behind these techniques are the inlining of virtual bases and bidirectional memory layout. Our techniques never increase time overhead, and usually even decrease it. We show that in some example hierarchies, more than ten-fold reduction in the space overhead can be achieved. We analyze the complexity of the algorithms to apply these techniques, and give theorems to estimate the efficacy of this application. For concreteness, techniques and examples are discussed in the context of C++.