Efficient Type Inclusion Tests - Semantic Scholar

4 downloads 1833 Views 204KB Size Report
In many implementations this field can be merged with the dispatch data structure ...... kind may actually occur at runtime when new software components are ...
Efficient Type Inclusion Tests Jan Vitek R. Nigel Horspool Andreas Krall

Abstract A type inclusion test determines whether one type is a subtype of another. Efficient type testing techniques exist for single subtyping, but not for languages with multiple subtyping. To date, the only fast constant-time technique relies on a binary matrix encoding of the subtype relation with quadratic space requirements. In this paper, we present three new encodings of the subtype relation, the packed encoding, the bit-packed encoding and the compact encoding. These encodings have different characteristics. The bit-packed encoding delivers the best compression rates: on average 85% for real life programs. The packed encoding performs type inclusion tests in only 4 machine instructions. We present a fast algorithm for computing these encoding which runs in less than 13 milliseconds for PE and BPE, and 23 milliseconds for CE on an Alpha processor. Finally, we compare our results with other constant-time type inclusion tests on a suite of 11 large benchmark hierarchies.

1

Introduction

Many modern programming languages, particularly object-oriented ones, have been built around the notion of type conformance to allow for a form of polymorphism and code reuse. The idea is that, if a type A conforms to a type B , then A can be used in any context where B is expected. This notion is essential for the code inheritance advocated by most object-oriented languages. Conformance is usually summarized by a transitive, reflexive, anti-symmetric subtype relation (

Suggest Documents