|Dynamic Binding email@example.com (Rodrigo Augusto B. Ferreira) (2000-01-15)|
|Re: Dynamic Binding firstname.lastname@example.org (2000-01-19)|
|Re: Dynamic Binding email@example.com (2000-01-19)|
|Re: Dynamic Binding firstname.lastname@example.org (Erik Ernst) (2000-01-19)|
|From:||Erik Ernst <email@example.com>|
|Date:||19 Jan 2000 01:16:37 -0500|
|Organization:||Department of Computer Science, University of Aalborg, Denmark|
Rodrigo Augusto B Ferreira <firstname.lastname@example.org> writes:
> Hi, The best known technique to implement dynamic binding is using
> method tables. [..] I was wondering if using dynamic type
> resolution, by compiling a lookup switch statement for each virtual
> call, would be valuable to increase the possibility of optimization.
> I know that, although this technique transforms virtual calls in
> switch + static calls, it has some weak points like being slower and
> requiring the type hierarchy to be known at compile time. But I
> suspect that in some cases it may be worth trying.
Your "switch + static calls" approach might have something in common
with message splitting:
Craig Chambers and David Ungar: Iterative Type Analysis and Extended
Message Splitting: Optimizing Dynamically-Typed Object-Oriented
Message splitting is the technique of creating several single-type
versions of a piece of code, as opposed to the original version of the
code which works on objects of multiple types. To choose from that
set of single-type variants you'd essentially need a switch at the
call site (perhaps a switch for the two most common cases and a
slower, general lookup for the rest).
In the above paper they take the next logical step and inline the body
of the statically known method, since that improves the opportunities
for optimizations. Since this might cause an unbounded explosion in
code size (consider two methods calling each other), they must of
course apply this technique in a restricted manner.
Erik Ernst email@example.com
Department of Computer Science, University of Aalborg, Denmark
Return to the
Search the comp.compilers archives again.