Path: utzoo!attcan!uunet!clyde.concordia.ca!news-server.csri.toronto.edu!utgpu!watserv1!sunee!gpsteffl From: gpsteffl@sunee.waterloo.edu (Glenn Patrick Steffler) Newsgroups: comp.sys.amiga.tech Subject: Re: Whats wrong with self Modifying Code? Keywords: religion, gurus, whats up? Message-ID: <1990Jul9.163607.18336@sunee.waterloo.edu> Date: 9 Jul 90 16:36:07 GMT References: <1990Jul6.201328.24660@csmil.umich.edu> <1990Jul6.201743.24777@csmil.umich.edu> <138523@sun.Eng.Sun.COM> Organization: Gerbils On Speed Inc. Lines: 50 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. In article <138523@sun.Eng.Sun.COM> cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) writes: >There isn't anything "wrong" with it per se as long as the system >supports it. When asked in context to the Amiga there are a couple >of issues : > >Issue : How do you get reliable self modifying code execution > when there is an instruction cache present ? Let's take [...] >they should be sure to spell out clearly on either the package or >in a README file that the code will not work reliably on a 68020 or >68030 system. >--Chuck McManis Sun Microsystems >uucp: {anywhere}!sun!cmcmanis BIX: Internet: cmcmanis@Eng.Sun.COM >These opinions are my own and no one elses, but you knew that didn't you. >"I tell you this parrot is bleeding deceased!" I agree this is a difficult thing to do, but aliasing the address of the self modifying code with several other addresses would make that point moot. Later -- Co-Op Scum - U of Loo '91 "Bo doesn't know software" - George Brett "Just got paid today, got myself a pocket full-o change" - ZZ top Glenn Patrick Steffler