Self-modifying code
hjm
hjm at cernvax.UUCP
Tue Jul 12 19:57:43 AEST 1988
If the program is considered to be data for an interpreter which I will for
convenience call a CPU, then does self-modifying code seem any different? As
long as the data in this table remains consistent, then there should be no
difficulty in dealing with it mathematically. All of the problems of database
consistency have been tackled (but not all solved) some time ago. Code is data
according to a PATCH program, and the only tricky bits there are to ensure that
any changes fit inside the space that they replace and to patch up the jumps
where necessary. A bit like a structure linked by pointers, such as a binary
tree, except that code is in general a directed cyclic graph (the directedness
is due to the program counter).
Now, if the routines that ensure the consistency of the code change themselves,
then the world will most likely fall down around one's head, but then things get
to be so recursive that my stack oveflows ...
Hubert Matthews
More information about the Comp.lang.c
mailing list