Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mit-eddie.UUCP Path: utzoo!linus!security!genrad!mit-eddie!smh From: smh@mit-eddie.UUCP (Steven M. Haflich) Newsgroups: net.lang Subject: Re: Self-modifying code Message-ID: <1128@mit-eddie.UUCP> Date: Fri, 6-Jan-84 11:15:47 EST Article-I.D.: mit-eddi.1128 Posted: Fri Jan 6 11:15:47 1984 Date-Received: Sat, 7-Jan-84 02:56:41 EST References: <2157@fortune.UUCP> <19070@wivax.UUCP> Organization: MIT, Cambridge, MA Lines: 27 The most extreme case of self modifying-code in my experience was a large system which modified *every* instruction in a large executable module. While working on the FORMAC project at IBM, I evaluated a nice program verification system for 360 Assembly Language systems. The verifier would find instructions which were never executed by a suite of test programs. It started with a copy of the executable code module and copies of the assembly listings for all its source components. The executable was massaged to replace all executable instructions with trap instructions, then execution of the test suite was begun. Each time a trap was hit, the verifier would replace the trap with the original instruction, mark the source line in the assembly listing, then restart execution. When the test suite was finished, it would locate and/or count unmarked lines in the assembly listing. The reason for using code modification instead of attempting simple interpretive execution was so the test suite would run with reasonable speed: The execution time with the verifier would be the time taken by the suite without the verifier, plus a fixed amount of time per source line, not per instruction executed. Before anyone asks, I no longer remember the name of this code verifier, nor know whether it was any kind of available product. However, I sure wish something like it existed for the C compiler/assembler today! In addition to profilers, self modifying code is still used in some implementations of dynamic subroutine linkage.