Multi-dispatch in the Java virtual machine: design and implementation
Christopher Dutchyn, Paul Lu, Duane Szafron, S. Bromling, Wade Holst · 2001
Mainstream object-oriented languages, such as C++ and Java, provide only a restricted form of polymorphic methods, namely single-receiver dispatch. In common programming situations, programmers must work-around this limitation. We detail how to extend the Java Virtual Machine to support multiple-dispatch and examine the complications that Java imposes on multiple-dispatch in practice. Our technique avoids changes to the Java programming language itself, maintains source-code and library compatibility, and isolates the performance penalty and semantic changes of multiple-dispatch to the program sections which use it. We have micro-benchmark and applicationlevel performance results for a dynamic Most Specic Applicable (MSA) dispatcher, two table-based dispatchers (Mul- tiple Row Displacement (MRD) and Single Receiver Projections (SRP)), and a tuned SRP dispatcher. Our generalpurpose technique provides smaller dispatch latency than equivalent programmer-written double-dispatch code. 1...