[virtmach] Your VM

Reuben Thomas virtmach@iecc.com
Tue, 29 May 2001 11:18:50 +0100 (BST)


> I have heard that some teams generate the switch statement as part of the
> build process.

That's the obvious way to do it: if you're writing in C, use some sort of
macro to generate the instructions, which can then be #included in blocks
into the body of the switch, with perhaps a little care as to the ordering.

> Note that gcc tends to take a long time optimizing large switches (hundreds
> of cases), so the generated switch should be broken into smaller chunks if
> you do that.

Surely that defeats the optimization! How long is "too long", anyway? If
it's that bad, you can stop using -O2, use another compiler for development
(e.g. LCC) &c. &c.; no need to change the code structure.

-- 
http://sc3d.org/rrt/ | egrep, n.  a bird that debugs bison