A method and apparatus for efficiently executing nested transactions is
herein described. Hardware support for execution of transactions is
provided. Additionally, through the use of logging previous values
immediately before a current nested transaction in a local memory and
storage of a stack of handlers associated with a hierarchy of
transactions, nested transactions are potentially efficiently executed.
Upon a failure, abort, or invalidating event/access within a nested
transaction, the state of variables or memory locations written to during
execution of the nested transaction are rolled-back to immediately before
the nested transaction, instead of all the way back to an original state
of the variables or memory locations before an enclosing transaction. As
a result, nested transactions may be re-executed within enclosing
transactions, without flattening the enclosing and nested transactions to
re-execute everything.