Self-modifying code

Charles Marslett chasm at killer.UUCP
Tue Jul 12 12:18:12 AEST 1988


In article <33441 at yale-celray.yale.UUCP>, lisper-bjorn at CS.YALE.EDU (Bjorn Lisper) writes:
> Another related issue is that self-modifying code cannot be executed
> directly from ROM. Executing programs in ROM is an important memory-saving
> technique in small, diskless, special-purpose systems.

Actually, I always thought that ROM was much more important as a way of
eliminating the need to load the code and as a way of guaranteeing non-
self-modifying-ness.  Usually ROM code is larger (thus memory-consuming)
than RAM-loaded code.  This is because most RAM based systems assume some
form of selfmodification of code, ranging from relocation tables that avoid
the need for self-relative addressing everywhere to file initialization code
that gets overwritten by its own buffer.  On the other hand, some RAM based
systems require 4 Mb to run an editor, so you may be right in those cases
:->} !!

Seriously, newer architectures have reduced the difference (to 0 perhaps),
but the emphasis on RISC these days may resurrect self-modifying code --
a RISC-er technique is not known to mankind!  (:-D}===<<).

> Bjorn Lisper


Charles Marslett



More information about the Comp.lang.c mailing list