Dynamic Submission Features

I am currently looking for various ways to implement dynamic dispatch.

As far as I know, there are two “simple” ways to implement this:

  • Virtual function tables, as in C ++
  • Message Manager, as in SmallTalk (which is somewhat reminiscent of Python's idea of ​​storing methods as attributes in __dict__ )

I would like to note that, as far as I know, VFTs were chosen because they performed reasonably and easily for implementation (and also because they were well suited for a separate C ++ compilation model), and not because they were the fastest methods.

I have already read several articles and publications, but most of them are "old" (the last ones that I read (*) mentioned using Pentium 200 MHz ... hum), so I doubt that they represent a modern state if research will not reach the stall.

I'm interested in:

  • Dynamic sending strategies are all the better if they support multiple methods.
  • Benchmarks of various strategies

I am particularly interested in recent articles and unusual strategies (even if they have not been effective).

Publications are welcome, it would be better if they were freely available, and otherwise the resume of the presented technique and the result would be wonderful.

Technical articles on real compiler implementations are also welcome.

(*) This article about Eiffel shows how all program analysis can help remove virtual call sites.

+4
source share
1 answer

I came across the following strategy of several methods when I read about the implementation of object systems based on prototypes. It is written with this domain in mind, but it’s easy to adapt to a more traditional class-based language.

Section 3 describes it in detail, and Diagram 5 is a useful diagram. The idea is that each object (or class, possibly) that can be dispatched has its own method table. (In this sense, it is comparable to C ++.) Each method that sends this object (or class) is placed in a table. The clever part is that the table is divided into subsections that correspond to the positions of the parameters.

To clarify: Imagine that you have a method that specializes in the Foo class for the first argument and the Quux class for the second argument. Section 1 of the Foo class distribution table will contain a pointer to this method. And section 2 for the Quux class distribution table must also have a pointer to this method. To submit, consult the argument class distribution tables. If the method pointers match (as in our example), this is the invocation method.

The paper is called Multiple Sending Prototypes. http://lee.fov120.com/ecoop.pdf

+4
source

All Articles