Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

VM instruction implementation without huge switch()?

Name: Anonymous 2014-06-09 23:26

How would one go about making a virtual machine without using a huge and clumsy switch( opcode ) statement?

The architecture I'm implementing (DCPU-16) has about 35-40 different instructions.

Name: Anonymous 2016-10-29 15:28

>>63
C99 increased that to 1023
Probably related to the compiler having to store a jump table with that much entries, not byte size.

C++ increased that [...] to 16K
That's just wasteful.
Remember that a C89 compiler can be implemented for a machine with like 1MiB of RAM (probably the biggest culprit: #defines: up to 1024*(499+31) bytes).

Polite sage for offtopic.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List