The Algol compiler on B6700 systems offered an interface to the operating system whereby executing code could pass a text string or a named disc file to the Algol compiler and was then able to invoke the new version of a procedure.With interpreted languages, the "machine code" is the source text and may be susceptible to editing on-the-fly: in SNOBOL the source statements being executed are elements of a text array.However, the capability was rarely used in practice.
Instructions can be dynamically created in memory (or else overlaid over existing code in non-protected program storage), in a sequence equivalent to the ones that a standard compiler may generate as the object code.
With modern processors, there can be unintended side effects on the CPU cache that must be considered.
The Push programming language is a genetic programming system that is explicitly designed for creating self-modifying programs.
While not a high level language, it is not as low level as assembly language.
Prior to the advent of multiple windows, command-line systems might offer a menu system involving the modification of a running command script.
Suppose a DOS script (or "batch") file contains the following: Upon initiation of from the command line, Show Menu presents an on-screen menu, with possible help information, example usages and so forth.Control table interpreters can be considered to be, in one sense, 'self-modified' by data values extracted from the table entries (rather than specifically hand coded in conditional statements of the form "IF inputx = 'yyy'").The IBM SSEC, demonstrated in January 1948, had the ability to modify its instructions or otherwise treat them exactly like data.Using self-modifying code, it is possible to store a register's contents into the second byte of the instruction, then execute the modified instruction in order to achieve the desired effect.Some compiled languages explicitly permit self-modifying code.For example, in the Intel 8080 instruction set, one cannot input a byte from an input port that is specified in a register.