Computed gotos on Reddit

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Jul 25 12:52:31 PDT 2012


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'

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list