The virtual processor

Everything seems to be clear by now, except one thing-what does it all have to do with trees? We are almost there, as we have to implement the virtual processor itself, and that is what we are going to do here.

The easiest and probably the most common implementation of a virtual processor is a while() loop, which runs by reading instructions from the VM's memory and selects a proper execution path with the switch() statement implemented as the indirect jump and jump table (the table of jump target addresses). Although our example would probably run best when implemented this way, and the architecture described below would fit better for a complex instruction set, it was intentionally made simple in order to avoid the ...

Get Mastering Assembly Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.