From: | "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> |
Newsgroups: | comp.compilers,comp.arch |
Date: | Sat, 6 Dec 2008 12:26:31 +0100 |
Organization: | cbb software GmbH |
References: | 08-12-014 |
Keywords: | OOP, architecture |
Posted-Date: | 06 Dec 2008 06:42:53 EST |
On Thu, 4 Dec 2008 12:09:50 -0600, Tony wrote:
> To me, it seems like "reducing everything to a function" may be a bit
> dated given that OO languages are the thing nowadays. Can anyone
> imagine any new potential assembly language instructions that would
> make implemention of OO languages easier?
An interesting question.
1. I would expect some support for management dispatching tables. When
types are allowed to be dynamically derived from, one have to add and
remove columns in the dispatching table of a method. (I presume that
vptr is replaced with the type tag. The latter used to index the
table).
2. Dispatching itself is also an issue. In the most general model
(multiple dispatch) one have to collect type tags from the arguments
of a call. This n-tuple index is used to index the n-dimensional
dispatch table of a method which yields the target. It would be nice
to have one CALL instruction for that.
3. "non-cooperative OO/ADT." That is when private parts of the object
are not mapped when you have only a public view on it. Consequently,
the dispatching tables of private methods are inaccessible etc. When
you call to a public method, it is executed on a context where the
private things become mapped. Some sort of "OO supervisor call." You
cannot have a really OO OS API without this.
4. Tiny object's polymorphism. If you wanted full OO, you would need
classes of small objects (like bits, pointers, integers etc). You
don't want to keep the type tag in such objects. One solution is that
a polymorphic value and a type-specific value would have different
representations. The former would have a type tag inside, the latter
would not. In order to make this working you will convert forth and
back between these representations, i.e. between T and class T. One
could have special instructions for this.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Return to the
comp.compilers page.
Search the
comp.compilers archives again.