Yet another keyed ops proposal[1]
Given the Perl6 expression:
@a[$i] = @b[1] + $k;
This should translate to
add P0[I0], P1[1], I2
But having multi-keyed variants of all relevant opcodes would burst our opcode count to #of-keyed-opcodes * #of-key-permutations. That's not feasable.
Definitely not. Here's an alternative. I'd originally planned on there being a single keyed variant of each op, so the above would be written:
add P0[S0], P1[S1], P2[]
Note that a key is passed in for $k, just a NULL key, all keys were meant to be in S registers, and there weren't going to be constant keys or pure-integer. Things have changed a bit. :)
Note that I'm perfectly OK mandating the following:
1) All keys must be of the same type (integer key or key struct keys) 2a) No constant keys or 2b) All keys must be constant or register based 3) If one parameter is keyed they all are
I'm comfortable with 1, 2a, and 3, though I can see the case for 2b. Doubles the number of keyed ops, though. (At least only for PMC-based operations, which is something)
So here is another proposal to implement these ops.
1) The assembler splits above PASM statement into two:
This is the one thing that I'll grumble about -- we can argue over other things, but the assembler should *not* implicitly split stuff out like this. Maybe (Only maybe!) IMCC should, but I'd argue not there as well. It should be explicitly specified in the source where the keys should be fetched.
5) These returned pointers are stored in REG_PMC(x) .. REG_PMC(z) (x = 32, y = 33, z = 34) [2] struct PReg has PMC *registers[NUM_REGISTERS + 3];
This would be the clever bit -- key registers. I'm fine with key registers however... if we're going to add them, why not just have a separate set of key registers and be done with it?
This adds one opcode dispatch and increases code size a bit, but we we wouldn't need any additional keyed vtables. And all the checks for passed NULL keys (i.e. no key) aren't necessary.
Comments welcome, leo
[1] And I hear Dan groaning: ONNTA
:) Groan or not this needs a final decision. Nobody ever told me I had to *like* the job...
--
Dan
--------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk