Two-directional record layout for multiple inheritance

  • Authors:
  • William Pugh;Grant Weddell

  • Affiliations:
  • Department of Computer Science, University of Maryland, College Park;Department of Computer Science, University of Waterloo

  • Venue:
  • PLDI '90 Proceedings of the ACM SIGPLAN 1990 conference on Programming language design and implementation
  • Year:
  • 1990

Quantified Score

Hi-index 0.00

Visualization

Abstract

Much recent work in polymorphic programming languages allows subtyping and multiple inheritance for records. In such systems, we would like to extract a field from a record with the same efficiency as if we were not making use of subtyping and multiple inheritance. Methods currently used make field extraction 3-5 times slower, which can produce a significant overall performance slowdown.We describe a record layout algorithm that allows us to assign a fixed offset to each field name. This allows field extraction to done just as quickly as in systems that do not provide multiple inheritance. Assigning fixed offsets may require us to leave gaps in some records (and waste space). However, by placing fields at both positive and negative offsets we can drastically reduce the amount of wasted space. Finding an optimal layout is NP-hard, so we propose and analyze heuristic algorithms for producing good two-direction record layouts.In a trial run, our algorithm produced a fixed layout for the instance variables of the 563 flavors of a Lisp Flavors system; this fixed layout only wastes 6% of the total space consumed by a collection of one instance of each flavor.