[virtmach] Switch vs. Jump Tables?

Tom Fjellstrom tfjellstrom@home.com
Tue, 14 Nov 2000 00:17:46 -0700


"Murray, Peter C" wrote:
> 
> > I would have used a jump table indexed by
> > opcodes pointing to function pointers
> > implementing each one of the instruction.
> 
> I've never look at the ASM code generated by an optimizing compiler for the
> switch statement, but I'd assume it would produce some form of efficient
> jump table anyway.  And you would't have the overhead of a pointer
> indirection and fn call for each virtual instruction.  Has anyone looked
> into this in more detail?

I'm betting that the method you choose has to fit the needs of the
VM, depending on how flexible it's supposed to be, etc... 

-- 
Tom Fjellstrom
tfjellstrom@home.com
http://strangesoft.net/