I'm reminded of VMware's x86-to-x86 binary translator. In some degenerate sense, this thing is a "compiler", whose input is supervisor-level x86 code, and whose output is sandboxed x86 code. You might imagine a layer like this performing all kinds of fascinating transformations on the input binary, ala JVM/transmeta. VMware's BT, however, is more concerned with preserving the presumed-good properties of the input binary, than with introducing new goodness of its own. This lack of ambition also had the nice side effect of making performance relatively easy to reason about: there were various things the guest could do to incur virtualization-induced overhead, but those overheads were close to constant per-occurrence, so you could just multiply frequency by cost to get a swag at a workload's overhead.