Next: , Previous: , Up: Imperative Language Interpreter   [Index]


5.7 Execution Completion Cleanup

Programs may terminate execution when there are no more instructions to execute. They may also terminate, or interrupt, at an earlier time.

A program execution interruption may be due to some failed function or operator call (consider ‘asin(4)’) or to the so desire of the application (if the application executes programs step by step it may decide against continuing execution at any time).

See Imperative Program Execution.

The interruption of the program execution logic does not require special care, none other than the one implied by the application requirements itself. The data and the resource management of the interpreter are unperturbed by unexpected program interruption. But the arrangements made by the interpreter on behalf of the application with respect to resource deallocation (like those implied by variables coming out of use) are no longer observed.

See Data Type Definition.

All is not lost, though, for routines to clean up after an unexpected emergency program interruption are provided.

See x1f4_flat_program.

See x1f4_text_program.

The clean up routines visit each of the program variables and depending on variable type, call the appropriate (variable type specific) clean up methods. Which methods are in turn provided by the application itself.

See struct x1f4_c1_type.

Where the program execution interruption clean up routines fail is detection of variables in use. Thus, they’ll visit each variable, no matter initialized or not, and attempt to finalize it. The application must insure that in such event, the (variable type specific) clean up methods the application itself provided can distinguish between in use and not in use data (between initialized and uninitialized data that is).

The program execution interruption clean up routines can tell in use and not in use string data (i.e. variables) apart, though. The string specific clean up method is thus called only for application allocated strings. Note that with respect to interpreter internal logic, application refers to anything that is not the interpreter itself and thus include libraries, even those provided by the libaime itself.

See x1f4_c1_empty_string.

Furthermore, since the interpreter does not provide for resource allocation, variable related or not, the application only needs to insure the deallocation of the data for which itself arranged allocation. No extra steps are required at program interruption if means for data allocation were not provided.


Next: The Missing Bits, Previous: Imperative Program Execution, Up: Imperative Language Interpreter   [Index]