Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!unisoft!hoptoad!dasys1!raylau From: raylau@dasys1.UUCP (Raymond Lau) Newsgroups: comp.sys.mac Subject: Re: What is wrong with the Sumacc C compiler Message-ID: <1939@dasys1.UUCP> Date: Tue, 10-Nov-87 16:58:39 EST Article-I.D.: dasys1.1939 Posted: Tue Nov 10 16:58:39 1987 Date-Received: Fri, 13-Nov-87 20:42:39 EST References: <7486@dartvax.UUCP> <7508@dartvax.UUCP> <21522@ucbvax.BERKELEY.EDU> <2283@watcgl.waterloo.edu> Organization: The Big Electric Cat Lines: 36 Keywords: C compiler gripe Summary: Moving code In article <2283@watcgl.waterloo.edu>, kdmoen@watcgl.waterloo.edu (Doug Moen) writes: > oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes: > ...concerning why the sumacc compiler is no good... > >The authors of the compiler seem to be unaware that on a Macintosh > >executable code can move while the program is running. Unlike all Macintosh > >compilers, they generate position _dependent_ code, and have a funky > >loader scheme to resolve non-relocatable references at program load > >time. Eventually, the code moves, and all that position dependent code > >points at never-neverland. > > Sorry, but this sounds blatantly impossible. If the code were to move > while the program is running, then *all of the return addresses and > function pointers on the stack would become invalid* and the program > would crash, regardless of what compiler was used to create the program. > > Now, I can see that maybe desk accessories might move around, > *but not application programs*. I think the reference to moveable code is that when a prgm is segmented, each segment, except the main segment, is relocatable when and if loaded into memory. When anything in that segment is called, a jsr is made to the jump table, which contains a jump to the actual procedure. When there're}i no references to procedures in that segment, it may be unloaded, and the entry in the jump table would be replaced by a jmp to a routine which would 1. load in the segment and 2. finally call the original procedure desired. I believe that is accurate, if not detailed. It's been a while since I've reviewed the info on the jump table...so, no promises. ----------------------------------------------------------------------------- Raymond Lau {allegra,philabs,cmcl2}!phri\ Big Electric Cat Public Unix {bellcore,cmcl2}!cucard!dasys1!raylau New York, NY, USA {sun}!hoptoad/ GEnie:RayLau Delphi:RaymondLau CIS:76174,2617 "Take it and StuffIt."