From: | Ray Dillinger <bear@sonic.net> |
Newsgroups: | comp.compilers,comp.arch |
Date: | Sat, 13 Dec 2008 09:36:17 -0800 |
Organization: | Organized? Seems unlikely. |
References: | 08-12-014 |
Keywords: | architecture, OOP |
Posted-Date: | 13 Dec 2008 18:18:39 EST |
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? (Not just necessarily the
> function thing, but anything).
If I had my druthers, I'd add a number of VERY wide registers
replacing on the chip die the "implicit" registers known as cache
lines and make the management of these explicit with its own
instructions rather than implicit and heuristic.
The payoff for the extra instruction bandwidth would be several fairly
simple instructions to operate on the data in the wide registers in
parallel. Aside from generally useful things like supporting parallel
mathematical operations for tight loops and just plain wide-data
operations like multiple coordinate transforms in parallel for
graphics, I'd add a few instructions specifically to support OO.
These instructions are:
WMASK WIDEREG1 REG WIDEREG2 Load each word in wide register 2 with
the result of AND'ing the corresponding
word in Wide register 1 with the contents
of Reg.
WHASH WIDEREG REG Load Reg with the results of hashing
widereg.
WHERE WIDEREG REG1 REG2 Load Reg2 with the address within the
wide register of the word having the
same value as Reg1.
Out of these instructions I'd manufacture a fast multiple dispatch for
a dynamic method table for languages with type tagged values:
Load the arguments of a function call into widereg 1,
Load a "method table index" block into widereg 2,
mask the type tags from widereg 1 into widereg 3,
hash widereg 3 into reg A,
Find the address in widereg 2 that has the same value as reg A,
Add that address to the address of the base of the method table,
Jump to the result.
Bear
Return to the
comp.compilers page.
Search the
comp.compilers archives again.