Path: utzoo!attcan!uunet!bu.edu!snorkelwacker!usc!wuarchive!udel!mmdf From: kosma%human-torch@stc.lockheed.com (Monty Kosma) Newsgroups: comp.sys.amiga Subject: Whats wrong with self Modifying Code? Message-ID: <24379@snow-white.udel.EDU> Date: 12 Jul 90 19:20:53 GMT Sender: mmdf@udel.EDU Lines: 35 From: Glenn Patrick Steffler Newsgroups: comp.sys.amiga.tech Keywords: religion, gurus, whats up? Date: 9 Jul 90 16:36:07 GMT Organization: Gerbils On Speed Inc. Sender: amiga-relay-request@udel.edu I have been waiting for people to show all of the great ways to avoid self modifying code. But the examples have been contrived and not the least instructive. Lets take a real world example: A spread sheet program which must perform several thousand iterations of a formula while recalculating. The formula can be "compiled" to the stack, and run such that the execution time is considerably less than if the formula had been interpreted each time. A video device driver or some such that uses raster ops to write values to the video display. (Given the Amiga has a blitter with this ability I do not ask for confirmation of the relevance of this arguement) The driver can "compile" a raster operation fill algorithm into some small code segment and run it. This is indeed self modifying code, but is almost essential for speed, because the user hates to wait for screen refresh. Anyway, that was just some fodder for you guys. I submit this for rationalization or destruction. I would think that these examples represent "code-generating" rather than "code-modifying." Why not just create the new code segments off in memory somewhere and then jump to that address? Would that be illegal?