1. A method for protecting translated guest program code of a self-modifying guest program while executing the guest program as a guest process in a virtual machine that is executing on a physical host, comprising: loading a set of guest program instructions into a guest virtual memory page, which comprises; storing a mapping of the page's address to a guest physical memory address in a first-level page table; storing a mapping of the guest physical memory address to a host physical memory address in a second-level page table; storing a first mapping of the page's address to the host physical memory address in a guest shadow page table (GSPT), wherein the GSPT enables the guest process to translate guest virtual addresses into host physical memory addresses with a single mapping; and configuring the GSPT to indicate that the set of guest program instructions in the page has not been translated; executing the set of guest program instructions, which comprises: invoking a dynamic compiler to translate the set of guest program instructions; in response to the dynamic compiler determining that a compiler shadow page table (CSPT) does not have a mapping of the page's address to the host physical memory address, wherein the CSPT enables a dynamic compiler to translate guest virtual addresses into host physical memory addresses with a single mapping: configuring the GSPT to indicate that the set of guest program instructions in the page has been translated; storing a second mapping of the page's address to the host physical memory address in the CSPT; and translating the set of guest program instructions into native program instructions for the physical host; caching the native program instructions; and executing the native program instructions; in response to detecting an attempt by the executing native program instructions to write to the page, determining, from the GSPT, that the set of guest program instructions in the page has been translated; invalidating the cached native program instructions; invalidating the second mapping in the CSPT; configuring the GSPT to indicate that the set of guest program instructions in the page has not been translated; and writing to the page.