On 25-Jul-12 23:58, Walter Bright wrote:
On 7/25/2012 12:52 PM, Dmitry Olshansky wrote:
On 25-Jul-12 21:47, Walter Bright wrote:
On 7/25/2012 10:29 AM, Dmitry Olshansky wrote:
Is it possible you could code it up and test it using inline asm?
...
Any tips on which spare registers to use (I guess ecx is no go, as
there is
'this' pointer present) ?
I wouldn't worry about it. EAX is good.
OK. I'm almost there, here is what I have:
//my byte code sets 8-bit to discern code/data
uint c = re.ir[t.pc].code - 128;
//no idea how to code the above in asm
//.code is { return x & mask; } property
asm{
mov EAX, c;
lea EAX, L_jumptable[EAX][EAX*4];
jmp EAX;
}
L_jumptable:
mixin(`asm{`
~ genJumpTable()
~ `} `);
So I have proper table generated and it all goes fine untill I get:
std\regex.d(5118): Error: undefined identifier 'L_jumptable'
I was afraid of that. You may have to approximate it by loading the
address of L_jumptable into a register and adding it in instead of using
the addressing mode.
like this ?
mov EDX, L_jumpable
move EAX, EDX[EAX][EAX*4]
doesn't work. Seems like label is nonexistent anywhere but jump instruction.
Will this one do it:
lea EAX, $[EAX+5][EAX*4];
jmp EAX;
Compiles. Maybe I miscalculated though. Indirect jump has size of ?
Then, add those extra instructions as dummies into
the other path.
Ehm? Other path like what? You mean compare it with jump table that uses
plain addresses? Please expand a bit.
--
Dmitry Olshansky