Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!amdahl!oliveb!Ozona!chase From: chase@Ozona.orc.olivetti.com (David Chase) Newsgroups: comp.lang.c Subject: Re: Partial application in C Message-ID: <25082@oliveb.olivetti.com> Date: 8 Jul 88 19:26:05 GMT References: <3353@cognos.UUCP> <619@goofy.megatest.UUCP> <429@uwovax.uwo.ca> Sender: news@oliveb.olivetti.com Reply-To: chase@Ozona.UUCP (David Chase) Organization: Olivetti Research Center, Menlo Park, CA Lines: 40 In article <429@uwovax.uwo.ca> 16012_3045@uwovax.uwo.ca (Paul Gomme) writes: >in order to allow for "orderly" multitasking - i.e. if one process runs >amok, it shouldn't affect the other processes, which could occur if a program >can alter its code segment. > Besides, I thought that self-modifying code was (a) extremely difficult >to write, and (b) considered poor programming practice. Let me try to put this discussion back on track (or shelve it permanently). Note the subject: "Partial application in C". Modifying code segments is totally unrelated; what I wanted to know was, "what machines allow or don't allow execution within the data segment". This is NOT self-modifying code, this is a technique for implementing partial application. Because I am only creating code, then executing it (perhaps) several times, it is possible for me to (a) execute NOPS to clean out the instruction pipeline or (b) execute cache flush instructions or (c) execute a special block of some number of nops/jumps to be sure to touch the instruction cache line where the data might be stored (in the event that we are reusing some data addresses for a second round of code generation). or (d) call the OS to modify or copy the data into the code segment before returning from the subroutine which performs the partial application. The code (which is not self-modifying) is easy to write; it is generated by a subroutine call. Partial application is not poor programming practice. Again, what I (still) wish to know is what machines/operating systems allow me to use this technique for implementing partial application, and which ones require one of the magic handshakes (a,b,c,d) listed above, and which machines make it totally impossible. David Chase Olivetti Research Center, Menlo Park