Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site phri.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ittatc!dcdwest!sdcsvax!ucbvax!hplabs!pesnta!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: net.lang.c,net.arch Subject: Re: pointers to freshly minted functions. Message-ID: <2277@phri.UUCP> Date: Sat, 8-Mar-86 14:02:02 EST Article-I.D.: phri.2277 Posted: Sat Mar 8 14:02:02 1986 Date-Received: Tue, 11-Mar-86 01:34:17 EST References: <1700003@umn-cs.UUCP> <1700004@umn-cs.UUCP> <6449@utzoo.UUCP> <204@dg_rtp.UUCP> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 26 Keywords: tagged architectures Xref: watmath net.lang.c:8111 net.arch:2757 In article <204@dg_rtp.UUCP> throopw@dg_rtp.UUCP writes: [In an ongoing discussion about self-modifying code] > [on certain machines, like a pdp-11 with I&D spaces] code is code and > data is data and never the twain shall meet. [...] Consider a C > function which creates an instruction stream, and returns a pointer to a > function which when invoked will execute this instruction stream. [...] > It must *always* be possible to implement this function, otherwise > compilers would not be possible, since compilers are simply programs that > treat code as data (though sometimes an implementation of the above > function will have to start one or more new processes...) The Buroughs B5700 had (in addition to the strangest subroutine linkage I've ever seen) a tagged architecture. Each memory word had a (3-bit?) tag which defined the value stored there as integer, real, pointer, instruction, etc. This tag was not directly accessible by a programmer which made it kind of hard to implement a compiler. Presumably (I never actually used a B5700) there was some magic way the OS used to convert data into code, but I never ran accross any reference to it. One of the other oddities about the 5700 was a lack of conventional assembler -- you did systems programming in an Algol derivitive. -- Roy Smith, {allegra,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016