A system and method for providing exceptional flow control in protected
code through memory layers. Code is generated. The generated code
includes a sequence of normal operations and is subject to protection
against copying during execution of the generated code. The generated
code is instantiated as a master process into a master layer in a memory
space. The master process is cloned by instantiating a copy of the master
process as a child layer in the memory space. Execution points within the
generated code are identified. A copy of at least a portion of the
generated code containing each execution point as an exception layer is
instantiated in the memory space. The generated code in the exception
layer is patched at each identified execution point with operations
exceptional to the normal operations sequence and which are performed
upon a triggering of each execution point during execution of the
generated code.