Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!sunic!draken!bjornl From: bjornl@tds.kth.se (Bj|rn Lisper) Newsgroups: comp.arch Subject: Re: Self-modifying code Message-ID: Date: 11 Oct 89 15:07:24 GMT References: <1080@mipos3.intel.com> <48682@ricerca.UUCP> <236@bbxsda.UUCP> Sender: news@nada.kth.se Organization: The Royal Inst. of Technology (KTH), Stockholm, Sweden. Lines: 11 In-reply-to: scott@bbxsda.UUCP's message of 10 Oct 89 22:03:57 GMT Self-modifying code can be seen as partial evaluation delayed to runtime. Partial evaluation, in its cleanest form, is to use the knowledge of some function arguments to simplify the function. Consider a function f(x,y) in two arguments x,y. If we know the value of x, say that x=c, then we can substitute c for x in the call f(c,y) and obtain a simplified "residual" function fc(y). Usually this is done at compile-time. A prime example is substitution of symbolic constants. Nothing prevents, however, that this is done at runtime (if, for instance, x is not known before then), which then results in self-modifying code. Bjorn Lisper