glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] scripting language


From: Bo Lorentsen
Subject: Re: [glob2-devel] scripting language
Date: Wed, 25 May 2005 18:05:25 +0200
User-agent: Debian Thunderbird 1.0.2 (X11/20050331)

address@hidden wrote:

With GCC only, you can get the address of a label like this:
static void *array[] = { &&foo, &&bar, &&hack };
goto *array[i];
foo:
bar:
hack:

Of course, this does exactly the same as a switch.

Are you sure switch makes the same kind of code as above ? I thougth it made a lot of compare/next steps !

Guess I need to look more into the generated asm output (not been doing this for a while) !

But it becomes interesting
when you replace the opcodes of the instructions in the bytecode with the
addresses of the labels so you can directly jump to the address of the next
instruction without falling back in the loop code.
That would be wery strange code indeed, and I will be happy if switch make the indirect goto jump for me, as this will be quite speedy ! Next step will be a compiler :-)

/BL




reply via email to

[Prev in Thread] Current Thread [Next in Thread]