A programming environment can be modified to provide automatic support for reverting program memory states. Such memory reversions are used to provide automatic support for state-reversion, undo, redo, and abort operations for application programs written with the programming environment. Memory allocation code (e.g., functions, procedures, etc.) are modified to mark allocated memory as protected, and an exception handler is assigned to such memory. Attempts to access the memory cause an exception to be generated. This exception is caught, providing opportunity for the memory to be preserved before it is modified. Previous memory states can be retrieved by restoring such stored memory states. State-reversion can be effected by creating a new current memory state corresponding to a previous (e.g., retrieved) memory state.
An undo operation is executed by an application by performing the inverse actions of the do operation to which the undo operation relates. Previous designs simply swapped memory to execute an undo operation according to code that was entirely dissimilar to the code of the do operation. The dissimilarity of the code caused debugging such operations to be difficult. Using the inverse action to undo an action results in the similar code for the do, undo, and redo operations. Also, undo atoms are logged for do, undo, and redo operations so that any exceptions thrown during an operation allows the application to return to a previous, consistent state by operating on the undo atoms.
Existing methods for returning program state to a previous state are often too heavy weight. Often these methods attempt to guarantee a series of properties to a programmer across a distributed environment or multiple threads. Instead, a program state reversion mechanism provides a light weight and efficient runtime solution for general purpose programming languages. For example, a series of program statements (e.g., methods, instructions, etc.) are indicated by a programmer in a state reversion language construct, such as a TryAll block. If an exception is thrown anywhere from within the TryAll block, the program is reverted to the pre-TryAll block state.
The invention provides a method and system for containing software faults in a computer processing environment. The method for containing software faults comprises allocating memory for a software module instance; allocating memory for at least one object assigned to the software module instance; identifying at least on object assigned to the software module instance in memory; and restricting access to the memory to the software module instance.
A system for designing, testing, and employing graphical computer code includes a graphics editor for creating a graphical display. The graphical display is made up of a plurality of graphical objects constructed by the graphics editor. A translator creates a high-level computer language code of the graphical object. The translator is connected to the graphics editor. A compiler receives the high level computer language code from the translator.