pointers to freshly minted functions.

Roy Smith roy at phri.UUCP
Sun Mar 9 05:02:02 AEST 1986


In article <204 at dg_rtp.UUCP> throopw at 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



More information about the Comp.lang.c mailing list