Computed gotos on Reddit
Dmitry Olshansky
dmitry.olsh at gmail.com
Wed Jul 25 00:49:50 PDT 2012
On 25-Jul-12 11:37, Walter Bright wrote:
> On 7/24/2012 11:46 PM, Dmitry Olshansky wrote:
>> It's pc => address because one can first preprocess all of byte code
>> doing
>> opcode => address rewrites. But you can't do it unless taking address
>> of labels
>> is possible.
>
> All right, that's the piece that was missing.
>
> I suppose it is possible for the compiler to recognize that the
> opcode=>address array is invariant, and optimize it out, but that would
> be a novel optimization. I don't know how hard it would be.
>
While it may sound possible I'm certain that in most interesting cases
it's not possible for compiler to do it in advance, as array of opcodes
ultimately comes from some external source e.g. parsed script file.
So opcode=>address transform happens at run-time after that it indeed
becomes invariant.
>
> > Done: http://d.puremagic.com/issues/show_bug.cgi?id=8431
>
> Thanks!
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list